javascript 1

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>alert</title>
  <script type="text/javascript">
  function rec(){
    var mychar="I love JavaScript";
    alert("hello!");
    alert(mychar);
    document.write(mychar)
  }
  function rec(){
    var mymessage=confirm("Are you girl");
    if(mymessage==true)
    {
        document.write("you are girl");
    }
    else
    {
        document.write("you are boy!");
    }
  }
  function rec(){
    var score; //score变量,用来存储用户输入的成绩值。
    score = prompt('input score');
    if(score>=90)
    {
       document.write("good!");
    }
    else if(score>=75)
    {
       document.write("good2!");
    }
    else if(score>=60)
    {
       document.write("good3!");
    }
    else
    {
       document.write("poor!");
    }
  }
  
  function Wopen(){
    window.open('http://www.imooc.com','_blank','height=600,width=400,top=100,left=0');  

  }
  
  function Woclose(){
    var mywin=window.open("http://www.imooc.com");
    mywin.close();
  
  }
  </script>
</head>
<body>
    <input name="button" type="button" onClick="rec()" value="Click alert" />
    <input name="button" type="button" onClick="rec()" value="Click confirm" />
    <input name="button" type="button" onClick="pro()" value="Click prompt" />
    <input name="button" type="button" onClick="Wopen()" value="Click Windowopen" / >
    <input name="button" type="button" onClick="Woclose()" value="Click Windowclose" / >
    
</body>
</html>
原文地址:https://www.cnblogs.com/lly-lly/p/5447148.html