JS(三)

来源:互联网 发布:修改hostname centos 编辑:程序博客网 时间:2024/05/28 03:04

1.函数传参function  show(a){

alert(a)

    }

show(1)

2.俩个参数 

function toSet(name,value){

var  oDiv=document.getElementById("id名")

oDiv。style[name]=value

}

toSet("width","400px")

3.提取input点击事件

window.onload=function(){ //页面加载完成之后运行

var inp=document.getElementById("input")//提取事件

inp.onclick=function(){//匿名函数

alert("111")

}

}

4.取值   弹框显示img的title属性

function(){

var  oDiv=document.getElementById("img")

alert(oDiv.title)

}

原创粉丝点击