• Post Reply Bookmark Topic Watch Topic
  • New Topic

very very basic Javascript function not defined  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am trying to learn Javascript.
I have a very very basic file. I do not understand why I am having a javascript error that says that my function is not defined.
As far as I can see it is defined in the <head>. Could any one help me figure out where the problem is in my file?

 
author & internet detective
Sheriff
Posts: 38019
604
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any errors if you check in the JavaScript Error Console in your browser?
 
Author and ninkuma
Marshal
Posts: 66529
160
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your markup is invalid. The <script> tag cannot be self-closing.
 
Ranch Hand
Posts: 310
18
Linux MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Your markup is invalid. The <script> tag cannot be self-closing.


This is exactly the source of the problem.

The proper way to do this:
 
Ines Mew
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Jeanne , Bear and Adam. Yes, I incorrectly closed <scrip> tag. One forward slash cost me 30 minutes of my life span.
 
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ines Mew wrote:Thank you Jeanne , Bear and Adam. Yes, I incorrectly closed <scrip> tag. One forward slash cost me 30 minutes of my life span.


It's called "paying your dues". We've all been there. Welcome to the club. Wait until you get burned by an improperly placed semi-colon.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!