• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem compiling the code

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I just have started learning JavaScript, and I am getting an error with the following code.
<html>
<head><title>Problem</title></head>
<script language="javascript")
<!--
function hello() {
var fname = prompt("Enter you First name here.", "")
var lname = prompt("Enter you Last name here.", "")
var page = document.location;
var ttl = document.title;
alert("Hi " + fname + " " + lname + ". Welcome to " + ttl + ", " + page+".")
}
-->
</script>
<body onLoad="hello()">
</body>
</html>

I am getting the error at <body onLoad="hello()"> line asking
"Error: Object expected.
please let me out of it.
Thanks in advance
Anshul
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TYPO!!
<script language="javascript">
NOT
<script language="javascript" )
 
Anshul Garg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tony
reply
    Bookmark Topic Watch Topic
  • New Topic