• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

AHREF text changing

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I need a very urgent help. I have a code for example

<a name="pgLink" href="javascript:goToPage(${cntr.count},document.JumpToPageForm2);"/><h2><font color="">${cntr.count}</font></h2></a>

This will display the page numbers as 1 2 3 4 ...

All 1 2 3 4 are links. My requirement is I would like to remove the link and change the font color when that particular element is selected. I tried with form.pgLink.fontcolor=blue. But I am getting an error. Can some one pls help out with the sample code for changing color and removing link for the clicked element only?
[ February 27, 2007: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 311
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you trying to do it from the jsp, or from javascript ?

1)
I would first try to do it on the jsp level.
In most cases, it should be the most straight-forward approach.
The jsp should know which page is currently being rendered, so you can just add an 'if':
Inside every iteration (over 'count'), you ask if 'count' is the current page or not.
if it's the current page you write out something like <font...>{$ctr.count}</> without any 'a href' !
If it's not the current page, you print out the 'a href' as before.

2)
If you really need to use javascript to dynamically change from 'a href' to plain (non-clickable) text, you'll have to use DHTML.
I'd be *very* careful about this approach, though - it seems overly complicated for the requirements you descibe.
Anyway, if you really need it, you might google for 'DHTML' and 'innerHTML'.
Basically, you create a wrapper html tag (usally, '<span> , and inside it you can nest any html you like - in particular, you can dynamically switch between some plain 'font' tag, and a clickable 'a href'.

Good luck.
 
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please read this with regards to marking your posts "URGENT".

Doing so is the best way to ensure that your post is ignored by people who might be able to help you.
 
Nandhini Sridharan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply. I fixed that issue that day itself. I put for loop and find out which is the current page. Then I didnt put ahref link for the current page alone and gave link for all other pages. So it worked well.

Thank You.
 
Nandhini Sridharan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bear,

I dont put Urgent hereafter in the forum. I apologise.
 
Bear Bibeault
Sheriff
Posts: 67650
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No need to apologize, I'm just trying to help you get the most out of Javaranch as a resource.
 
if you think brussel sprouts are yummy, you should try any other food. And this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic