PDA

View Full Version : Javascript & flash



alimirza
September 8th, 2003, 08:02 AM
I've found that script which changes the bgcolor of html background.

<script language="JavaScript">
<!--//The function is quite simple, it takes one argument, "newBgColor"
//and passes it as the value of the "bgColor" property of the "document"

objectfunction changeBgColor(newBgColor) {
if (window.document &&
window.document.bgColor) {
document.bgColor = newBgColor;
}}--></script>


on (press) {
getURL ("JavaScript:changeBgColor('#336600')");
}


is it possible to change background images instead of colors?
If yes could you please help me out here.

Thanks.
:run:

bikkies4u
September 8th, 2003, 08:13 AM
yes, i think it is poss, but i can't help... you could maybe try search for DOM background image or something.

sorry i can't be of more help

blah-de-blah
September 8th, 2003, 09:20 AM
I don't know much about Javascript...Maybe this would be better in the server-side scripting area so more javascript ppl would know :-\ But does document.img.src work???

lostinbeta
September 8th, 2003, 12:37 PM
<SCRIPT LANGUAGE="JavaScript">
<!--
function cbg(img){
document.body.background=img;
}
-->
</SCRIPT>


Usage in HTML
<A HREF="javascript:void(0)" onClick="javascript:cbg('1pxgrid.jpg')">Change Background</A>


Use in Actionscript getURL("javascript:cbg('1pxgrid.jpg')")

I think it is all pretty self explanitory so I can't think of anything to explain ;)



Edit: Oh yeah, and I moved this to the Server-Side/Scripting forum where it belongs.