J
John
Code is as follows:
document.write('<FORM name="horseform">');
document.write(' <SELECT SIZE="1" NAME="horsebrandslist" STYLE="font-size:
8pt">');
document.write(' <OPTION VALUE="http://my.domain.com/cat1.html">Category
1</OPTION>');
document.write(' <OPTION VALUE="http://my.domain.com/cat2.html">Category
2</OPTION>');
document.write(' <OPTION VALUE="http://my.domain.com/cat3.html">Category
3</OPTION>');
document.write(' </SELECT>');
document.write(' <a href="javascript:;" title="Click here"
onclick="goto_PetCategoryURL(document.horseform.elements.horsebrandslist)"><img
border="0" src="../images/horse/someimage.gif" width="29" height="20"
alt="Click here" align="absbottom"></a>');
document.write('</FORM>');
In a separate .js file, the function "goto_PetCategoryURL" looks like this:
function goto_PetCategoryURL(object) {
if (object.selectedIndex > 0) {
window.location.href = object.options[object.selectedIndex].value;
}
return;
}
In Netscape (I use version 7), all works OK. In IE or Opera, when I click
the image, nothing happens. No error shows in the Opera JavaScript Console
or the bottom left of IE.
Who can solve this mystery?
Thanks,
Don
document.write('<FORM name="horseform">');
document.write(' <SELECT SIZE="1" NAME="horsebrandslist" STYLE="font-size:
8pt">');
document.write(' <OPTION VALUE="http://my.domain.com/cat1.html">Category
1</OPTION>');
document.write(' <OPTION VALUE="http://my.domain.com/cat2.html">Category
2</OPTION>');
document.write(' <OPTION VALUE="http://my.domain.com/cat3.html">Category
3</OPTION>');
document.write(' </SELECT>');
document.write(' <a href="javascript:;" title="Click here"
onclick="goto_PetCategoryURL(document.horseform.elements.horsebrandslist)"><img
border="0" src="../images/horse/someimage.gif" width="29" height="20"
alt="Click here" align="absbottom"></a>');
document.write('</FORM>');
In a separate .js file, the function "goto_PetCategoryURL" looks like this:
function goto_PetCategoryURL(object) {
if (object.selectedIndex > 0) {
window.location.href = object.options[object.selectedIndex].value;
}
return;
}
In Netscape (I use version 7), all works OK. In IE or Opera, when I click
the image, nothing happens. No error shows in the Opera JavaScript Console
or the bottom left of IE.
Who can solve this mystery?
Thanks,
Don