Reply
Help : HTML combo with js
Old 02-01-2008, 07:20 AM Help : HTML combo with js
no_nickname's Avatar
Junior Talker

Posts: 2
first, sorry i am newbie in webdesign
can anybody help me to built HTML file with javascript inside?

i wanna give typewriter text effect in my web, but it doesn't work (

here're my html codes

<TITLE> www.****.com </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-image: url(image/178.jpg);
}
-->
</style></head>

<body>
<table width="622" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="331" height="306">&nbsp;</td>
<td width="291">&nbsp;</td>
</tr>
<tr>
<td height="58">&nbsp;</td>
<td valign="top"> <script language="javascript"> var text="in progress by no_nickname "
var bgcolor="black"
var textcolor="white"
var typespeed=65 var n=0
if (document.all||document.getElementById){
document.write('<font color="'+bgcolor+'">')
for (m=0;m<text.length;m++)
document.write('<span id="typo'+m+'">'
+text.charAt(m)+'</span>')
document.write('</font>')

}
else
document.write(text)

function crossref(number){
var crossobj=document.all?
eval("document.all.typo"+number) :
document.getElementById("typo"+number)

return crossobj
} function type(){

if (n==0){
for (m=0;m<text.length;m++)
crossref(m).style.color=bgcolor
}

crossref(n).style.color=textcolor

if (n<text.length-1)

n++
}

function typestart(){
if (document.all||document.getElementById)
typing=setInterval("type()",typespeed)
}
typestart()

else{
n=0
clearInterval(typing)
setTimeout("typestart()",1500)
return
}

</script> <!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table>
</body>
</html>

the red text is text that get typewriter effect

or i must spred the file?
one form for .html
and another in .js fomat?


thank you
no_nickname is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 02-01-2008, 01:59 PM Re: Help : HTML combo with js
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
It isn't working becuase your Javascript is a shambles.

A simple search in Google, and here's your code:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <title></title>
<script type="text/javascript">
var text="content of text here";
var delay=50;
var currentChar=1;
var destination="";

function type()
{
  if (document.getElementById)
  {
    var dest=document.getElementById(destination);
    if (dest)
    {
      dest.innerHTML=text.substr(0, currentChar);
      currentChar++
      if (currentChar>text.length)
      {
        currentChar=1;
        setTimeout("type()", 5000);
      }
      else
      {
        setTimeout("type()", delay);
      }
    }
  }
}
function startTyping(textParam, delayParam, destinationParam)
{
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  type();
}
</script>
  </head>
  <body>
  <div id="textDestination">...</div>
  </body>
  <script type="text/javascript">
  startTyping(text, 50, "textDestination");
  </script>
</html>
__________________
Tumblings.co.uk - Tumblog with thoughts, quotes, links, videos, images and my creations.
Opera Browser - The best free web browser.
Opera Dev Tools - Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 02-02-2008, 03:12 AM Re: Help : HTML combo with js
JeremyMiller's Avatar
Full-Time TeraTasker

Posts: 820
Name: Jeremy Miller
Location: Reno, NV
Yo! No Nick! Ever heard of the code tags? If you want help, you should format your stuff so that it's easier to read. If you don't know what they are, then ask and we'll tell you.
__________________
Jeremy Miller - TeraTask Technologies, LLC
Content Farmer - Automated Posting for Content & Blog Sites
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-10-2008, 11:22 AM Re: Help : HTML combo with js
no_nickname's Avatar
Junior Talker

Posts: 2
Quote:
Originally Posted by no_nickname View Post
first, sorry i am newbie in webdesign
can anybody help me to built HTML file with javascript inside?

i wanna give typewriter text effect in my web, but it doesn't work (

here're my html codes

<TITLE> www.****.com </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-image: url(image/178.jpg);
}
-->
</style></head>

<body>
<table width="622" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutDefaultTable-->
<tr>
<td width="331" height="306">&nbsp;</td>
<td width="291">&nbsp;</td>
</tr>
<tr>
<td height="58">&nbsp;</td>
<td valign="top"> <script language="javascript"> var text="in progress by no_nickname "
var bgcolor="black"
var textcolor="white"
var typespeed=65 var n=0
if (document.all||document.getElementById){
document.write('<font color="'+bgcolor+'">')
for (m=0;m<text.length;m++)
document.write('<span id="typo'+m+'">'
+text.charAt(m)+'</span>')
document.write('</font>')

}
else
document.write(text)

function crossref(number){
var crossobj=document.all?
eval("document.all.typo"+number) :
document.getElementById("typo"+number)

return crossobj
} function type(){

if (n==0){
for (m=0;m<text.length;m++)
crossref(m).style.color=bgcolor
}

crossref(n).style.color=textcolor

if (n<text.length-1)

n++
}

function typestart(){
if (document.all||document.getElementById)
typing=setInterval("type()",typespeed)
}
typestart()

else{
n=0
clearInterval(typing)
setTimeout("typestart()",1500)
return
}

</script> <!--DWLayoutEmptyCell-->&nbsp;</td>
</tr>
</table>
</body>
</html>

the red text is text that get typewriter effect

or i must spred the file?
one form for .html
and another in .js fomat?


thank you
it works
thx very much
no_nickname is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Help : HTML combo with js
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12610 seconds with 13 queries