Click to See Complete Forum and Search --> : For the love of butter!


trevorama
02-11-2003, 03:13 PM
Sweet and merciful Zeus I cannot figure out why this doesn't work! :confused: Please put me out of my misery!

Here's the deal: I want the link to open in a new window *only* if the user selects the Recycling option in the pulldown menu. What am I missing?

function changeURL(param){
if (param="/recycling/index.html"){
window.open(param)
}
else{
window.location.href= param;
}
}

<!--
document.write("<select name=quicklink onChange='changeURL(options[selectedIndex].value)'>");
document.write("<option selected value='/index.html'> ------- Quick Link ------- ");
document.write("<option value='/index.html'>Home");
document.write("<option value='/business/index.html'>Business");
document.write("<option value='/recycling/index.html'>Recycling");
document.write("<option value='/tourism/index.html'>Tourism");
document.write("</select>");

Charles
02-11-2003, 03:28 PM
<script type="text/javascript">
<!--
function changeURL(param){
if (param == "/recycling/index.html"){
window.open(param)
}
else{
window.location.href= param;
}
}


document.write("<select name=quicklink onChange='changeURL(options[selectedIndex].value)'>");
document.write("<option selected value='/index.html'> ------- Quick Link ------- ");
document.write("<option value='/index.html'>Home");
document.write("<option value='/business/index.html'>Business");
document.write("<option value='/recycling/index.html'>Recycling");
document.write("<option value='/tourism/index.html'>Tourism");
document.write("</select>");
// -->
</script>
<noscript>
<!-- Don't forget the 10% of your users who do not use JavaScript -->
<p><a href="/index.html">Home</a> | <a href="/business/index.html">Business</a> | <a href="/recycling/index.html" target="_blank">Recycling</a> | <a href="/tourism/index.html">Tourism</a></p>
</noscript>

trevorama
02-11-2003, 04:21 PM
I sure hope this doesn't break forum protocol, but I really had to say THANKS!!! I *really* appreciate the help Charles.

Three hours of pulling my hair out and it was simply because I needed an extra equal sign. Uuugh! I think it's time for me to invest in a Javascript book and stop dabbling.

Thanks again!!! You definitely turned this :( into this :D.