Your Ad Here Your Ad Here
Results 1 to 10 of 10

Thread: Link Description Code Help

  1. #1
    SeK612's Avatar Poster BT Rep: +10BT Rep +10
    Join Date
    Nov 2002
    Location
    UK
    Posts
    739
    I'm using a link description code from here to pop up a brief description of the links when a visitor hovers over them (code below). It works fine but I have new links that I wont to add descriptions for. I try and add a new line under the
    Code:
    // *######### *popup text
    bit but I then get a message saying "an error has occurred" and asking whether I want to continue running scripts. This message also displays when the links are hovered over. Is it possible to add more descriptions for the new links and how do I modify the code to do this?

    Thanks,

    SeK612

    Code:
    <!-- TWO STEPS TO INSTALL POP-UP LINK WITH DESCRIPTION:
    
     *1. *Copy the coding into the HEAD of your HTML document
     *2. *Add the last code into the BODY of your HTML document *-->
    
    <!-- STEP ONE: Paste this code into the HEAD of your HTML document *-->
    
    <HEAD>
    
    <script LANGUAGE="JavaScript">
    
    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    <!-- Original: *Patrick Lewis (gtrwiz@aol.com) -->
    <!-- Web Site: *http://www.patricklewis.net -->
    <!-- Begin
    // * ############## *SIMPLE *BROWSER SNIFFER
    if (document.layers) {navigator.family = "nn4"}
    if (document.all) {navigator.family = "ie4"}
    if (window.navigator.userAgent.toLowerCase().match("gecko")) {navigator.family = "gecko"}
    
    //######### *popup text 
    descarray = new Array(
    "This site has some of the greatest scripts around!",
    "These popups can have varying width. It is dependant upon the text message.",
    "You can have <b>two</b> lines <br>and HTML content.",
    "You can also have images in here like this:<br><img src=greenbar.gif>",
    "You can put in a really long <br>description if it is nessary to <br>explain something in detail, <br>like a warning about content <br>or privacy.",
    "</center>Lastly, you can have links like these:<br><a href='http://javascript.internet.com/'>JavaScript Source</a><br><a href='http://javascript.internet.com/'>JavaScript Source</a><br><a href='http://javascript.internet.com/'>JavaScript Source</a><br>With a change in the onmouseout event handler."
    );
    
    overdiv="0";
    // *######### *CREATES POP UP BOXES 
    function popLayer(a){
    if(!descarray[a]){descarray[a]="<font color=red>This popup (#"+a+") isn't setup correctly - needs description</font>";}
    if (navigator.family == "gecko") {pad="0"; bord="1 bordercolor=black";}
    else {pad="1"; bord="0";}
    desc = * *"<table cellspacing=0 cellpadding="+pad+" border="+bord+" *bgcolor=000000><tr><td>\n"
    	+"<table cellspacing=0 cellpadding=3 border=0 width=100%><tr><td bgcolor=ffffdd><center><font size=-1>\n"
    	+descarray[a]
    	+"\n</td></tr></table>\n"
    	+"</td></tr></table>";
    if(navigator.family =="nn4") {
    	document.object1.document.write(desc);
    	document.object1.document.close();
    	document.object1.left=x+15;
    	document.object1.top=y-5;
    	}
    else if(navigator.family =="ie4"){
    	object1.innerHTML=desc;
    	object1.style.pixelLeft=x+15;
    	object1.style.pixelTop=y-5;
    	}
    else if(navigator.family =="gecko"){
    	document.getElementById("object1").innerHTML=desc;
    	document.getElementById("object1").style.left=x+15;
    	document.getElementById("object1").style.top=y-5;
    	}
    }
    function hideLayer(){
    if (overdiv == "0") {
    	if(navigator.family =="nn4") {eval(document.object1.top="-500");}
    	else if(navigator.family =="ie4"){object1.innerHTML="";}
    	else if(navigator.family =="gecko") {document.getElementById("object1").style.top="-500";}
    	}
    }
    
    // *######## *TRACKS MOUSE POSITION FOR POPUP PLACEMENT
    var isNav = (navigator.appName.indexOf("Netscape") !=-1);
    function handlerMM(e){
    x = (isNav) ? e.pageX : event.clientX + document.body.scrollLeft;
    y = (isNav) ? e.pageY : event.clientY + document.body.scrollTop;
    }
    if (isNav){document.captureEvents(Event.MOUSEMOVE);}
    document.onmousemove = handlerMM;
    // *End -->
    </script>
    
    </HEAD>
    
    <!-- STEP TWO: Copy this code into the BODY of your HTML document *-->
    
    <BODY>
    
    <div id="object1" style="position:absolute; background-color:FFFFDD;color:black;border-color:black;border-width:20; visibility:show; left:25px; top:-100px; z-index:+1" onmouseover="overdiv=1;" *onmouseout="overdiv=0; setTimeout('hideLayer()',1000)">
    pop up description layer
    </div>
    
    <!-- *THE TEXT FOR THE POPUP DESCRIPTIONS ARE ON LINE 12 *-->
    
    <a href="http://javascript.internet.com" onMouseOver="popLayer(0)" onMouseOut="hideLayer()"><font size=-1 face=arial><b>
    THE JavaScript Source
    	</b></font></a><br>
    
    <a href="#" onMouseOver="popLayer(1)" onMouseOut="hideLayer()"><font size=-1 face=arial><b>
    Variable width
    	</b></font></a><br>
    
    <a href="#" onMouseOver="popLayer(2)" onMouseOut="hideLayer()"><font size=-1 face=arial><b>
    Double line popup
    	</b></font></a><br>
    
    <a href="#" onMouseOver="popLayer(3)" onMouseOut="hideLayer()"><font size=-1 face=arial><b>
    Image sample
    	</b></font></a><br>
    
    <a href="#" onMouseOver="popLayer(4)" onMouseOut="hideLayer()"><font size=-1 face=arial><b>
    Really long description
    	</b></font></a><br>
    
    <a href="#" onMouseOver="popLayer(5)" onMouseOut="setTimeout('hideLayer()',2000)"><font size=-1 face=arial><b>
    Persistant with links
    	</b></font></a><br>
    
    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>
    
    <!-- Script Size: *5.08 KB -->

  2. Internet, Programming and Graphics   -   #2
    Isnt that just screen tip?

    If you have link and have this:

    Code:
    <a title="I AM A SCREEN TIP" href="http://www.mydomain.com">Link Name</a>
    So when your mouse goes on the link a small text box sort of emerges to display what you have in title. Isnt that just this?
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  3. Internet, Programming and Graphics   -   #3
    h1
    Guest
    Change this...
    Code:
    descarray = new Array&#40;
    &#34;This site has some of the greatest scripts around&#33;&#34;,
    &#34;These popups can have varying width. It is dependant upon the text message.&#34;,
    &#34;You can have &#60;b&#62;two&#60;/b&#62; lines &#60;br&#62;and HTML content.&#34;,
    &#34;You can also have images in here like this&#58;&#60;br&#62;&#60;img src=greenbar.gif&#62;&#34;,
    &#34;You can put in a really long &#60;br&#62;description if it is nessary to &#60;br&#62;explain something in detail, &#60;br&#62;like a warning about content &#60;br&#62;or privacy.&#34;,
    &#34;&#60;/center&#62;Lastly, you can have links like these&#58;&#60;br&#62;&#60;a href=&#39;http&#58;//javascript.internet.com/&#39;&#62;JavaScript Source&#60;/a&#62;&#60;br&#62;&#60;a href=&#39;http&#58;//javascript.internet.com/&#39;&#62;JavaScript Source&#60;/a&#62;&#60;br&#62;&#60;a href=&#39;http&#58;//javascript.internet.com/&#39;&#62;JavaScript Source&#60;/a&#62;&#60;br&#62;With a change in the onmouseout event handler.&#34;
    &#41;;
    ...to this...

    Code:
    descarray=new Array&#40;&#34;The first tooltip&#34;,&#34;The second one&#34;,&#34;The third one&#34;,&#34;And so on&#34;&#41;;
    function on&#40;a&#41;{popLayer&#40;a&#41;;}
    function off&#40;&#41;{hideLayer&#40;&#41;;}
    Change the tooltip texts like I did. To call a tooltip, do this to a link...

    Code:
    &#60;a href=&#34;link.here&#34; onMouseOver=&#34;on&#40;NUMBER&#41;;&#34; onMouseOut=&#34;off&#40;&#41;;&#34;&#62;link text&#60;/a&#62;
    Change number to the corresponding number in the array minus 1. So if you wanted to call "And so on," it would be...

    Code:
    &#60;a href=&#34;link.here&#34; onMouseOver=&#34;on&#40;3&#41;;&#34; onMouseOut=&#34;off&#40;&#41;;&#34;&#62;link text&#60;/a&#62;
    ...because it is the fourth array element.

    Hope this helps.

    Edit: You can also use HTML here... that&#39;s also directed at you, I.am.

  4. Internet, Programming and Graphics   -   #4
    I did use html, What exactly he wanted? On the page it looked more like ToolTip /Screen Tip which is just obvious. And thats what I gave an example of. Obviously I didnt read his script when the solution looked so obvious
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  5. Internet, Programming and Graphics   -   #5
    h1
    Guest
    I was saying he can use HTML in the tooltips.

  6. Internet, Programming and Graphics   -   #6
    Originally posted by haxor41789@15 February 2004 - 13:40
    I was saying he can use HTML in the tooltips.
    Damn&#33; I thought you said, "it was also directed to you, I.am" meaning saying to me


    Damn&#33; you haxor&#33;

    Btw did you saw the keyboard i posted in the lounge yesterday? Even reserved a key for you
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  7. Internet, Programming and Graphics   -   #7
    h1
    Guest

    I feel special.

  8. Internet, Programming and Graphics   -   #8
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

  9. Internet, Programming and Graphics   -   #9
    h1
    Guest
    h4x0rZ can&#39;t even spell "wft" right.

    Oh yeah... got some more haxor art...

    Code:
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _____
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|| &nbsp; || 
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|&#092;___/|
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp; &nbsp; |
     &nbsp; &nbsp; &nbsp; _____| &nbsp; &nbsp; |_____
     &nbsp; &nbsp; &nbsp;/ &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp; &nbsp; &#092;
     &nbsp;____| &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp; &nbsp; |_
    / &nbsp; &nbsp;| &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp; &nbsp; | &#092;
    | &nbsp; &nbsp;| &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp;|
    | &nbsp; &nbsp;| &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp; &nbsp; | &nbsp;|
    | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp;|
    | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;| &nbsp;|
    | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; / 
    | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/
     &nbsp;&#092; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/
     &nbsp; &#092; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ 
     &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |
     &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |

  10. Internet, Programming and Graphics   -   #10
    Code:
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;______
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .-&#34; &nbsp; &nbsp; &nbsp;&#34;-.
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#092;
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |, &nbsp;.-. &nbsp;.-. &nbsp;,|
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; | &#41;&#40;__/ &nbsp;&#092;__&#41;&#40; |
     &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |/ &nbsp; &nbsp; /&#092; &nbsp; &nbsp; &#092;|
     &nbsp; &nbsp; &nbsp; &#40;@_ &nbsp; &nbsp; &nbsp; &#40;_ &nbsp; &nbsp; ^^ &nbsp; &nbsp; _&#41;
     &nbsp;_ &nbsp; &nbsp; &#41; &#092;_______&#092;__|IIIIII|__/__________________________
     &#40;_&#41;@8@8{}&#60;________|-&#092;IIIIII/-|___________________________&#62;
     &nbsp; &nbsp; &nbsp; &nbsp;&#41;_/ &nbsp; &nbsp; &nbsp; &nbsp;&#092; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/
     &nbsp; &nbsp; &nbsp; &#40;@ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; `--------` aha
    <span style='color:black'> I am a part of all that I have met - Lord Tennyson</span>
    <span style='color:blue'>Try not to let your mind wander...it is too small and fragile to be out by itself</span>

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
  •