5、JavaScript高级绪论.ppt

script language=javascript function changeDoc() { document.bgColor=blue; document.fgColor=red; document.alinkColor=yellow; document.vlinkColor=0x00ff00; document.linkColor=gray; } /script body onload=changeDoc() 这是普通的文本br a href=#这是一个超链接/a /body document 对象 HTML HEAD TITLE无标题文档/TITLE SCRIPT language=JavaScript function change(color) { document.bgColor=color ; } /SCRIPT /HEAD BODY H2 移过来我变色给你看看!/H2 FONT size=4 SPAN onMouseOver=change(red)变红色/SPAN| SPAN onMouseOver=change(blue)变蓝色/SPAN| SPAN onMouseOver=change(yellow)变黄色/SPAN /FONT /BODY 利用document对象的bgColor属性改变背景色 添加鼠标悬停事件 document 对象的方法 方法 名称 说明 clear ( ) 清除当前文档 close ( ) 关闭open打开的文档,关闭输出流并强制显示发送的数据 open ( ) 打开已经载入的文档以便进行编写 write (text) 将文本写入文档 writeln (text) 将文本写入文档,末尾加入”\n” html 这是最初的内容br script language=javascript document.write(这是write方法动态写入的内容br); function updatedoc() { document.writeln(abcbr); document.writeln(defbr); document.close(); var owin = window.open(,_blank); owin.document.writeln(xyzbr); owin.document.close(); owin.document.write(abcbr); owin.document.write(defbr); owin.document.close(); } /script input type=button name=update value=更新 onclick=updatedoc() /html html 这是最初的内容br script language=javascript document.write(这是write方法动态写入的内容br); function updatedoc() { document.writeln(abcbr); document.writeln(defbr); document.writeln(script language=javascript); document.writeln( function updatedoc()); document.writeln( {); document.writeln( document.writeln(abcbr);); document.writeln( document.writeln(defbr);); document.writeln( }); document.writeln(/scr + ipt); document.writeln(input type=button name=update value=更新 onclick=updatedoc()); //document.close(); /*document.writeln(abcbr); document.writeln(defbr); document.close(); var owin = window.open(,_blank); owin.document.writeln(xyzbr); owin.document.close(); owin.document.write(abcbr); owin.document.write(defbr); owin.document.close();*/ } /

文档评论(0)

1亿VIP精品文档

相关文档