im trying to get a javascript random image genorator that i made to work with css backgrounds... is this at all possible or is this just a futile attempt? thanks
It should work fine if you're using inline styles, but the JS won't be executed if you're trying to use it in an external style sheet.
it seems to work with an external like, if i have it document.write("klajdf"); it outputs that, but it never seems to get the image name from the javascript
w00t i got it working... i decided to just have the javascript write the line for the div... like so Code: function randbackground() { return document.write("<div id=container style='background-image: url( " + bgimage[randimg] + ")'>"); } works like a charm... not sure how "correct" it is but untill some one else shows me the "correct" way to do it, im gunna use this
Pretty good: OK this is from memory: Have you tried it for cross-browser support? The function will probably be supported by most newer browsers , but writing to the document on the fly can be tricky in Nutscrape versions prior to v6, These used/required <LAYER> tags - which IE didn't support requiring not only browser detection but its version as well (I'm not even thinking about MACs here ) Stu