PC6下载站

分类分类

网页常用javascript代码收集

关注+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>
 

 

展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消