change background image in code

Discussion in 'ASP .Net' started by =?Utf-8?B?TWlrZQ==?=, Sep 27, 2004.

  1. 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.
     
    =?Utf-8?B?TWlrZQ==?=, Sep 27, 2004
    #1
    1. Advertising

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

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

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

    In the code-behind write (c#)
    Response.Write(String.Format("<script>backgroundString={0}<script>",
    dataitem));

    Eliyahu

    "Mike" <> wrote in message
    news:...
    > 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.
    >
     
    Eliyahu Goldin, Sep 28, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Johansen

    How to change background image ??

    Thomas Johansen, Feb 23, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    9,396
  2. Bobofrut

    How to change Background Image

    Bobofrut, Feb 27, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    577
    Bobofrut
    Feb 27, 2004
  3. jc
    Replies:
    3
    Views:
    1,769
  4. jc
    Replies:
    1
    Views:
    1,396
    Neredbojias
    Mar 19, 2008
  5. Dj Frenzy
    Replies:
    3
    Views:
    332
    Robert
    Feb 10, 2004
Loading...

Share This Page