Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy How would I make this page example functional?

    An example of a page I'm trying to make can be found here:

    http://homepage.mac.com/jkrivoshein/js/index.html

    Its not an addition thing, the numbers are just variables. Basically, I want to be able to select two different drop down menus, then, click on the Submit button which will launch a small pop up window with the result of what would happen where two separate numbers are choosen.

    I have no idea where to start

    Does anyone have an idea of what I should start reading to understand how to do this, or is there any example code with this sort of situation in mind?

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure I understand what you want, but try this just in case.

    Code:
    <html>
    <head>
      <script type="text/javascript">
      function openNew() {
        var html_src="<html><head><title>NewWin</title></head><body><div>You choose " + f1.s1.options[f1.s1.selectedIndex].value +
                     " and " + f2.s2.options[f2.s2.selectedIndex].value + " so there!</div></body></html>";
        var popup_win=window.open('','','scrollbars=no,toolbar=no,width=300,height=200');
        popup_win.document.open();
        popup_win.document.write(html_src);
        popup_win.document.close();
      }
      </script>
    </head>
    <body>
    
    <center>
    
    <TABLE BORDER=0 CELLPADDING=0>
    <TR> <TD><form name="f1" action="#" onsubmit="return(false);">
    <select name="s1">
    <option value="select" selected="selected">Select</option>
    <option value="fam">1</option>
    <option value="ind">2</option>
    <option value="fiat">3</option>
    <option value="audi">4</option>
    <option value="audi">5</option>
    <option value="audi">6</option>
    <option value="audi">7</option>
    <option value="audi">8</option>
    </select>
    </form></TD>    
    
    <TD><form name="f2" action="#" onsubmit="return(false);">
    <select name="s2">
    <option value="select" selected="selected">Select</option>
    <option value="fam">1</option>
    <option value="ind">2</option>
    <option value="fiat">3</option>
    <option value="audi">4</option>
    <option value="audi">5</option>
    <option value="audi">6</option>
    <option value="audi">7</option>
    <option value="audi">8</option>
    </select>
    </form></TD> 
    
    <TD><form id="form5" name="form5" method="post" action="" onsubmit="openNew(); return(false);">
      <label>
      <input type="submit" name="Submit" value="Submit" />
      </label>
    </form></TD> </TR>
    </TABLE>
    
    </center>
    </body>
    </html>
    david_kw

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah, that is neat, thank you for the help! Ideally, I want to create 64 separate webpages, and then have that open window function direct you to the correct one. For example, if you choose 3, then 6, and click submit, it will open a popup window displaying page 36 (which I actually haven't made yet, but that will be easy).

    It seems like all i need to do is to figure out how to change the openNew() function you provided to redirect to the correct page.

  • #4
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It is probably something like this

    Code:
    window.open("http://www.site.com/page" + f1.s1.options[f1.s1.selectedIndex].text + "" + f2.s2.options[f2.s2.selectedIndex].text + ".html");
    Note this is untested but the basic idea.

    david_kw

  • #5
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile

    Quote Originally Posted by david_kw View Post
    It is probably something like this

    Code:
    window.open("http://www.site.com/page" + f1.s1.options[f1.s1.selectedIndex].text + "" + f2.s2.options[f2.s2.selectedIndex].text + ".html");
    Note this is untested but the basic idea.

    david_kw
    This looks like it will work perfectly once I get all the pages made, thank you so much!!!


  •  

    Posting Permissions

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