#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    1
    Rep Power
    0

    Question How to use URL link to pass variable info to DHTML page


    I have a web page that uses DHTML to populate a table.

    Basically, the links are on a menu on the side of the page, that when clicked, trigger a function within the page. The table updates itself based on the link that is clicked.

    This allows me to have multiple options available to the visitor. The visitor can click to display a particular option, and browse all options, without the wait time of downloading a new page for each link.

    That works fine.

    Now what I am implementing is a menu bar across the top of the web pages, that will have a hierarchical menu that links to each place on my web site.

    In that menu, is it possible to write the HREF links so that they fill in the information required to jump to the specific table view immediately, without the user having to click from the available options?

    So for instance, suppose on the page offerings.html, there are 4 options (A,B,C,D). Each one has different table content. The menu on the top of the web page has: Home | Services | Support | etc.

    Under the top menu for support, you could drill down to those 4 options... can those links be set to go to the offerings.html page, and to the specific table view?

    The page in question uses a function indicated below:

    Code:
    function htmlChange(id,message)
    {
      if(isNS4)return;
      var re=null;
      if(isDOM)re=document.getElementById(id);
      else if(isIE)re=eval("document.all."+id);
      if(re)
      {
        re.innerHTML=message; 
         
      }
    }
    The current links use a onClick in the href as follows:
    Code:
    onClick="htmlChange('cellID',variable)"
    where cellID is the defined id for the table cell that gets updated, and variable is the variable name for the text that gets inserted. I have several different variables defined in the <HEAD> of my page.

    So far, I have tried a syntax such as the following with out any luck:
    Code:
    http://www.domain.com/page.html?htmlChange(cellID,variable)
    and
    http://www.domain.com/page.html?cellID=X&variable=Y
    Can anyone offer some suggestions?

    Thanks!
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Maybe....

    <a href="http://www.domain.com/page.html?" onclick="this.href+='cellID='+cellID+'&variable='+variable">

    cellID and variable would need to be defined, globally, in each page that used them. You'd need to parse them out at the other end. Not enough sample code to really see how you're doing this. A suggestion:

    function htmlChange(id,message)
    {
    if(isNS4)return;
    var re=null;
    if(isDOM)re=document.getElementById(id);
    else if(isIE)re=document.all[id];
    if(re)
    {
    re.innerHTML=message;

    }
    }

    Don't use eval() unless you're paid to. Forgot the insulting alert() mesage for Navigator holdouts...

IMN logo majestic logo threadwatch logo seochat tools logo