Server side includes and javascript

Discussion in 'JavaScript' started by Jen-, Nov 14, 2006.

  1. #1
    Hello, can you put an id into a server side include like you can other items using javascript?

    I tried this putting the id name in the virtual address area but it doesn't work. I also tried replacing virtual with id instead still with no luck.

    document.getElementById('dynstuff').src=content[newm]

    <!--#include virtual="dynstuff"--><!--#include virtual id="dynstuff"-->



    The error message says getElementById is null or not an object but it works fine with image ids and iframe ids. Can anyone tell me why this doesn't work?
    Thank you very much.
     
    Jen-, Nov 14, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    This is not possible. You cannot modify the file or file source once it's included. Javascript runs on the browser (Client side), and the Server Side Iincludes (as the name says) run on the server, so there is no way they can comunicate. If you want to change content dynamically you might want to have a look at AJAX.
     
    nico_swd, Nov 15, 2006 IP