1、插入和包含
???1)???js,一般都放在head之間、注釋的作用是當(dāng)客戶端瀏覽器版本過低時(shí),不能識別而發(fā)生錯(cuò)誤
<script?language="JavaScript">
<!--
document.write( "Hello?World!");
//-->
</script>
?2)另外你也可以編輯.js文件,然后在頁面里面直接引用就可以了
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>javascript</title><script language="javascript"src="Untitled-2.js"></script></head>
2、write
? 在js中要顯示字符,需要用document.write()的形式,writeln區(qū)別就是再write的基礎(chǔ)上加入了換行
3、如例
document.write("Hello World!");
document.write("test"+document.lastModified);
document.bgColor = " black "
其中,document是對象,write是method,輸出字符可以用加的形式,,可以在js里面設(shè)定頁面的背景
4、提示框
?? 1)window.alert("testtesttest")
??? 彈出窗口
?? 2)window.confirm("test")
?? 3)有輸入框的提示框
????????window.prompt("test")
一不小心雙擊了標(biāo)簽了,寫的全都沒了!!!后面的不寫了,寫js時(shí)一定要注意“”?? ’號的運(yùn)用!
js的功能是超級強(qiáng)大的,運(yùn)用還是要靠腦筋的,
posted on 2006-10-26 12:09
rkind 閱讀(465)
評論(0) 編輯 收藏 所屬分類:
JSP&Servlet