Script controling dropdown, loading link in 2nd window


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Script controling dropdown, loading link in 2nd window

Hybrid View

  1. #1
    Perry Garrod Guest

    Script controling dropdown, loading link in 2nd window


    I have a JavaScript which processes the contents/selection of a dropdown box,
    loading the associated URL or page.

    This works fine.

    However what I want is for the URL/Page to load in the main window/frame
    (not a new window but one already on screen) and not the current, contents
    one.

    I have tried using target in various ways with no success.

    Pardon any 'dullness', it's my first ever venture into JavaScript

    Example of Script is.
    <SCRIPT>
    /* comments in JavaScript here */
    function change_site()
    {var
    site=document.myform.mypopup.selectedIndex;
    if (confirm('Are you sure you want to change site? ' + site))
    {if (site==1) {
    window.location.href=document.myform.mypopup.options[site].text; }
    else {
    window.location.href=document.myform.mypopup.options[site].value;} }
    }
    </SCRIPT>


  2. #2
    Russell Jones Guest

    Re: Script controling dropdown, loading link in 2nd window

    See the window.open() function. You can direct the response to a new window,
    or to any named window. If the named window doesn't exist, the function
    opens it. If the named window already exists, it causes that window to
    request the specified URL.

    "Perry Garrod" <perrygarrod@hotmail.com> wrote in message
    news:3e27d164$1@tnews.web.devx.com...
    >
    > I have a JavaScript which processes the contents/selection of a dropdown

    box,
    > loading the associated URL or page.
    >
    > This works fine.
    >
    > However what I want is for the URL/Page to load in the main window/frame
    > (not a new window but one already on screen) and not the current, contents
    > one.
    >
    > I have tried using target in various ways with no success.
    >
    > Pardon any 'dullness', it's my first ever venture into JavaScript
    >
    > Example of Script is.
    > <SCRIPT>
    > /* comments in JavaScript here */
    > function change_site()
    > {var
    > site=document.myform.mypopup.selectedIndex;
    > if (confirm('Are you sure you want to change site? ' + site))
    > {if (site==1) {
    > window.location.href=document.myform.mypopup.options[site].text; }
    > else {
    > window.location.href=document.myform.mypopup.options[site].value;} }
    > }
    > </SCRIPT>
    >




  3. #3
    Perry Garrod Guest

    Re: Script controling dropdown, loading link in 2nd window


    "Russell Jones" <arj1@nospam.northstate.net> wrote:
    >See the window.open() function. You can direct the response to a new window,
    >or to any named window. If the named window doesn't exist, the function
    >opens it. If the named window already exists, it causes that window to
    >request the specified URL.
    >
    >"Perry Garrod" <perrygarrod@hotmail.com> wrote in message
    >news:3e27d164$1@tnews.web.devx.com...
    >>
    >> I have a JavaScript which processes the contents/selection of a dropdown

    >box,
    >> loading the associated URL or page.
    >>
    >> This works fine.
    >>
    >> However what I want is for the URL/Page to load in the main window/frame
    >> (not a new window but one already on screen) and not the current, contents
    >> one.
    >>
    >> I have tried using target in various ways with no success.
    >>
    >> Pardon any 'dullness', it's my first ever venture into JavaScript
    >>
    >> Example of Script is.
    >> <SCRIPT>
    >> /* comments in JavaScript here */
    >> function change_site()
    >> {var
    >> site=document.myform.mypopup.selectedIndex;
    >> if (confirm('Are you sure you want to change site? ' + site))
    >> {if (site==1) {
    >> window.location.href=document.myform.mypopup.options[site].text; }
    >> else {
    >> window.location.href=document.myform.mypopup.options[site].value;} }
    >> }
    >> </SCRIPT>
    >>

    >
    >

    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center