472,143 Members | 1,143 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,143 software developers and data experts.

How to put validation with Javascript in Firefox.

I am trying to validate empty textbox value by javascript in Firefox. It is working fine in IE but not in Firefox.

Note - code is for ASP.NET

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
Button1.Attributes.Add("onclick", "javascript:checkForm();");

<script type="text/javascript">
function checkForm()
if(document.getElementById('txtUserName').value =="")
if (window.event) //IE
window.event.returnValue = false;
else //Firefox
event.preventDefault(); // <-- What should I write here instead
//retrun false; is also not working


Please help. Thanks
Feb 7 '07 #1
1 1390
4,871 Expert 4TB
Here is an alternate global event:
A global event...in Firefox?

Here is a related thread:
Mouse position in FireFox / NS
Feb 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Stephen | last post: by
1 post views Thread by NancyASAP | last post: by
27 posts views Thread by Chris | last post: by
7 posts views Thread by Tim_Mac | last post: by
11 posts views Thread by Rik | last post: by
4 posts views Thread by darrel | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.