分类分类
关注+2009-05-14作者:
网页常用javascript代码收集
1,document.all的用法
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Document.All Example #2</title>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<script language="javascript" type="text/javascript">
function left()
{
document.getElementById("heading1").align="left";
}
function bigger()
{
document.all["heading1"].style.fontSize="xx-large";
}
</script>
</head>
<body> <!-- Works in Internet Explorer and compatible -->
<h1 id="heading1" align="center" style="font-size: larger;">DHTML Fun!!!</h1>
<form name="testform" id="testform" action="#" method="get"><br /><br />
<input type="button" value="Align Left" onclick="left()" />
<br /><br />
<input type="button" value="Bigger" onclick=" bigger()" />
<input type="button" value="Smaller" onclick="document.all['heading1'].style.fontSize='xx-small';" />
<br /><br /> <input type="button" value="Red" onclick="document.all['heading1'].style.color='red';" />
<input type="button" value="Blue" onclick="document.all['heading1'].style.color='blue';" />
<br /><br /> <input type="text" name="userText" id="userText" size="30" />
<input type="button" value="Change Text" onclick="document.all['heading1'].innerText=document.testform.userText.value;" />
</form>
</body>
</html>
相关文章
更多+相同厂商
热门推荐
点击查看更多
点击查看更多
点击查看更多
说两句网友评论