Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Engineering
»
HTML, CSS and JavaScript
Author
Error: Object expected,Char 1 Code 0
Ernest Dellamotta
Greenhorn
Joined: Dec 06, 2012
Posts: 1
posted
Dec 06, 2012 06:16:40
0
My Display Date isnt working it says object expected on line 92 which is in the body <button type="button" onclick="displayDate()">Display Date</button> ... this is the code for the whole page ... help please?
<!DOCTYPE html> <html> <head> <script language="javascript" type="text/javascript" > function jumpto(x){ if (document.form1.jumpmenu.value != "null") { if (document.form1.jumpmenu.value != "http://www.quackit.com") { alert('Sorry to see you leaving Quackit. Hope to see you back soon!'); } document.location.href = x } } </script> <form name="form1"> <select name="jumpmenu" onChange="jumpto(document.form1.jumpmenu.options[document.form1.jumpmenu.options.selectedIndex].value)"> <option>Jump to...</option> <option value="http://www.lonelyplanet.com/italy">Italy Travel Info</option> <option value="http://en.wikipedia.org/wiki/History_of_Italy">History of Italy, Wikipedia</option> <option value="U:\Web 3\Contienent\Spain.html">Spain Site</option> <option value="U:\Web 3\Contienent\Italyspain2.html">Italy/Spain Homepage</option> <option value="http://lyman.scps.k12.fl.us/lyman%20web/index.php">Lyman Homepage</option> </select> </form> <script> function alertUser(msg) { alert(msg); } <!-- Begin NewImg = new Array ( "images/09.jpg", "images/10.jpg", "images/11.jpg", "images/12.jpg", "images/13.jpg", "images/14.jpg", "images/15.jpg", "images/16.jpg" ); var ImgNum = 0; var ImgLength = NewImg.length - 1; //Time delay between Slides in milliseconds var delay = 3000; var lock = false; var run; function chgImg(direction) { if (document.images) { ImgNum = ImgNum + direction; if (ImgNum > ImgLength) { ImgNum = 0; } if (ImgNum < 0) { ImgNum = ImgLength; } document.slideshow.src = NewImg[ImgNum]; } } function auto() { if (lock == true) { lock = false; window.clearInterval(run); } else if (lock == false) { lock = true; run = setInterval("chgImg(1)", delay); } } // End --> <script> function displayDate() { document.getElementById("demo").innerHTML=Date(); } </script> </head> <body bgcolor="green"> <center> <h1><A HREF="U:\Web 3\Contienent\italyspain2.html"> <FONT COLOR="Red" onMouseOver="this.style.color = 'Green'" onMouseOut="this.style.color = 'White'">Italy </FONT></A></h1> </center> <p id="demo"></p> <button type="button" onclick="displayDate()">Display Date</button> <center> </br> </br></br> </br></br> </br> <img src="images/09.jpg" name="slideshow"> </br> </br></br><table> <tr> <td align="right"><a href="javascript:chgImg(-1)">Previous</a></td> <td align="center"><a href="javascript:auto()">Auto/Stop</a></td> <td align="left"><a href="javascript:chgImg(1)">Next</a></td> </tr> </table> </center> </br> </br></br> </br></br> </br> <a href="Italyspain2.html">Click here to go back</a> </br></br> </br> <script type="text/javascript"> function alertUser(msg) { alert(msg); } </script> </head> <body onload="alertUser('Welcome Guest to Italy!')"> <div style="text-align:center;padding:10px;"> </div> <p>This document was last modified on: <script> document.write(document.lastModified); </script> </font></p> </body> </html>
[Added code tags - see
UseCodeTags
for details]
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
Dec 06, 2012 12:07:29
0
Don't you want
new Date()
and not just Date()?
Eric
Vivek SharmaJi
Greenhorn
Joined: Dec 09, 2012
Posts: 7
posted
Dec 09, 2012 11:28:59
0
try like this
javascript:displayDate();
Eric Pascarello
author
Rancher
Joined: Nov 08, 2001
Posts: 15357
6
posted
Dec 09, 2012 11:41:36
1
That javascript label does NOTHING and it is bad practice.
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56162
13
I like...
posted
Dec 09, 2012 11:47:42
0
Vivek SharmaJi wrote:
try like this javascript:displayDate();
No. Do not do this. As Eric pointed out, it's superfluous and will no affect at all on the issue.
[
Smart Questions
] [
JSP FAQ
] [
Books by Bear
] [
Bear's FrontMan
] [
About Bear
]
Vivek SharmaJi
Greenhorn
Joined: Dec 09, 2012
Posts: 7
posted
Dec 09, 2012 11:56:44
0
I don't see the end tag of <script> at line 28. One end tag is missing. Please check that.
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: Error: Object expected,Char 1 Code 0
Similar Threads
++ appears before my table??
Problem in using date in WHERE clause in SELECT query in Servlet.
spaces while populating using s:iterator
help with validation/ 2 functions on submit.
not redirecting to servlet page
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter