-
style.backgroundImage not working in IE
still very new to Java but I'm trying to get the background image to change when clicknig a link and this code work in all browsers but IE. I have tried the suggestions that worked for you regards ;'s, any help would be awesome.
var backImage = new Array();
backImage[0] = "url(images/bg1.jpg)";
backImage[1] = "url(images/bg2.jpg)";
backImage[2] = "";
function changeBGImage(whichImage){
document.body.style.backgroundImage = backImage[whichImage];
}
//-->
</script>
<a href="javascript:changeBGImage(1)">Change</a>
Cheers,
Stalkio
-
-
Got this working, please find the correct code below. Also please note that IE seems to not like large files for backgrounds? very annoying when other browsers don't have issues. Hope this helps.
<script type="text/javascript">
function changeStyleOak()
{
document.body.style.backgroundImage="url(images/backgrounds/natural.jpg)";
}
</script>
.
.
.
.
<input type="button" onclick="changeStyleOak()" style="background-image:url(images/backgrounds/natural_oak.jpg);" />
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks