下面是代码(真心求教)
function setu(s) {
// var thisObject = evt.srcElement || evt.target;
var thisObjectParent = s.parentNode;
var childArray = thisObjectParent.childNodes;
var text = s.innerHTML;
var newchild = document.createElement("strong");
thisObjectParent.replaceChild(newchild, s);
newchild.innerHTML = text;
return false;
}
function changenav(s) {
var thisObjectParent = s.parentNode;
var childArray = thisObjectParent.childNodes;
//alert(childArray[0].tagName + "," + childArray[1].tagName + "," + childArray[2] + "," + childArray[3] + "," + childArray[4]);
// alert(s.innerHTML);
var anewchild = document.createElement("A");
for (var i = 0; i < childArray.length; i++) {
if (childArray[i] != s && childArray[i].tagName == "A") {
// return !setu(s);
childArray[i].onclick = "";
// childArray[i].innerHTML = "haha";
}
if (childArray[i] == s) {
setu(s);
//alert(s.tagName)
}
// alert(childArray[i] != s);
}
return false;
}
html 类似百度首页输入框上面那些
兄弟你用JQuery做。
$("要来回切换的元素的ID").toggleClass("来回切换的样式!!");
这样一句简单的话就可以了……
用JQuery这样的轻量级类库一句简单的话就实现了……
看你的意思,应该使用css。使用修改样式岂不是更好!
关注。。。
jquery吧。简单,。如一楼所说。