Results 1 to 3 of 3
  1. #1

    How to duplicate the same Java Script code.

    Hi, Im trying to duplicate a search option on a page on my website..

    here is and example of the code
    ++++++++++++++++++++++++++++++++++++++

    <script language="JavaScript">
    function dosearch() {
    var sf=document.searchform;
    var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value);
    window.open(submitto);
    return false;
    }
    </script>

    <form name="searchform" onSubmit="return dosearch();">
    Search:
    <select name="sengines">
    <option value="http://www.google.com/search?q=" selected>Google</option>

    </select>
    For:
    <input type="text" name="searchterms">
    <input type="submit" name="SearchSubmit" value="Search it!">
    </form>
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++

    Now my question is, when i add this code to my site as is, it works. but if i try to add the same code again but say to search Wilkipedi, the forms show up for both, but search doesn't work. Im trying to keep them seaprate, hence the separate code. Does anyone know how to make it work so i can keep adding the same code with different forms?

    thanks in advance.

  2. #2
    Administrator Dave's Avatar
    Join Date
    Sep 2004
    Location
    Te Awamutu, New Zealand
    Posts
    3,959
    Blog Entries
    79
    Have you renamed the forms and JS functions? If you could post the URL it would help identify the problem.
    Dave Owen
    MediaCollege.com

  3. #3
    thank you.. renaming worked..

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
  •  
Subscribe to us on YouTube