Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dropdown List and Command button

 
Todd Kanipe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am having a compatibility problem with a drop down list and Firefox. The obvious fix is a little JavaScript that I can't seem to get to work.

I have a drop down list that the user will select from. On the click of a button (image), I need to go to the new url.

This is my original code that doesn't work with Firefox; anybody know how to make it compatible?
<form name="frmSelectLicense">
<DIV>
<select name="mylicensebox">
<option value="/code-128-barcode-font.aspx">Select License Type</option>
<option value="/code-128-barcode-fonts-1U.aspx" selected="selected">One User License ($95)</option>
<option value="/code-128-barcode-fonts-10U.aspx">Ten User License ($190)</option>
<option value="/code-128-barcode-fonts-100U.aspx">One Hundred User License ($380)</option>
</select>
</DIV>
<DIV>
<a href="#" OnClick=location.href=mylicensebox.value>
<IMG src="/graphics/buy-now.gif" alt="Buy PrecisionID Code 128 Barcode Fonts" border="0" title="Buy Code 128 Barcode Fonts">
</a>
</DIV>
</form>


I found and adapted this JavaScript but the jump occurs with selection, not the click of the "buy-now" image. Any help is appreciated.
<script type="text/javascript">
function jump(objSelect){
if (objSelect.selectedIndex<=0) return false;
var objOpt = objSelect.options[objSelect.selectedIndex];
window.location.href=objOpt.value;
}
</script>
<select onChange="jump(this);">
<option value="/code-128-barcode-font.aspx">Select License Type</option>
<option value="/code-128-barcode-fonts-1U.aspx">One User License ($95)</option>
<option value="/code-128-barcode-fonts-10U.aspx">Ten User License ($190)</option>
<option value="/code-128-barcode-fonts-100U.aspx">One Hundred User License ($380)</option>
</select>
</div>
<div>
<a href="#" OnClick=location.href=mylicensebox.value>
<IMG src="/graphics/buy-now.gif" alt="Buy PrecisionID Code 128 Barcode Fonts" border="0" title="Buy Code 128 Barcode Fonts">
</a>
</div>
 
stef li
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try to change your code below:


to
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64838
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Todd Kanipe, please be sure to use code tags to highlight your code (rather than blue text).
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HTML tags and attribute names are to be written in all lowercase.
HTML attribute values are to be surrounded with double quotes.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to use

when referencing an element.
Eric
 
Todd Kanipe
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for the help. I've finally gotten it to work. It turnout there there was another form declared in the code that was messing with my addition. Once I figured that out, I was able to adjust. Again, Thanks!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic