1 Replies - 555 Views - Last Post: 08 April 2013 - 01:10 AM

#1 glopez810  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 05-April 13

how to add things like a scroll bar via check box to a new window?

Posted 07 April 2013 - 06:35 PM

this script opens a new page of an inputed website. how can i manipulate the window it appears in via check box? for example, if the check box for a scroll bar is checked, how do i add this to the new window?

<!DOCTYPE html>
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
    <title></title>

    <script>


             function go(){

                var  myWindow;
                var urlValue = document.getElementById("urlValue").value;

                    //radio buttons
                    if(yes.checked){

                        myWindow = window.open(urlValue);
                    }

                    else if (no.checked ){
                        myWindow = window.open(urlValue, "_self"); 
                        }



                    //checkbox loop
                    /*
                    for (i=0; i<document.myForm.checkGroup.length; i++){
                        if (document.myForm.checkGroup[i].checked==true)
                        alert("Checkbox at index "+i+" is checked!")
                        }
                    */

              }

    </script>

  </head>
  <body>
    <form name="myForm">

      <p><label>Enter URL with http:// here: </label> <input id="urlValue" type="text"></p>
      <p><label>Would you like to open a new window?<br>
          <input name="yesNo" id="yes" type="radio">Yes<br>
          <input name="yesNo" id ="no" type="radio">No </label></p>
      <p><label>Other Options</label> <br>
        <input name = "checkGroup" id="fullScreen" type="checkbox">Full Screen<br>
        <input name = "checkGroup" id="scrollBar" type="checkbox">Scroll Bar<br>
        <input name = "checkGroup" id="statusBar" type="checkbox">Status Bar<br>
        <input name = "checkGroup" id="toolBar" type="checkbox">Tool Bar<br>
      </p>
      <p><input id="goButton" value="GO" type="button" onclick = "go()"></p>
    </form>

  </body>
</html>


Is This A Good Question/Topic? 0
  • +

Replies To: how to add things like a scroll bar via check box to a new window?

#2 Dormilich  Icon User is online

  • 痛覚残留
  • member icon

Reputation: 3576
  • View blog
  • Posts: 10,442
  • Joined: 08-June 10

Re: how to add things like a scroll bar via check box to a new window?

Posted 08 April 2013 - 01:10 AM

the 3rd parameter of window.open() determines the options (like scrollbars) for the new window. you would have to construct that from the checkboxes.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1