<input type="hidden" id="headline">
xxx
<input type="hidden" id="footline">原生js或者jquery都可以
xxx
<input type="hidden" id="footline">原生js或者jquery都可以
解决方案 »
- 怎么通过JS获取到表单File框里的值?
- jQuery选择器的问题
- 这段JS在非IE浏览器下不执行,为什么?
- js 自作主张:整数与字符串连接问题
- 请教两个页面间的锚接问题
- [难题] 关于XML的节点多属性问题????
- 关于document.all.objList.ConnectDB("mlidbrollup", "rdrollup", "rdreport", "rd9905", false);的问题
- 关于框架的问题
- 请问可以直接在表格中进行输入和修改?我看到JCL好象是可以的,不知道为什么?
- javascript如何判断复选框是否全部被选中
- safari 禁止网页移动
- 关于事件绑定的一个问题
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function init(){
var a=document.getElementById("headline");
var b=document.getElementById("footline");
var an=a.nextSibling;
while(b!=an){
var p=an.parentNode;
p.removeChild(an);
an=a.nextSibling;
}
}
window.onload=init;
</script>
</head><body>
<input type="hidden" id="headline">
<div>11</div>sss
<a href="">xx</a>
<input type="hidden" id="footline">
</body>
</html>
类似这样试试
//firefox和chrome支持,ie6不支持
var start= document.getElementById("headline");
ff= start.nextSibling);
ff.nodeValue="abcd";
<head runat="server">
<title>123</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function test(){
var headline = document.getElementById("headline");
var txt = headline.nextSibling;
alert("原文本为:" + txt.nodeValue);
txt.nodeValue = " oh, my god! ";
alert("替换后的文本为:" + txt.nodeValue);
}
</script>
</head>
<body>
<div id="divContainer">
<input type="text" id="headline" value ="headline" />
xxx
<input type="text" id="footline" value ="footline" />
</div>
<input type="button" value="test" onclick="test()" />
</body>
</html>