Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-08-2003, 11:10 PM   PM User | #1
kaycee
New to the CF scene

 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kaycee is an unknown quantity at this point
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
kaycee is offline   Reply With Quote
Old 07-09-2003, 01:19 AM   PM User | #2
wickford
New Coder

 
Join Date: Jul 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
wickford is an unknown quantity at this point
You've made a typo.

<p> home<a/><br>

should be:

<p> home</a><br>

wickford is offline   Reply With Quote
Old 07-09-2003, 03:09 AM   PM User | #3
kaycee
New to the CF scene

 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kaycee is an unknown quantity at this point
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...
kaycee is offline   Reply With Quote
Old 07-09-2003, 12:19 PM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
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
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 07-09-2003, 03:15 PM   PM User | #5
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
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.
Roy Sinclair is offline   Reply With Quote
Old 07-09-2003, 05:39 PM   PM User | #6
kaycee
New to the CF scene

 
Join Date: Jul 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
kaycee is an unknown quantity at this point
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>
kaycee is offline   Reply With Quote
Old 07-09-2003, 06:45 PM   PM User | #7
Roy Sinclair
Senior Coder

 
Join Date: Jun 2002
Location: Wichita
Posts: 3,880
Thanks: 0
Thanked 0 Times in 0 Posts
Roy Sinclair will become famous soon enough
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.
Roy Sinclair is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:05 AM.


Advertisement
Log in to turn off these ads.