Skip to Content
Head Rush Ajax
book

Head Rush Ajax

by Brett McLaughlin
March 2006
Beginner to intermediate
448 pages
13h 33m
English
O'Reilly Media, Inc.
Content preview from Head Rush Ajax
34
Chapter 1
The JavaScript’s ready, and the button no longer tries to submit
the form... but right now, getBoardsSold() never runs, either.
This shouldn’t be too hard to x, though:
Running getBoardsSold() from the web form
Can’t we just run the
getBoardsSold() function
whenever someone clicks on
“Show Me the Money”?
<input value=”Show Me the Money” type=”button” />
function getBoardsSold() { ... }
Any time this button is clicked...
...this JavaScript function
needs to get called.
A Question For JavaScript
JavaScript, we need to run a function from our HTML. Can you help us out?
Oh, well I’m incredibly exible when it comes to calling functions from a
web page. Just use one of my event handlers in your HTML. You can use
onBlur() for when someone leaves a eld, or onClick(), for when a
user clicks... how about onChange(), for when a value changes... or there’s
onFocus()... wait, wait, I’ve got more... what do you mean, out of time?
avoiding form submits
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz
What Successful Project Managers Do

What Successful Project Managers Do

W. Scott Cameron, Jeffrey S. Russell, Edward J. Hoffman, Alexander Laufer
How to Become a Game-Changing Leader

How to Become a Game-Changing Leader

Douglas A. Ready, Alan Mulally

Publisher Resources

ISBN: 0596102259Errata PageSupplemental Content