Question:
Javascript: Why can't I get an alert box to work?
Ki-chan B
2008-12-17 20:44:00 UTC
I'm a novice at this. Bear with me.

This is what I have written out so far in Javascript:


I can't read the heading in the book because the alert box was in the way.







Javascript Program




Four answers:
anonymous
2008-12-17 21:05:23 UTC
Below my makeshift line is what should work. There are a few problems with your code:



1. Don't use ; instead use CSS included in tags using the style="" attribute.

2. or any variant of it should not be placed in the section. Nor should
. The only tags you really should be using inside are ,<meta>,<script>,<style>, and <link>. <br /><br />3. Each line of JavaScript must be terminated with a semi-colon. <br /><br />4. The <br> tag between the </head> closing tag and the <title> opening tag is unnecessary. <br /><br />5. The <title> tag should be moved inside the <head> tag. <br /><br />6. You have extra </script> and </head> closing tags. <br /><br />7. You should define a <body> tag before closing your <html> tag with </html>. All content is placed between <body> and </body>. <br /><br />--------------------------------------- <br /><br /> <br /><br /><html> <br /><br /><head> <br /><br /><title>Javascript Program















---------------------------------------



I added type="text/javascript" in the
CJ
2008-12-17 20:48:03 UTC
change:

window.alert ("Woohoo. It works...not. Why the hell won't this work!?")



to:



alert ("Woohoo. It works...not. Why the hell won't this work!?");



also make sure to add the script type to your scrip.



This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...