iPixel Posted March 28, 2008 Share Posted March 28, 2008 basically i have a cell with a picture as its background, so i wrong this little javascript to flip it if the checkbox inside the cell is checked on. But for some reason it only works in Firefox not Internet Explorer. The function call looks like so >> <TD COLSPAN="2" VALIGN="middle" ALIGN="center" ID="meetandgreet" style=" background-image:url(SELECTED/meet.jpg); background-repeat: no-repeat;" NOWRAP><INPUT TYPE="checkbox" ID="meet" VALUE="Include Meet & Greet" onchange="flipimg('meetandgreet', 'meet', 'meetselected.jpg', 'meet.jpg')"></TD> And here's my Javascript >> //This script is used to flip over the backgrounds for the Meet & Greet function flipimg(idcell, idfield, imgNameOn, imgNameOff) // idcell = ID of <TD> Cell, idfield = ID of the checkbox/radio button, imgNameOn imgNameOff = image names, extension included. { if(document.getElementById(idfield).checked) { document.getElementById(idcell).style.background = "url(SELECTED/" + imgNameOn + ") no-repeat"; } else { document.getElementById(idcell).style.background = "url(SELECTED/" + imgNameOff + ") no-repeat"; } } This works like a charm in Firefox but in IE its completely dead. Any ideas why ?! I've tried looking it up with google but some sites say it getElementById worx on IE and some say it doesnt and you should use document.all instead ?! and sometimes its vice a versa. Thanks in advance for the help. Quote Link to comment Share on other sites More sharing options...
nogray Posted March 28, 2008 Share Posted March 28, 2008 change the onchange to oncilck Quote Link to comment Share on other sites More sharing options...
iPixel Posted March 29, 2008 Author Share Posted March 29, 2008 Joooooooooooooo DA FREAKIN MAN LOL! God i cant believe i didnt even consider that one lol! ah well. Thanks a ton dude! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.