Reputation: 2415
I'm having a tough time enabling javascript in chrome on my own webpage. Other websites seem to be able to do it pretty easily. Here's my prtty simple code but the start() function just wouldn't work.
<doctype html>
<html>
<head>
<script type = "javascript">
function start() {
alert("Hi");
}
</script>
</head>
<body onload = "start()">
Hi
</body>
</html>
Upvotes: 0
Views: 114
Reputation: 500
<!doctype html>
<html>
<head>
<script>
function start() {
alert("Hi");
}
</script>
</head>
<body onload = "start()">
Hi
</body>
</html>
Upvotes: 0
Reputation: 56
The main problem is your type attribute. If you were to keep it, then it should be
<script type="text/javascript"></script>
However, you don't need it (See here: http://javascript.crockford.com/script.html). You can just use
<script></script>
That will fix your function.
Although not directly hindering your function, your doctype is missing the '!' and should probably be updated
<!doctype html>
Upvotes: 3
Reputation: 56509
You're using wrong type
Attribute, it should be
<script type="text/javascript">
or simply
<script> </script> //by default is type is "text/javascript"
Also change <!DOCTYPE html>
Upvotes: 10