File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic links

 
Jonathan Bagshaw
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use <a> with a target attribute of "_blank".

The link will open a new browser window.
 
Jonathan Bagshaw
Greenhorn
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see how that helps.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
onchange="window.open('url#' + this.value);"

Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic