Writing Unique Content To Same Page

Discussion in 'JavaScript' started by notepad, Apr 23, 2006.

  1. #1
    I'm creating an A-Z glossary that will be displayed inside an HTML ebook. In order not to have an enormously long page, I'm looking for a javascript code that will:

    * first display the letter A's information onload
    * display each subsequent letter's information when letter (A-Z) is clicked
    * call the information from either an external javascript, or HTML file(s)
    * work on Windows systems exclusively

    From the page's horizontal list of (clickable) letters...

    A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

    ...I'd want the glossary's information "dynamically" displayed below the letters perhaps in a specified <DIV> area.

    Again, the glossary will NOT be used online. The code must work on a PC. Hopefully I can do this without frames, DHTML, DOM etc.

    Any advice would be most appreciated. I would also be interested in hiring someone to complete this task.

    Thanks.


    P. S. - Here's an online example, though it doesn't load the glossary's "A" terms on first visit to the page (like I prefer & need), and of course CFM wouldn't work in an ebook on a home computer.

    seoforgoogle.com/glossary.cfm


    # # #
     
    notepad, Apr 23, 2006 IP
  2. notepad

    notepad Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In case anyone's interested, I figured this out -- works great.

    step 1:

    <BODY onLoad="javascript:showContent('<b>Subject</b><br>definition and text here must ALL be on same line. You can use <P>, commas, <b> bold, <br> etc. and apostrophes can be escaped using it\'s.');">

    step 2:

    <script language="javascript" type="text/javascript">
    var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1;
    var ns6=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;
    var ns4=document.layers;

    function showContent(content)
    {
    if(ie4)
    {
    showContentObj=document.all.qiksearch_div;
    }
    if(ns6)
    {
    showContentObj=document.getElementById("qiksearch_div");
    }
    if(ie4||ns6)
    {
    if(showContentObj.innerHTML!=content)
    {
    showContentObj.innerHTML=content;
    }
    else
    {
    showContentObj.innerHTML="";
    }
    }
    if(ns4)
    {
    document.nsdiv.document.write(content);
    document.nsdiv.document.close();
    }
    }

    </script>

    step 3:

    <a href="javascript:void(0);" onClick="javascript:showContent('<b>Subject</b><br>definition and text here must ALL be on same line. You can use <P>, commas, <b> bold, <br> etc. and apostrophes can be escaped using it\'s.);"><font class="gloss"><b>A</b></font></a>

    <a href="javascript:void(0);" onClick="javascript:showContent('<b>Subject</b><br>definition and text here must ALL be on same line. You can use <P>, commas, <b> bold, <br> etc. and apostrophes can be escaped using it\'s.);"><font class="gloss"><b>B</b></font></a>

    ...etc for each letter

    step 4:

    <layer id="nsdiv" left="310"></layer>
    <div id="qiksearch_div"></div>


    ...thanks just the same.


    # # #
     
    notepad, Apr 24, 2006 IP