<html>
<head>
<title>可以測試HTML及JAVASCRIPT的頁面</title>
</head>
<body>
<script language="JavaScript">
function clear(){
   if (form1) {
   clear = confirm("確定要關閉嗎?",'');  //關閉窗口的提示
   if(clear) {                            //清空桌面的內容
   document.form1.reset();
   document.form1.value = "";
  }
 }

function test(){
  {
  temp = document.form1.mytxt.value;    //獲取代碼內容
  testwin= open("", "testwin","status=no,menubar=yes,toolbar=no");//打開視窗
  testwin.document.open();             
  testwin.document.write(temp);     //在視窗內輸入內容
  testwin.document.close();         //關閉窗口
 }
}
function about(){                   //“關於”按鈕的提示
 alert("可以直接在頁面中顯示輸入的代碼")
}
function help(){                    //説明按鈕的效果
 OpenWindow=window.open("", "newwin","height=420,width=470,toolbar=no,scrollbars="+scroll+",menubar=no");
 OpenWindow.document.write("<body bgcolor='white' text='black' alink='blue'vlink='blue' link='blue'><TITLE>提示</TITLE>")
 OpenWindow.document.write("<center>把要顯示的代碼放到上頁的輸入框中,按顯示按鈕就能顯示你的頁面內容</center><br>")
 OpenWindow.document.write("<center><a href='javaform1:close()'>關閉窗口</a></Center>")
 OpenWindow.document.close()
 self.name="main"
}
</script>
<form name="form1">
<textarea name="mytxt" rows="20" cols="100"
wrap="off"></textarea>
<br>
<input type="button" value="顯示" onClick="test()"> 
<input type="button" value="清除" onClick="clear()"> 
<input type="button" value="關於" onClick="about()"> 
<input type="button" value="幫助" onClick="help()">
</form>
</body>
</html>


 

arrow
arrow
    文章標籤
    javascript HTML testing right now
    全站熱搜
    創作者介紹
    創作者 痞客興 的頭像
    痞客興

    痞客興的部落格

    痞客興 發表在 痞客邦 留言(0) 人氣()