53 users online (0 members and 53 guests)  


  Results 1 to 8 of 8

Related

  1. Replies: 1
  2. html page break    Forum: HTML Forum
    Replies: 3
  3. Passing variables from HTML page to page    Forum: HTML Forum
    Replies: 1
  4. Javascript document.write problems    Forum: Javascript Forum
    Replies: 3
  5. Replies: 1
  1. #1
    rebbekka's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    3

    multi-level JavaScript document.write / html page within a html page

    I'm working on the redesign of a corporate intranet site for a government agency, so links won't be possible. The corporate server supports Java and JavaBeans only. That means, no ASP; no PHP; no includes.. just JavaScript. The political redtape dictates that they will not allow support for these within the next year or two. There isn't really a founded reason for it, but that's the way it is. I don't know JavaBeans or have the time luxury to learn it.

    The issue I am having is with a Quick Links type of navigation that is displayed on each page in a boxed area. The navigation has pop-out sub-menus. The contents will change frequently. To avoid hand-coding each page (about a thousand), I'm calling an external JavaScript(JS) to the page. The contents of the JS file uses document.write to generate the necessary HTML coding, etc for the Quick Links navigation. The JS file is within a directory with all the other JS files.

    I've encountered problems because the back-end structure of the site consists of multiple hierarchies/levels, but just three of them. (Ridiculous example to clarify: icing level, donut level and jelly level) When the JS is written onto the page, the relative paths assigned for the navigation links are either one or two levels too low, and generate 404s or broken images.

    Is there a method (no frames, iFrames or iLayers please) to circumvent this problem without creating a tweaked JS file for each directory level?

    Or, even better, is there a method to dynamically change the contents of a div on a page with the contents of a static HTML page without using frames - similar to innerHTML and a variable, but displaying an entire HTML file like a frame would?

  2. #2
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel
    Any of you experts have an idea?

    Dave

  3. #3
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    You best bet would be to use absolute paths in all the dynamically generated content. Then the links would work wherever.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  4. #4
    rebbekka's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    3

    Unhappy

    Thanks Dean.

    That was an option I was hoping could be avoided. The development, testing and live environments are on different hosts. I was hoping my mind just wasn't experienced enough to recognize an obvious answer... other than trying to drag them to be at par with the free hosting sites available around the internet. It's still better than hand-coding a thousand pages.

  5. #5
    Android's Avatar

    Status
    Offline
    Join Date
    Oct 2002
    Location
    I AM CANADIAN
    Posts
    440

    Question

    Is it Lotus Quick Place system?

  6. #6
    rebbekka's Avatar
    New User

    Status
    Offline
    Join Date
    Oct 2003
    Posts
    3
    No, not Lotus Quick Place.

  7. #7
    jasonjones's Avatar
    New User

    Status
    Offline
    Join Date
    Jun 2004
    Posts
    3
    Hello,

    I noticed your question about document.write and multilevel folders and links.

    What I have done with a website is create a varible called "up" that is a text string.

    For files in my subfolders, I have a locational variable that will be "true" and activate the "up" variable. For files not in subfolders, the locational variable will be false.

    Then I put an if-statement in each folder. The if statement, using the locational variable, will assign "up" the string value "../" if my file is in a subfolder, or will be blank if the file is on the same level as the link target.

    Similarly, I made a "down" variable that will be assigend a value such as "archive/" if the link target is in a subfolder called "archive" or will be blank if the file and link target are in the subfolder.

    In my javascript, I place the "up" or "down" variables in front of my generic target like so:

    document.write('<a href="'+up+'filename.html">Link</a>')

    So, depending on your location, the variable will be blank or redirect links up or down your heirarchy.

    I didn't put the appropriate arrows (<) on the link, because I didn't want it to actually turn into html in this message.

    Hope this helps.

  8. #8
    SSJ4 Bart's Avatar
    New User

    Status
    Offline
    Join Date
    Sep 2004
    Location
    The Netherlands
    Posts
    3
    You could also use '<base href="the/top/directory">' on your page. That way you'd only have to change this value when you move your pages from the test server to the live one.