aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How to change the value of Hyperlink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How to change the value of Hyperlink " Watch "How to change the value of Hyperlink " New topic
Author

How to change the value of Hyperlink

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
Hi,

I am getting some dynamic record in my jsp page.and each records there is corresponding hyperlink .i.e issue.

I have a drop down box which consists of two values pending and issue.
On the selection of pending my records are showing with corresponding hyperlink .
But on selection of issue value i want to change the value of hyperlink i.e it should be view.
Please help me how to do this.
Thanks

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Please use a Meaningful Subject: http://faq.javaranch.com/java/UseAMeaningfulSubjectLine

You can change your subject by clicking the edit button in your post.

Eric
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Why don't you show and hide the link by setting the display equal to none or inline.

If you want to chaneg the link obj.href="foo" and obj.innerHTML = "bar"

Eric
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
Hi,
But my problem is that my hyperlinks are generated dynamically.
Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Without seeing code, we know no clue how anything works. So if you want better answers, post some code.

Please edit your original post and change the subject.

Eric
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
Hi,

i want to change the value of hyerplink value whose id is issueAppointment when the index of drop down box is 2.
Please help me.


This is my jsp page code;




and Below is my js code

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are changing the page location here:



If you want to change the link, you need to set the links href, not the window location.

Eric
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
Hi,
if i select the dropdown box value pending then the
window location should be
window.location.href='appointementlist!showappoinList.action'

and otherwise
window.location.href='appointementlist.action'

after getting new location i want to change the value and href of hyperlink.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
If you change the page location, the page no longer exists.

It is like erasing your whiteboard, you need to start over again.

Eric
pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 301
then can you tell me how can i do this.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
I do not know what you are trying to do exactly. You are changing the page and you want the new page to have a different link? Why is the server not setting that up than?

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to change the value of Hyperlink