Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: help with link

  1. #1
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    help with link

    i've set up the typing text dhtml on my webpage...and the words that get typed up are: "home," "about," "profolio," and "tribe" now i want to creat a seperate link for each of these words that get typed up but i can't figure out how.
    basically this is the code i have:
    <A HREF="mainpage.htm" STYLE="text-decoration: none">
    <small><span id="typing" style="visibility:hidden" align="right">
    <p> home<a/><br>
    <A HREF="about.htm" STYLE="text-decoration: none">about</a> <br>
    <A HREF="profolio.htm" STYLE="text-decoration: none">profolio</a><br>
    <A HREF="tribe.htm" STYLE="text-decoration: none">tribe

    but all of them are linking up to the mainpage...

    so if anyone has suggestions...or solutions let me know

  • #2
    New Coder
    Join Date
    Jul 2003
    Posts
    73
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You've made a typo.

    <p> home<a/><br>

    should be:

    <p> home</a><br>


  • #3
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok typo noted...but that doesn't seem to be the problem (i just changed the typo but all of the words are still inking up to the main page...
    so here is my code in full...
    <script language="JavaScript1.2">
    <html>
    <head>
    <style>
    <!--
    a{text-decoration:none}
    //-->
    </style>
    <body bgcolor="D3D3D3">
    <!-- %%NOBANNER%% -->

    <IMG HEIGHT="200" WIDTH="200" SRC="images/00000.jpg">
    <font face="larabiefont" color="FFFFFF" size="5" align="right">
    /*
    Typing Text Script-
    Last updated: 99/06/17
    © Dynamic Drive (www.dynamicdrive.com)
    For full source code, installation instructions,
    100's more DHTML scripts, and Terms Of
    Use, visit dynamicdrive.com
    */

    var it=0
    function initialize(){
    mytext=typing.innerText
    var myheight=typing.offsetHeight
    typing.innerText=''
    document.all.typing.style.height=myheight
    document.all.typing.style.visibility="visible"
    typeit()
    }
    function typeit(){
    typing.insertAdjacentText("beforeEnd",mytext.charAt(it))
    if (it<mytext.length-1){
    it++
    setTimeout("typeit()",100)
    }
    else
    return
    }
    if (document.all)
    document.body.onload=initialize
    </script>

    <A HREF="mainpage.htm" >
    <small><span id="typing" style="visibility:hidden" align="left">
    home</a><br>
    <A HREF="about.htm" >about</a> <br>
    <A HREF="profolio.htm" >profolio</a><br>
    <A HREF="tribe.htm" >tribe</a>
    <br></span></small>
    </br></br></br></br></br></br></img></font></body></head></html>

    anyhow i've been tinkering with it all day and i still can't figured out how to have all my hyperlinks active to the right page instead of just the one page...

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts

    Exclamation

    hey... you have a mixture of tags wrong placed

    here is the correct order:

    <html>
    <head>

    <style>
    ...
    </style>

    <script language="JavaScript1.2">
    ...script here...
    </script>

    </head>
    <body>
    ... body contente here
    </body>
    </html>

    Watch out next time...:-)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Horrible code, no surprise it doesn't work

    Closing tags are NOT optional no matter how well ignorant browsers accept their lack. When you fail to properly close tags you get strange and hard to debug results. Missing tags added below:

    Code:
    <A HREF="mainpage.htm" STYLE="text-decoration: none">
    <small><span id="typing" style="visibility:hidden" align="right">
    <p> home</p></span></small><a/><br>
    <A HREF="about.htm" STYLE="text-decoration: none">about</a> <br>
    <A HREF="profolio.htm" STYLE="text-decoration: none">profolio</a><br>
    <A HREF="tribe.htm" STYLE="text-decoration: none">tribe</a>
    Also remember to close tags in the same order they're opened, like this "<p><a>A Link</a></p>", not like this "<p><a>A Link</p></a>".
    Check out the Forum Search. It's the short path to getting great results from this forum.

  • #6
    New to the CF scene
    Join Date
    Jul 2003
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy can't ge it yet

    thanks for all you help...

    to roy...i realized that the first codes i posted would not do much help for me because i only selected a clip from my code...the code does work but it is not doing what i wold like it to do...but anyhow thanks for you suggestions...and i did revise some of my codes...

    and how i fixed up the code...and put it in better order...but all the links are only linking up to the one page (index.htm). so i figued out that its because the <a ref=""> is before the <span> tag...but if i put the <a ref> tage after the <span> tag the link just doen'st work. so i tried to close the </span> tage off and the repeat the <span> but if i do this the script doesnt work...i hope i'm making sense...

    so anyhow my links still aren't working...they are all linking up to the same page...instead of the individual pages i assign to them...here is my revised code

    <html>
    <head>
    <style>
    <!--
    a{text-decoration:none}
    //-->
    </style>

    <!-- %%NOBANNER%% -->

    <script language="JavaScript1.2">

    var it=0
    function initialize(){
    mytext=typing.innerText
    var myheight=typing.offsetHeight
    typing.innerText=''
    document.all.typing.style.height=myheight
    document.all.typing.style.visibility="visible"
    typeit()
    }
    function typeit(){
    typing.insertAdjacentText("beforeEnd",mytext.charAt(it))
    if (it<mytext.length-1){
    it++
    setTimeout("typeit()",100)
    }
    else
    return
    }
    if (document.all)
    document.body.onload=initialize
    </script>
    </head>

    <body background="images/background.jpg" link="ffffff" alink="ffffff" vlink="ffffff">
    <IMG HEIGHT="275" WIDTH="275" SRC="images/00000.jpg">
    <font face="larabiefont" color="FFFFFF" size="5" align="right">
    <small>
    <A HREF="mainpage.htm" STYLE="text-decoration: none">
    <span id="typing" style="visibility:hidden" align="left">
    ----- home</a><br>
    </br><A HREF="about.htm" STYLE="text-decoration: none">
    ----- about</a>
    <br>
    </br><A HREF="profolio.htm" STYLE="text-decoration: none">
    ----- profolio</a>
    <br>
    </br><A HREF="tribe.htm" STYLE="text-decoration: none">
    ----- tribe</a>
    </br><br>
    </span>
    </small>
    </font>
    </img>
    </body>
    </html>

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Looking at your sample page there I see that I misguided you a bit. You shouldn't do things like <br></br>, a simple <br /> will suffice, likewise for the <img ... /> tag.

    Your <span> tag or the </span> is still out of position.

    Of course none of that is relevant because the script you're using doesn't work for adding HTML to a page anyway. The "initialize" function recovers "innerText" from the "typing" span which means it get the text, not the html code. You can switch that to "innerHTML" but the output function still outputs text, not html.

    You could use the "insertAdjacentHTML" function except that function expects you to insert entire HTML in chunks, not poke things in one character at a time.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •