Results 1 to 2 of 2

Thread: Using check boxes to select what new windows to open

  1. #1
    Join Date
    Apr 2008
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Using check boxes to select what new windows to open

    Hi there,

    I was wondering if someone could write a bsic script for me. I went some check boxses then wen the user hits submit .. its opens a new windows with a specific link.

    e.g if i had google yahoo msn and dynamic drive as check boxes and i selected google and yahoo then hit submit i would like two new windows to open one with google and the other with yahoo

    thanks
    paul

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Does this help you
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    *,form{margin:0;padding:0;}
    #content
    {
    width:200px;
    padding:20px;
    margin:10px auto;
    border:3px double #222;
    font-family:Tahoma;
    font-size:9pt;
    }
    input{margin:2px 10px;}
    </style>
    <script type="text/javascript">
    window.onload = function()
    {
    	document.myform.mysubmit.onclick = function()
    	{
    	var check1 = document.myform.check1;
    	var check2 = document.myform.check2;
    	var check3 = document.myform.check3;
    	if(check1.checked == true)
    		{
    		window.open('http://www.google.com','mywindow','width=800,height=500,scrollbar=0');
    		}
    	if(check2.checked == true)
    		{
    		window.open('http://www.yahoo.com','mywindow1','width=800,height=500,scrollbar=0');
    		}
    	if(check3.checked == true)
    		{
    		window.open('http://www.dynamicdrive.com','mywindow2','width=800,height=500,scrollbar=0');
    		}
    	else
    	alert('You had not choosen from our checkbox...');
    	}
    }
    </script>
    </head>
    <body>
    <div id="content">
    <form name="myform">
    <input type="checkbox" name="check1"/>Google<br/>
    <input type="checkbox" name="check2"/>Yahoo<br/>
    <input type="checkbox" name="check3"/>Dynamic Drive<br/><br/>
    <input type="submit" value="Open Please" name="mysubmit"/>
    </form>
    </div>
    </body>
    </html>
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

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
  •