Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

very very basic Javascript function not defined

 
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
Posts: 39625
784
Eclipse IDE VI Editor Java
  • 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?
 
Marshal
Posts: 67300
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
MS IE Linux
  • 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: 1810
28
jQuery Netbeans IDE Eclipse IDE Firefox Browser MySQL Database Chrome Linux
  • 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.
 
No prison can hold Chairface Chippendale. And on a totally different topic ... my stuff:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!