473,396 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

error in code

I have a script to display a moving text in the status bar. I also
want to display the change of ShowHead and ShowTail variables in the
page. I wrote a
function w()to do this. But it caused an error after it ran. Could
you tell me what is wrong? Thanks a lot.
Here is the code:
<html>
<head>
</head>
<body><script>
var ShowString = " " //The
first line must be blank
+ "JavaScript Scrolling Text Demo is here... "
var ShowWidth = 1000
var ShowHead = 0
var ShowTail = ShowWidth
var ShowLength = ShowString.length

function Marquee(){
var DisplayString
if (ShowHead < ShowTail)
DisplayString = ShowString.substring(ShowHead, ShowTail)
else
DisplayString = ShowString.substring(ShowHead, ShowLength)
+ ShowString.substring(0, ShowTail)
ShowHead = (ShowHead + 1 ) % ShowLength
ShowTail = (ShowTail + 1 ) % ShowLength
window.status = DisplayString
TimerID = setTimeout("Marquee()",200)
}
Marquee();//above is OK.
function w(){
document.write(ShowHead +" "+ ShowTail);
setTimeout("w()",200);
}
w();
</script>
</body>
</html>
Jul 20 '05 #1
1 1390
chirs wrote:
I have a script to display a moving text in the status bar.
Remove it, for the sake of your visitors and for your own sake.
The status bar is a useful tool and you should not touch it,
unless you know what you are doing (which is obviously not the
case.)
I also want to display the change of ShowHead and ShowTail variables
in the page. I wrote a function w()to do this.
Once a document has been loaded, document.write(...) overwrites the
document which causes all variables and functions to be undefined.
Use DOM scripting instead of document.write(...) if you need a timed
presentation.
But it caused an error after it ran.
`An error occured' is an insufficient error *description*.
[...]
<html>
Before this tag the DOCTYPE declaration is missing.
<head>
</head>
The charset declaration via the `meta' element,
and the `title' element are missing here.
<body><script>
The `type' attribute for the `script' element is missing.
It should be at least <script type="text/javascript">.

Your markup is invalid. See http://validator.w3.org/ for details.
[...]
function w(){
document.write(ShowHead +" "+ ShowTail);
setTimeout("w()",200);
}
w();
[...]

PointedEars

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Tony Wright | last post by:
Hi, I am having a problem installing an msi for a web site. The error message I am getting is: "The specified path 'http://mipdev05/features/Fas2' is unavailable. The Internet Information...
2
by: Gregory | last post by:
Hi, One of the disadvantages of using error handling with error codes instead of exception handling is that error codes retuned from a function can be forgotten to check thus leading to...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
16
by: Steve Jorgensen | last post by:
I'm trying to figure out if there is a way to generate standard error handlers that "know" if the calling code has an error handler in effect (On Error Goto <label> or On Error Resume Next) before...
6
by: Squirrel | last post by:
I have a command button on a subform to delete a record. The only statement in the subroutine is: DoCmd.RunCommand acCmdDeleteRecord The subform's recordsource is "select * from tblVisit order...
7
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
4
by: Eugene Anthony | last post by:
One problem with the code bellow is after this code conn.qDupUser p1,rs I added: set rs = nothing to test the error handling capability.
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.