...

View Full Version : help with link



kaycee
07-08-2003, 11:10 PM
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

wickford
07-09-2003, 01:19 AM
You've made a typo.

<p> home<a/><br>

should be:

<p> home</a><br>

:thumbsup:

kaycee
07-09-2003, 03:09 AM
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...

Kor
07-09-2003, 12:19 PM
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...:-)

Roy Sinclair
07-09-2003, 03:15 PM
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:



<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>".

kaycee
07-09-2003, 05:39 PM
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>

Roy Sinclair
07-09-2003, 06:45 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum