dd/mm/yy
06-28-2002, 10:54 AM
hey everybody [like the new board by the way!] :D
i've been working on a script for the past couple of hours that types out a link when you put your mouse over it.
i eventually got it working, but its very temperamental (sp?) and sometimes runs twice when you put your mouse over it and sometimes won't let you click to go to the linked page etc.... :confused:
i was wondering if one of you javascript gurus might be able to take a look and perhaps help me out please? i'm a bit out of practise so the code is a bit untidy and probably not that easy to read..... sorry! :rolleyes:
heres the code:
<script language="javascript">
<!--
// pos is the position in the word
// id is the ID of the element it writes to
// word is the word it types out
function typelink(pos,id,word) {
if (document.all) {
if (pos <= word.length) {
document.all[id].innerText = word.substring(0,pos)
pos++
setTimeout('typelink(' + pos + ',\'' + id + '\',\'' + word + '\')',100)
}
else if (pos > word.length) {
return true
}
}
}
//-->
</script>
and a link looks like this:
<a href="http://www.miccheck.co.uk" onmouseover="typelink(0,'newsbox','news')"><font id="newsbox">news</font></a>
thanks in advance
dd/mm/yy
i've been working on a script for the past couple of hours that types out a link when you put your mouse over it.
i eventually got it working, but its very temperamental (sp?) and sometimes runs twice when you put your mouse over it and sometimes won't let you click to go to the linked page etc.... :confused:
i was wondering if one of you javascript gurus might be able to take a look and perhaps help me out please? i'm a bit out of practise so the code is a bit untidy and probably not that easy to read..... sorry! :rolleyes:
heres the code:
<script language="javascript">
<!--
// pos is the position in the word
// id is the ID of the element it writes to
// word is the word it types out
function typelink(pos,id,word) {
if (document.all) {
if (pos <= word.length) {
document.all[id].innerText = word.substring(0,pos)
pos++
setTimeout('typelink(' + pos + ',\'' + id + '\',\'' + word + '\')',100)
}
else if (pos > word.length) {
return true
}
}
}
//-->
</script>
and a link looks like this:
<a href="http://www.miccheck.co.uk" onmouseover="typelink(0,'newsbox','news')"><font id="newsbox">news</font></a>
thanks in advance
dd/mm/yy