Hi all –
Newbie to JavaScript.
I’m working through tutorials in
[I]JavaScript for the World Wide Web, Fifth Edition (Visual QuickStart Guide)”
Tom Negrino
I can’t figure out what is wrong with this script
When I run it in Firefox 2 I receive a blank screen
When I run it in IE 7, I receive:
[QUOTE]
This page requires JavaScript.
As expected.
Could yo please point to what I might be doing wrong?
I’ve checked it several times and I don’t see it
Full code below
Thanks
-winston
[CODE]<?xml version=”1.0″ encoding=”UTF-8″?>
<DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<title>My Javascript Page</title>
<script language=”Javascript” type=”text/javascript”>
<!– Hide script from old browsers
ans = prompt(“Are you sure you want to do that?”,””)
If(ans){
alert(“You said “+ans)
}
else{
alert(“You refused to answer”)
}
// End hiding script from old browsers –>
</script>
</head>
<body bgcolor=”#FFFFFF”>
<noscript>
<h2>This page requires JavaScript.</h2>
</noscript>
</h1>
</body>
</html>