Results 1 to 6 of 6

Thread: Display variables inside a table or DIV

  1. #1
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display variables inside a table or DIV

    I have code to determine the correct image for that specific week. The image name changes, ( increments by 1 each Wednesday ) so I determine the current week name by using Javascript.

    Code:
    var newnum = (weekno + 700);
    var dex = "/index.htm";
    var graphic = ".jpg";
    var fold = "/Images/";
    var text = "http://www.mysite.com/";
    var thisDay=today.getDay();
    
    document.write( text + newnum + fold + newnum + graphic);
    This would write http://www.mysite.com/725/Images/725.jpg

    How can I get the image URL , ( The section that I can display with document.write ) to load inside a table or DIV. I need to pass the result of this code , so that I can load it when the page open.

  2. #2
    Join Date
    Oct 2005
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    1- make a new .js file
    2- put your week image code :
    Code:
    document.write(" <img src='blablabla'> ");
    your case says:
    Code:
    var newnum = (weekno + 700);
    var dex = "/index.htm";
    var graphic = ".jpg";
    var fold = "/Images/";
    var text = "http://www.mysite.com/";
    var thisDay=today.getDay();
     document.write(" <img src='"+text + newnum + fold + newnum + graphic +"'> ");
    3- in whatever part of your page, instead of using
    Code:
    <img src="  ">
    use
    Code:
    <script src="xx.js"></script>
    which xx.js is your week image script.

    that's only suggestion, haven't tested it yet

  3. #3
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display variables inside a table or DIV

    Hi Thanks:

    Looks like it should work. I'll try it out.

  4. #4
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display variables inside a table or DIV

    Well, It seemed like a good idea at the time, I just couldn't get it to work. I actually want to display the image, and also will need to display it seperately in an iFrame.

    I'll revisit it later.

    Thanks

  5. #5
    Join Date
    Oct 2005
    Posts
    10
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    well,
    http://qu-sa.110mb.com/examples/Simora.htm

    check this out.
    it's a general example.
    i made it simple, depends on the time.
    (0 - 11) - (12 - 14) - (15 - 23)
    each time interval has a new emotion as example.

  6. #6
    Join Date
    Jun 2009
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Display variables inside a table or DIV

    Black Label:

    Great! That works. Seems like I was missing some ".

    Any idea why IE sometimes refuses to display an iFrame, but 5 minutes later it does? Dont have the same problem with Opera or Firefox.

    Thanks for your solution.

Bookmarks

Posting Permissions

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