SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast wildscribe's Avatar
    Join Date
    Feb 2001
    Location
    A quiet burb just outside NYC
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need to change script to onChange

    Hi Folks,

    I just found this Jump Window script and it does everything I want it to, except I want the new Window to pop up after the site is selected. I don't want the user to have to click the submit button. I have played around with the script for a couple hours, putting in the "onChange" command in a few places and nothing seems to work. I'm sure it's an easy change for someone who knows JavaScript.

    Thanks to all!

    - Wild


    <head>
    <title>URL drop down test</title>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original Programmed by Ira Sterbakov - irasterb@erols.com -->
    <!-- May be freely used and modified -->
    <!-- fn is the id after the word form in the form name and the name of the select tag -->
    <!-- Each form will open in its own window -->
    <!-- options may be added to the window.open for its attributes -->
    function JumpSelect(fn) {
    var whi= eval("form" + fn +"." + fn +".value");
    window.open(whi,fn);
    }
    </SCRIPT>

    </head>

    <body bgcolor="#ffffff">


    <p align="center"></p>
    <form name="formj1" action="javascript:JumpSelect('j1')">
    <p align="center"><select name="j1" size="1">
    <option value="http://abcnews.com" selected>ABC News
    <option value="http://news.bbc.co.uk/">BBC News
    <option value="http://cbsnews.com">CBSnews.com
    <option value="http://cnn.com">CNN
    <option value="http://www.foxnews.com">FOXNews.com
    <option value="http://msnbc.com">MSNBC
    </select><input type="submit" value="Go!"></p>
    </form>

  2. #2
    SitePoint Zealot
    Join Date
    Aug 2002
    Posts
    168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Need to change script to onChange

    Originally posted by wildscribe
    [b
    <form name="formj1" action="javascript:JumpSelect('j1')">
    <p align="center"><select name="j1" size="1">
    <option value="http://abcnews.com" selected>ABC News
    <option value="http://news.bbc.co.uk/">BBC News
    <option value="http://cbsnews.com">CBSnews.com
    <option value="http://cnn.com">CNN
    <option value="http://www.foxnews.com">FOXNews.com
    <option value="http://msnbc.com">MSNBC
    </select><input type="submit" value="Go!"></p>
    </form> [/B]
    Try changing this, to this...

    Code:
    <form name="formj1">
    <p align="center">
    
      <select name="j1" size="1" onchange="JumpSelect('j1')">
        <option value="http://abcnews.com" selected>ABC News
        <option value="http://news.bbc.co.uk/">BBC News
        <option value="http://cbsnews.com">CBSnews.com
        <option value="http://cnn.com">CNN
        <option value="http://www.foxnews.com">FOXNews.com
        <option value="http://msnbc.com">MSNBC
      </select>
    
      <input type="submit" value="Go!">
    </p>
    </form>

  3. #3
    SitePoint Enthusiast wildscribe's Avatar
    Join Date
    Feb 2001
    Location
    A quiet burb just outside NYC
    Posts
    50
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the advice grahowler.

    Unfortunately, I couldn't get your code to work. It looks like I will need to experiment more with the onChange command. But you gave me some new ideas to try.

    --- Wild


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •