tags:

views:

165

answers:

3

Someone please point out why this script is not working. It started out as an AJAX script and I took line by line away until I was left with a function containing an alert and it still will not work in IE. So please someone put me out of my misery.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Expires" content="Fri, Jan 01 1900 00:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Lang" content="en">
<meta name="author" content="">
<meta http-equiv="Reply-to" content="@.com">
<meta name="generator" content="PhpED 5.6">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="creation-date" content="11/11/2008">
<meta name="revisit-after" content="15 days">
<title>Untitled</title>
<link rel="stylesheet" type="text/css" href="my.css">

<script type="application/javascript">



function showUser()
{
alert('blah');
}


</script>


</head>
<body>
  <input type="button" onclick="showUser()" />
</body>

+15  A: 

Try using

<script type="text/javascript">

Also, the </html> is missing.

Roland Bouman
wargh... I have spent to long on the computer. thank you
Mark
The script type attribute really isn't required, and in fact Crockford strongly recommends that it never be used. I'd just leave it off.
Pointy
"This attribute is optional. Since Netscape 2, the default programming language in all browsers has been JavaScript. In XHTML, this attribute is required and unnecessary. In HTML, it is better to leave it out. The browser knows what to do." -- http://javascript.crockford.com/script.html Just, remember to not leave it out in XHTML documents (if you want the page to validate).
jessegavin
+7  A: 
<script type="text/javascript">

instead of

<script type="application/javascript">
Cortopasta
+1  A: 

And you can use JSBin to play with you code. Nice service!

NilColor