Skip to main content

Javascript Q 44 Responses

Last post: 2 years ago | Thread started: Feb 8, 10, 7:37 p.m.

RespondNew TopicDisable Images

  • BusterBoy

    I've got a function that is called from within Flash that can change the bgcolor of a page.

    <script language="JavaScript">
    <!-- function changeBgColor(newBgColor) { if (window.document &amp;&amp; window.document.bgColor) { document.bgColor = newBgColor; } } -->
    </script>

    WOuld anyone know how to modify this so it will change the bgcolor of a DIV instead of the whole page?

    Feb 8, 10, 7:37 p.m. – Permalink
  • acescence

    document.getElementById("mydiv... = newBgColor;

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 8, 10, 7:47 p.m. – Permalink
  • acescence

    dammit

    document .getElementById ( "mydiv" ) .style .backgroundColor = newBgColor;

    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 8, 10, 7:47 p.m. – Permalink
  • BusterBoy

    Thanks mate, worked a treat.

    One quick one...could this be modified to change the background image of a page, not just the colour?

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 8, 10, 7:59 p.m. – Permalink
  • acescence

    document .body .style .backgroundImage = "url(image.jpg)";

    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 8, 10, 8:20 p.m. – Permalink

Login or Register to respond to this

Skip to main content