作者: jiake0504  链接:http://jiake0504.javaeye.com/blog/259674  发表时间: 2008年10月29日

声明:本文系JavaEye网站发布的原创博客文章,未经作者书面许可,严禁任何网站转载本文,否则必将追究法律责任!

<html> 
<head> 
<title>Test Clear Div's Input </title> 
<script type="text/javascript"> 

function $(id)
{
    return document.getElementById(id);
}

function clearDiv() 
{ 
    var nodes = $('div1').childNodes;

    for(var i = 0 ; i < nodes.length ; i++)
    {
        if(nodes[i].type == 'text')
        {
            nodes[i].value = '';
        }
    }
} 


</script> 
</head> 
<body> 
<div > 
<input type="button" value="btn1"> 
<input type="text" > 
<input type="button" value="btn2"> 
<input type="text" > 
<input type="text" > 
<input type="text" > 
<input type="text" > 
<input type="text" > 

</div> 
<br/> 
<input type="button" value="clear" onclick="clearDiv()"> 

<div >
    
</div>

</body> 
</html>



已有 0 人发表留言,猛击->>这里<<-参与讨论


JavaEye推荐



相关文章:

  • 2021-08-29
  • 2021-07-31
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
猜你喜欢
  • 2021-07-21
  • 2021-05-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案