[thelist] [javascript] passing vars in url to window.open

Paul Bennett paul at teltest.com
Thu Oct 17 18:13:02 CDT 2002


  DANG, I knew it was something simple!! The reason the call is in the
onclick handler is that this is an internal system used for project
management, but you are right, not best practice from me there.
Thanks for the help.

.jeff wrote:

<tip type="javascript" author="paul bennett">
looking for one of those drop-down boxes that automatically go to a new
url when you select an option?
simply add :
onChange="doNewPage(document.forms.formname.selectname.value);" into
your "<select>" tag
and the following function type to your scripts:

function doNewPage(valu)
    {
    if (valu == "option_1_value")
        {
        document.location = "your_new_page.html";
        }
    else if (valu =="option_2_value" )
        {
           document.location = "page_2.html";
        }
    // more else if clauses for each option
    }
</tip>

--
Paul Bennett
Internet Developer
Teltest Electronic Design
--------------------------
Phone : 64 4 237 0767
Web : http://www.teltest.com
Wap : http://wap.teltest.com
Email : paul at teltest.com
--------------------------






More information about the thelist mailing list