function shoppingcat(){
var s=5;
var minwidth=370;
var maxwidth=650;
var Key = document.getElementById("key").innerText;
if(Key=="展开"){
content.style.pixelWidth+=s;
if(content.style.pixelWidth<maxwidth){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="关闭";
}
}else{
content.style.pixelWidth-=s;
if(content.style.pixelWidth>minwidth){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="展开";
}
}
}
var s=5;
var minwidth=370;
var maxwidth=650;
var Key = document.getElementById("key").innerText;
if(Key=="展开"){
content.style.pixelWidth+=s;
if(content.style.pixelWidth<maxwidth){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="关闭";
}
}else{
content.style.pixelWidth-=s;
if(content.style.pixelWidth>minwidth){
setTimeout("shoppingcat();",1);
}else{
document.getElementById("key").innerText="展开";
}
}
}
改为style.width
你自己提出的问题。。这下应该能解决了
var Key = document.getElementById("key").innerText?document.getElementById("key").innerText:document.getElementById("key").textContent;
content.style.pixelWidth+=s; => content.style.width=content.offsetWidth+s +"px";if(content.style.pixelWidth<maxwidth){
=>
if(content.offsetWidth<maxwidth){
FireFox textContent