说说思路吧! 一个ul>li*3 每个li上绑定一个data-content属性,把文字内容绑定到属性上
布局: 下面的divmargin-top为负数边框的宽度。三个li都没有下边框
选中哪个一li,该li添加一个active的类(上边框为图中样式,并且index在div之上),其他两个则去掉active样式
并把div的innerHTML 赋值为当前li的 this.getAttribute("data-content")
布局: 下面的divmargin-top为负数边框的宽度。三个li都没有下边框
选中哪个一li,该li添加一个active的类(上边框为图中样式,并且index在div之上),其他两个则去掉active样式
并把div的innerHTML 赋值为当前li的 this.getAttribute("data-content")
function replaceMessage(){
var oldnode=document.getElementById("oldnode");
var newnode=document.createElement("i");
newnode.innerHTML=oldnode.innerHTML;
oldnode.parentNode.replaceChild(newnode,oldnode);
}
var oldnode=document.getElementById("oldnode");
var newnode=document.createElement("i");
newnode.innerHTML=oldnode.innerHTML;
oldnode.parentNode.replaceChild(newnode,oldnode);
}
2015-07-17
var newnode=document.createElement("li");
newnode.innerHTML="php";
otest.insertBefore(newnode,otest.childNodes[1]);
newnode.innerHTML="php";
otest.insertBefore(newnode,otest.childNodes[1]);
2015-07-17
document.write(mylist.parentNode.parentNode.parentNode.lastChild.innerHTML)
2015-07-17
function checkone(){
var hobby = document.getElementsByName("hobby");
var j=document.getElementById("wb").value;
k=j.split("");
for(var i=0;i<j.length;i++){
hobby[parseInt(k[i])-1].checked=true;
}
}
var hobby = document.getElementsByName("hobby");
var j=document.getElementById("wb").value;
k=j.split("");
for(var i=0;i<j.length;i++){
hobby[parseInt(k[i])-1].checked=true;
}
}
var hobby = document.getElementsByTagName("input");
for(var i=0;i<hobby.length;i++)
{if(hobby[i].type=="checkbox")
hobby[i].checked=true;
for(var i=0;i<hobby.length;i++)
{if(hobby[i].type=="checkbox")
hobby[i].checked=true;
document.write(mystr.substr(mystr.indexOf("W"),"World".length) + "<br />");
document.write( mystr.substr(mystr.indexOf("H"),"Hello".length) );
document.write( mystr.substr(mystr.indexOf("H"),"Hello".length) );
2015-07-17
document.write(mystr.indexOf("o",mystr.indexOf("o")+1));
2015-07-17