菜单

js中事件的拍卖与浏览器对象示例介绍

2019年8月1日 - 金沙前端

function mouseD(obj){
obj.style.color = “#f00”;
//当使用代码来设置样式时,假诺css中经过-来代表的,都必须求用驼峰标示font-size
-> fontSize
obj.style.fontSize = “16px”;
}
function outD(obj){
obj.style.color = “#000”;
obj.style.fontSize = “18px”;
}

<html xmlns=”” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″
/>
<title>js01_hello</title>
<meta name=”author” content=”Administrator” />
<script type=”text/javascript”>
// setTimeout(“endWelcome()”,5000);
// function endWelcome() {
// document.getElementById(“welcome”).style.display = “none”;
// }
</script>
</head>
<body>
<div id=”welcome”>迎接实行大家的网址</div>
<a href=”#”
onclick=”window.open(‘test02.html’,’aaa’,’width=300,height=300,resizable=0′)”>test02</a>
<a href=”#”
onclick=”window.open(‘test03.html’,’aaa’,’width=400,height=400,resizable=0′)”>test03</a>
<br/>
<a href=”#”
onclick=”window.open(‘bless.html’,’aaa’,’width=600,height=300′)”>输入你祝福语</a>
<a href=”#”
onclick=”window.open(‘bless.html’,’aaa’,’width=600,height=300′)”>选拔性别</a>
<div id=”bless”></div>
</body>
</html>

2,浏览器对象的事例:《涉及的是五个浏览器页面之间的传值》

您或然感兴趣的篇章:

<html xmlns=”” lang=”en”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″
/>
<title>js01_hello</title>
<meta name=”author” content=”Administrator” />
<script type=”text/javascript”>
function bless() {
//获取输入的祝福语
var mb = document.getElementById(“mb”).value;
//获取父类窗口
var p = window.opener;
//获取父类窗口中的id为bless的div
var pd = p.document.getElementById(“bless”);
//设置pd的值
pd.innerHTML = mb;
//关闭当前窗口
window.close();
}
</script>
</head>
<body>
输入祝福语:<input type=”text” size=”40″ id=”mb”/><input
type=”button” onclick=”bless()” value=”输入” />
</body>
</html>

</body>
</html>

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”
“;

复制代码 代码如下:

<澳门金沙国际,!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<title>轻巧的事件管理</title>

<!–
<script language=”text/javascript”
src=”hello.html”>这几个js的外界调用标签不能够自截至</script>
<link rel=”stylesheet” type=”text/css” href=”./styles.css”>
–>
<script type=”text/javascript”>
function clickD(obj){
alert(obj.innerHTML);
}

复制代码 代码如下:

<meta http-equiv=”keywords”
content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”this is my page”>
<meta http-equiv=”content-type” content=”text/html;
charset=UTF-8″>

复制代码 代码如下:

//with的用法
with(document){
write(“dddd<br/>”);
}
document.write(“aaaa<br/>”);
document.write(“bbbb<br/>”);
document.write(“cccc<br/>”);
</script>
</head>

<body>
<div onclick=”clickD(this)”
style=”cursor:pointer;”>点击了试一下</div>
<div onmouseover=”mouseD(this)”
onmouseout=”outD(this)”>鼠标移动来尝试</div>

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01//EN”
“;

相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图