change background image in code

Discussion in 'ASP .Net' started by Guest, Sep 27, 2004.

  1. Guest

    Guest Guest

    I want to change the background image of the html page within code based on
    the users selection.
    I'm trying to use this in the page onload even

    response.write("<body background=' & dataitem>")

    but i can't get it to work. if i hard code the dataitem in it will change
    but i need it to work with the item being passed in.
    Guest, Sep 27, 2004
    1. Advertisements

  2. Add javascript variable backgroundString and function onLoad() to the <head>

    var backgroundString;
    function onLoad(){document.body.background=backgroundString}

    In the html view write <body onload='onLoad()'>

    In the code-behind write (c#)

    Eliyahu Goldin, Sep 28, 2004
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.