Javascript文档窗口

时间:2016-12-06 04:09:27

标签: javascript html

为什么我的弹出窗口不会弹出? 我的用户应输入预约信息。点击提交后,应弹出一个文档窗口。提交按钮似乎有效。清除按钮也正常工作。我编写了一个函数来处理窗口并设置onSubmit以返回该函数。

 < script type = "text/javascript" >
   function popUpWindow() { //window should return user's name in a window
     newWin = window.open('', 'NewWin', 'toolbar=no,status=no,width=500,height=200');
     newWin.document.write("<body bgcolor='yellow'><h3>Appointment Confirmation</h3>);
    	newWin.document.write("
         Your name is: " + document["
         form "].name.value);
    	newWin.document.close();
    }
    </script>
<html>

<head>
  <title>Project</title>
</head>
//this form should accept user's input

<body>
  <form name="form" onSubmit="return popUpWindow();">
    Please enter your name:
    <input type="text" name="name" value="" size="50" />
    </p>
    <p>
      Address:
      <input type="text" name="address" size="50" />
    </p>
    <p>
      Phone:
      <input type="text" name="area_code" size="10" />
    </p>
    <p>
      Email:
      <input type="text" name="email" value="" size="20" />
    </p>
    <p>
      <legend>Stylist</legend>
    </p>
    <input type="radio" name="stylist" id="stylist1" value="dream" />Dream
    <input type="radio" name="stylist" id="stylist2" value="aubrey" />Aubrey
    <input type="radio" name="stylist" id="stylist3" value="stag" />Stag
    <input type="radio" name="stylist" id="stylist1" value="halo" />Halo
    <p>
      <legend>Services</legend>
    </p>
    <input type="checkbox" name="service" id="service1" value="cut" />Cut
    <br/>
    <input type="checkbox" name="service" id="service2" value="relaxer" />Relaxer
    <br/>
    <input type="checkbox" name="service" id="service1" value="weave" />Weave
    <br/>
    <input type="checkbox" name="service" id="service1" value="braids" />Braids
    <br/>
    <input type="checkbox" name="service" id="service1" value="wash" />Wash and Style
    <br/>
    <input type="checkbox" name="service" id="service1" value="natural" />Natural
    <br/>
    <p>Leave Comments</p>
    <textarea name="comments" id="comments" align="left" rows "8" cols "75"></textarea>
    <input type="submit" value="Submit" />
    <input type="reset" value="Clear" />
  </form>
</body>

</html>

0 个答案:

没有答案