Results 1 to 5 of 5

Thread: [DHTML]A Simple Link Description Script

  1. #1
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default [DHTML]A Simple Link Description Script

    1) CODE TITLE: A Simple Link Description Script

    2) AUTHOR NAME/NOTES: Master_script_maker

    3) DESCRIPTION:
    Allows people to see a description of where the link takes you to.

    4) URL TO CODE: http://linkdescription.freehostia.com

    or, ATTACHED BELOW (see #3 in guidelines below):
    Last edited by Master_script_maker; 06-10-2007 at 04:33 PM.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    The site you linked to is just the server directory listing for your "root directory" and there are no files in it. Please either post the code, or make the link a valid one.
    Last edited by thetestingsite; 06-10-2007 at 02:53 PM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by thetestingsite View Post
    The site you linked to is just the server directory listing for your "root directory" and there are no files in it. Please either post the code, or make the link a valid one.
    Thank you. Something was messed up but i fixed it now.

  4. #4
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Looking at the code, it seems simple enough to integrate into your own applications. Not sure if DD will post it on the site, but it seems that even a simple beginner to Javascript would be able to use and customize it.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Code:
    <script>
    The type attribute is required.
    Code:
    <!--
    This is no longer necessary, and will break your script in XHTML pages.
    Code:
    document.getElementById(number).innerHTML = " " + text;
    innerHTML is non-standard and has several practical issues.
    Code:
    <a href="yoursite" onmouseover="display('the text to display','1')" onmouseout="undo('1')">yoursite</a><font color="black" id='1'> </font>
    The <font> tag is not valid HTML Strict. IDs may not start with a number.

    Wouldn't it make more sense to use the same element for all links? You're never going to have more than one description up at a time, after all. You could make it less obtrusive, too:
    Code:
    <script type="text/javascript">
      onload = function() {
        var m, i, a, as,
          mo = function() {
            document.getElementById("descr").firstChild.nodeValue = "";
          };
    
        if(!(m = document.getElementById("descr"))
          (m = document.body.appendChild(
            document.createElement("p")
          )).id = "descr";
    
        if(!m.firstChild)
          m.appendChild(document.createTextNode(""));
    
        for(i = 0, as = document.links, a = as[0]; i < a.length; a = as[++i])
          if(m = a.className.match(/describe\(([^\)]+)\)/) {
            a.onmouseover = (function(d) {
              return function() {
                document.getElementById("descr").firstChild.nodeValue = d;
              };
            })(m[1]);
            a.onmouseout = mo;
          }
      };
    </script>
    Then:
    Code:
    <span id="descr"></span>
    And:
    Code:
    <a href="somepage.html" class="describe(Some page or other.)">Some Page</a>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •