希望能用DOM的nextSibling属性设置
元素的color样式,但是怎么整都没有效果,路过的大侠帮忙看一下,多谢!
Hold the front page
This first paragraph leads you in.
Now you get the nitty-gritty of the story.
Extra! Extra!
Further developments are unfolding.
You can read all about it here.
下面是对应的JavaScript代码...............................
function xx()
{ var e1=document.getElementsByTagName("h1");
for(var i=0;i
效果如下图:
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
1.
<meta charset=utf-8" />少写了一个双引号2.
if(node.nextSibling.nodeType=1)这里应该是双等号3.
怎么写的这么复杂,这个明明就可以用css3选择器;
楼主,你的if(node.nextSibling.nodeType=1),应该是==才对,而=是直接复制了,导致永远不会执行else语句