1.常用属性:

*1,referrer:返回载入当前文档的URL;

<div>(第一个页面documentDome.html)
    <a href="documentDome1.html"> 去领奖</a>
</div>

  (第二页面documentDome1.html)
<script>
    var str=document.referrer;
    if(str==""){
        alert("不是连接")
    }else{
        alert("联接成")
    }
</script>



2.常用方法:

java学习内容回顾(document对象)

*1.getElementByld()方法

<div id="getname">第一名</div>
<input type="button"value="确定" onclick="show()"/>
<script>
    function show(){
        var str=document.getElementById("getname")
        alert(str.innerHTML="第二名")
    }
</script>




2.getElementByTagname()方法

<input type="text"value="春"/>
<input type="text"value="夏"/>
<input type="text"value="秋"/>
<input type="text"value="冬"/>
<input type="button"value="input内容"onclick="showInfo()"/>
<input type="button"value="四季名称"/>
<input type="button"value="清空页面内容"/>
    <p id ="replace"></p>
</div>

<script>
    function showInfo(){
        var str="";
        var list=document.getElementsByTagName("input")
        for(var i=0;i<list.length;i++){
            str+=list[i].value
        }
        alert(str)
    }
</script>


 

相关文章:

  • 2021-06-23
  • 2022-12-23
  • 2021-07-15
  • 2021-10-16
  • 2021-05-14
  • 2021-11-15
  • 2021-10-08
  • 2021-06-08
猜你喜欢
  • 2021-06-25
  • 2021-12-29
  • 2021-07-01
  • 2022-01-17
  • 2021-05-21
相关资源
相似解决方案