• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error in HTML

 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is a piece of code from my JSP. I get an error on the javascript portion taht says illegal character. How can I add javascript to a button that will populate a text field?


[ May 11, 2007: Message edited by: Steve Dyke ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to post HTML and Javaascript questions in the appropriate forum. This has been moved there for you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64958
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is not a dig of any kind, but are you learning HTML from a book that was published 10 years ago?

The <font> tag is long ago deprecated in favor of CSS, and modern conventions use lowercase for HTML tags. The all uppercase tags are incredibly hard to read.

All that said, please give us more details regarding the exact nature of the error, as on initial inspection I do not see the problem.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you do not put the javascript inside of the button tag

you should just be adding onclick="yourFunction()" to the tag and have the script somewhere else on the page.

Eric
 
Steve Dyke
Ranch Hand
Posts: 1621
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I now have the javascript working as long as my input number does not have a space in it. Example: AMS 2351 will caise a runtime error saying expected a ";"

My script code:

 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Steve,

that makes sense: numbers just don't have spaces.

Herman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic