怎么用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页面信息交互的方法。其中主要介绍了窗体中的基本元素的主要功能和使用。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值