OZONE Asylum
Forums
DHTML/Javascript
Stopping a form from posting with javascript
This page's ID:
28177
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
bare in mind that you can also PASTE something in a form field using the mouse, so you should replace the [u]onkeyup[/u] by an [i]onchange[/i] [quote]What does the "form" part do? I removed the "form" from the onKeyUp event, but it broke. Could you enlighten me a bit as to why or what it does?[/quote]Form fields have a [i]form[/i] property. Thus from any form field it is possible to go "one level up" to reach their owner FORM tag then access any of its form fields. It seems like you have an input field called [i]body[/i]. When you refer to it from the scope of the FORM you can use [i]this.body[/i], from the scope of another form field it is [i]this.form.body[/i], from the scope of the input field called [i]body[/i] it is simply [i]this[/i], or you can go "one level up" ( to the FORM ) then down to the field using [i]this.form.body[/i] but that's a pit pointless. Hence in your keyup should read:[code]onkeyup="textLimit(this, 150);"[/code] Hope that helps, [url=http://www.p01.org/][img]http://poi.ribbon.free.fr/files/p01_ozoneasylum_sig_galaxy.gif[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/2185]poi[/url] on 07-06-2006 21:25)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »