78 users online (1 members and 77 guests)  




  Results 1 to 4 of 4
Digg button stumble

Related

  1. Replies: 17
  2. Changing Text with a button    Forum: Javascript Forum
    Replies: 1
  3. Changing Text With a Button    Forum: HTML Forum
    Replies: 1
  4. Changing text size with a button    Forum: Javascript Forum
    Replies: 2
  5. Replies: 5
  1. #1
    arvindikchari's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2008
    Posts
    23

    Post changing a section's background image using value supplied by user in text box

    Hello,

    I have a script at http://gb.designshack.info/ where user should specify url to an image, and that image is immediately dynamically set as the background image for a section. But for some reason, that is not working.
    The CSS Used is:

    <li id="colLeft">
    <div class="boxTitleLeft">box title left </div>
    <div id="dynamicContent">{SESSION}<br>
    {CATEGORIES}<br>

    {RANDOM_PROD}<br>
    {INFORMATION}<br></div>
    </li>

    The section whose background image is to be changed is 'boxTitleLeft'. The code used to make that change is:




    <input type="text" class="text" id="s_tlbgiu" name="s_tlbgiu" value="Enter Image URL" size="35" maxlength="255" onFocus="if(this.value == 'Enter Image URL') this.value='';" style="width:280px;" />


    <input type="button" class="button" id="bgiApply" name="bgiApply" value="apply" onClick="document.getElementById('boxTitleLeft').style.backgroundImage = "url(" + getObject('s_tlbgiu').value + ")"; />


    For some reason this is not working, can someone correct this or suggest an alternative?
    The script is at http://gb.designshack.info/

    Regards
    Arvind
    Last edited by HTML; 03-09-2012 at 09:41 PM.



  • #2
    jthayne's Avatar

    Status
    Offline
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    508

    Re: changing a section's background image using value supplied by user in text box

    It appears to be working now. Did you get it fixed?

  • #3
    arvindikchari's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2008
    Posts
    23

    Post Re: changing a section's background image using value supplied by user in text box

    Hello,

    Yes I just got it fixed, I dont have the code with me yet but when I get it i will post the solution on this forum,

    Thanks and Regards
    Arvind

  • #4
    arvindikchari's Avatar
    New User

    Status
    Offline
    Join Date
    Dec 2008
    Posts
    23

    Post Re: changing a section's background image using value supplied by user in text box

    Hello,

    This code works for changing the background image of boxtitleleft:

    window.parent.document.getElementById("boxTitleLeft").style.backgroundImage = "url(" + value + ")"; break;

    Regards
    Arvind



  • Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •