aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Dynamic links Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Dynamic links" Watch "Dynamic links" New topic
Author

Dynamic links

Jonathan Bagshaw
Greenhorn

Joined: May 05, 2006
Posts: 14
I've got a page with a Select (drop down) field.

Beside the select, I want a link that will open a new browser to a specific point in a help page depending on what is selected.

Currently I'm using an onClick action listener on a button that's tied to a function that executes


However in Firefox, a second click is needed to take the user to the correct position on the page.


Thanks,
Bags
[ January 23, 2007: Message edited by: Jonathan Bagshaw ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Use <a> with a target attribute of "_blank".

The link will open a new browser window.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jonathan Bagshaw
Greenhorn

Joined: May 05, 2006
Posts: 14
I don't see how that helps.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

If you want to use links instead of buttons, and have the links open new browser windows when clicked, then it helps.

If what you want is otherwise, you'll need to revise your original, rather rambling description of what you want.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
onchange="window.open('url#' + this.value);"

Eric
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Oh.

When you said "option" did you mean the elements of a select? That wasn't clear.

If so, then there is no possibility of links next to each option.
Jonathan Bagshaw
Greenhorn

Joined: May 05, 2006
Posts: 14
Yes.. I wanted a link next to a select (drop down) that would change depending on what was selected.
So that's impossible?

OK.. so if I stick with a button and an onClick listener, how do I fix the problem with Firefox needing 2 clicks?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Originally posted by Jonathan Bagshaw:
I wanted a link next to a select (drop down) that would change depending on what was selected.
So that's impossible?


Not at all. What's not possible is to have a link in the dropdown itself next to each option.

Look at Eric's code for a clue on how to change the value of the single link upon a change of the select element.

Hint: use the onchange handler to augment the URL for the help link whenever the select element changes value.
[ January 23, 2007: Message edited by: Bear Bibeault ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic links
 
Similar Threads
Using XML in JSP
XML Won't Display
drop down table
[XSL-FO][docbook]Problem print line in table of contents
How to save values in a database in JSTL?