0

Some explain this to me, i dont know wtf im doing and its so simple.

uncaught syntax error line1. I keep doing this I took a picture and copied this JavaScript down to the tee I don't know what I'm doing wrong. I'm on the message alert box of this JavaScript learning course. I'm trying any advice on what to do or how the f you learn java

7th Feb 2017, 7:20 PM
michael
5 odpowiedzi
+ 3
You have at least two mistakes: - unwanted slash ( / ) in opening tag <script type="text/javascript"> ( you can use the shorter <script> as Javascript is both the default script language and the only :P ) - forgot the function identifier ( name ), probably 'alert' as suggested by @hello world!!! ... but can be 'document.write' as your <body> is empty may mean you just use the html code as wrapper for your script ^^... [edit] For the code playground case, you have three tab html, css and js... css and js are specific and treated as external files linked ( silently ) in the <head> of the html tab. To just use js, you can as well type the code in the js tab WITHOUT the <script> tags, or normally type your JS code anywhere you want in html tab, embeded in <script> tags ;)
8th Feb 2017, 2:08 AM
visph
visph - avatar
+ 1
You have to say alert("this is an alert box") the alert in front of it lets it know you want it to be an alert box.
7th Feb 2017, 7:59 PM
Hello World!!!!
Hello World!!!! - avatar
0
<html> <head> <title></title> </script type="text/javascript"> ("This is an alert box!"); </script> </head> <body> </body> </html> this is what I used I even took a pic and did this exactly as it showed but when I hit run it shows syntax error
7th Feb 2017, 7:51 PM
michael
0
<scripttype="text/javascript"> alert("This is an alert box!"); just type this in js if you haven't noticed the sections for html css and js.
8th Feb 2017, 12:14 AM
☆CyberKid☆
☆CyberKid☆ - avatar
- 1
in your code you wrote the html code in the javascript section. I make that mistake too sometimes
7th Feb 2017, 8:01 PM
Hello World!!!!
Hello World!!!! - avatar