怎么用php配合js编写动态页面_JavaScript_JavaScript教程:用JS脚本实现Web页面信息交互范例,要实现动态交互,必须掌握有 - phpStudy...
要實現動態交互,必須掌握有關窗體對象(Form)和框架對象(Frames)更為復雜的知識。
三、范例
下面我們演示通過點擊一個按鈕(red)來改變窗口顏色,點擊“調用動態按鈕文檔”調用一個動態按鈕文檔。
test8_1.htm
//原來的顏色
document.bgColor="blue";
document.vlinkColor="white";
document.linkColor="yellow";
document.alinkcolor="red";
//動態改變顏色
function changecolor(){
document.bgColor="red";
document.vlinkColor="blue";
document.linkColor="green";
document.alinkcolor="blue";
}
調用動態按鈕文檔
輸出結果見圖1所示。
圖1
動態按鈕程序。
test8_2.htm
onClick="alert('You have to put an \'action=[url]\' on the form tag!!')"> var id,pause=0,position=0; function banner() { // variables declaration var i,k,msg=" 這里輸入你要的內容";// increase msg k=(30/msg.length)+1; for(i=0;i<=k;i++) msg+=" "+msg; // show it to the window document.form2.banner.value=msg.substring(position,position-30); // set new position if(position++==msg.length) position=0; // repeat at entered speed id=setTimeout("banner()",60); } // end --> banner(); |
返回
輸出結果見圖2所示。
圖2
本講介紹了使用JavaScript腳本實現Web頁面信息交互的方法。其中主要介紹了窗體中的基本元素的主要功能和使用。
總結
以上是生活随笔為你收集整理的怎么用php配合js编写动态页面_JavaScript_JavaScript教程:用JS脚本实现Web页面信息交互范例,要实现动态交互,必须掌握有 - phpStudy...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 笔记本电脑cpu插槽型号(笔记本电脑cp
- 下一篇: php打印 二维数组,PHP中遍历二维数