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

Benjer futureweb at macmail.com
Fri Oct 18 04:18:01 CDT 2002


Concerning (tip).

Could we make it more flexible? by using obvious page naming strategies:

function doNewPage(valu){
        document.location = valu+".html";
    }

ben

On 18/10/02 1:15 am, "Paul Bennett" <paul at teltest.com> wrote:

> 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