this js funciton:
function(strIDHead) {
var leftTD =开发者_如何转开发 document.getElementById(strIDHead + "_left");
if (leftTD != null) {
leftTD.background = "Images/Button/button_left.gif";
}
}
can only work in ie,i want it work in firefox,how to do it? ps:i tried
if (leftTD != null) leftTD.background = "url(/Images/Button/button_left.gif)";
cant work either...
Try this:
if (leftTD) leftTD.style.background = "url(Images/Button/button_left.gif)";
Or if you can use jQuery (whole function, not just the last line):
$('#' + strIDHead + '_list').css('background', 'url(Images/Button/button_left.gif)');
Update: Your function header is incorerct, too, unless you want an anonymous function and just forgot to copy the code where it's assigned somewhere. The correct function would looke like this:
function someFunction(strIDHead) {
var leftTD = document.getElementById(strIDHead + "_left");
if (leftTD) {
leftTD.style.background = "url(Images/Button/button_left.gif)";
}
}
精彩评论