By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,671 Members | 1,623 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,671 IT Pros & Developers. It's quick & easy.

How to put validation with Javascript in Firefox.

P: 8
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
Share this Question
Share on Google+
1 Reply

Expert 2.5K+
P: 4,871
Here is an alternate global event:
A global 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.