一些基础的 Javascript 内容

 

1. 了解  onLoad.html  熟悉onLoad,onUnLoad方法
          with.html    熟悉with方法的用法

 

onLoad.html页面代码 :

<html><head></head>
    <body onLoad="alert('hello')" onUnload="alert('bye-bye')">
    nihao   
    </body>
</html>

 

----------------------------

window_open.html

 

<html><head><title>新开窗口</title></head>
<body>
<script type="text/javascript">
var abc=window.open("with.html","newWin","toolbar=no,left=200,top=100,menubar=no,width=320,height=100,resizable=no");
</script>
<input type="button" οnclick="abc.close();" value=" 关闭弹出窗口" />
</body>
</html>

 

 

---------------------------------------

with.html 页面代码:

 

<html>
<head><title>函数</title></head>
<body>
<script type="text/javascript">
with(document)
{
    write("This is a default document action");
    write("<br>");
    write("<font color=/"red/">");
    write("this is a default document action too");
    write("</font>");
}
</script>
</body>
</html>

 

-----------------------------------

for...in 的用法.html

 

<html><head><title>函数</title></head>
    <body>
        Javascript  中for...in循环的用法<br/>
    在这里eee是一个下标值,实际上也是对象,
    "alex"对象的属性名称为1,属性值为alex<br/><br/>
    <script type="text/javascript">
        var a = new Array("alex","mark","sean","victor","lynn");
        for(eee in a)
        {
            document.write(eee+"---");
            document.write(a[eee]+"<br>");
        }
    </script>
    </body>
</html>

 

 

2. Javascript内置对象

 

this 指当前对象(也就是当前标签)
for...in
in 后跟一个对象,对此对象中的所有元素循环一次 ,用法请参见for...in的用法.html
with  为一段代码建立一个默认的对象,任何无对象的属性引用,都将使用该默认的对象
new  用于生成一个新的对象

 

3. Javascript事件处理

onFocus
onBlur
onChange 在select、text、textarea 的值被改变且失去焦点时
onClick
onLoad     当用户加载一个页面时
onUnLoad 当用户退出一个页面时
onMouseOver
onMouseOut
onSelect  当form对象中的内容被选中时
onSubmit 当用户按下提交按钮,提交表单之前执行这个方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值