SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Auto-Populate Drop Down Menus Script?

    I am currently using "chained select menu" for drop down lists. I also have 2 popups of pictures and descriptions for items in my shopping cart. The chained select menu drop downs are linked to items in my shopping cart. What I would like to do is this...

    I want there to be links (or Buttons) in the popup that when clicked will auto populate the drop downs and then then user will only have to click go to be taken to the url already specified in the chained slect menu script.

    Basically, link the existing popups to auto populate the existing drop down menu..

    Is there an existing javascript for this function or existing dhtml? If so, would anyone be so kind to direct me to it? Thanks a bunch.

    Nourah

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,495
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    bit rough but

    Main Page
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--
    // Script produced with PopUpGenerator
    // by Vic Phillips http://www.vicsjavascripts.org.uk

    // Insert this script between the <header> tags

    var pugWindow1=null;

    function 
    pugNewWindow(pugname,puglink){
     
    pugCloseWin();

     if (
    pugname==pugWindow1){
      
    pugWindow1=window.open(puglink,'pugWindow1','width=200,height=200,left=110,top=120');
     }
    }

    function 
    pugCloseWin(){
    // Recommended - include onunload="pugCloseWin();" in the <body> tag.
     
    if (pugWindow1&&!pugWindow1.closed){ pugWindow1.close(); }
    }
    Ary=new Array('One','Two','Three');
    function 
    Populate(){
     for (
    i=0;i<Ary.length;i++){
      
    document.getElementById('fred').options[i]=new Option(Ary[i],'',true,true);
     }
     
    document.getElementById('fred').selectedIndex=0;
    }

    //-->
    </script>




    </head>

    <body  >
    <select id="fred" size="1">
    </select>

    <span onclick="javascript:pugNewWindow(pugWindow1,'put1.htm');" >TEST</span>

    </body>

    </html> 
    put1.htm
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--
    function 
    Send(){
     
    window.opener.Populate();
    }
    //-->
    </script></head>

    <body>
    <input type="button" name="" value="link" onclick="javascript:Send();">
    </body>

    </html> 


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
  •