Hi, I have an ASP page that needs to cross search on one of two recordset options, Products and Makers, so have duplicated the search form in home.asp and home.asp?func=1 so visitors just get one box to search and are redirected to the right page version to search from (ie home.asp for Products and home.asp?func=1 for Makers) on selecting the non default value from the dropdown menu with the two options, Products and Makers. I'm using onchange="funcRedirect();" for the listbox selectors as below <script type="text/javascript"> function funcRedirect() { if(document.form1.combo1.options[document.form1.combo1.selectedIndex].text!="Products") { window.location="home.asp?func=1"; } if(document.form2.combo3.options[document.form2.combo3.selectedIndex].text!="Makers") { window.location="home.asp"; } } </script> This works fine for the first selection, the user selects Makers and is taken to home.asp?func=1. However, when Products is now selected in home.asp?func=1, they do not return to home.asp but get an error, either Error: 'document.form2.combo3.options is null or not an object' in IE or document.form2.combo3 has no properties in Firefox. I've been trying for a few hours to find an answer for this one - can anyone point me in the right direction? How do I set the properties for document.form2.combo3? Thanks for any help on this Jeremy
Try it this way function funcRedirect() { if(document.forms["form1"].combo1.options[document.forms["form1"].combo1.selectedIndex].text!="Products") { window.location="home.asp?func=1"; } if(document.forms["form2"].combo3.options[document.forms["form2"].combo3.selectedIndex].text!="Makers") { window.location="home.asp"; } } if it still does not work .. then perhaps something else is missing from your codes
Thanks VONRAT, but unfortunately that didn't work either, it gave me the same message as before. I'm not sure it likes being referenced from a func=1 address so will have another look at page naming