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

How to allow left click to enter info in text box form in FireFox

P: 67
Hello,

I had my webpage up and running great on both Internet Explorer and Firefox. The problem is, on FireFox the user can only right click the text box in forms to enter information. How do I change this so they can left click because I feel that is more natural.
Dec 20 '08 #1
Share this Question
Share on Google+
4 Replies


drhowarddrfine
Expert 5K+
P: 7,435
What you say should not be happening so there must be something else wrong. Without a link, or the complete markup, we can only guess.
Dec 20 '08 #2

P: 67
Below is the code to my contact page. I orignially created my webpage with internet explorer and it worked great. when I converted to Firefox, I have noticed some things in the code changed and obviously something changed which doesn't allow me to left click on the text box. any ideas what that could be? Thanks for any thoughts.

Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2. <title>Contact Us</title>
  3. <script language="JavaScript1.2">
  4. function disableselect(e){
  5. return false
  6. }
  7. function reEnable(){
  8. return true
  9. }
  10. document.onselectstart=new Function ("return false")
  11. if (window.sidebar){
  12. document.onmousedown=disableselect
  13. document.onclick=reEnable
  14. }
  15. </script>
  16. <script type="text/javascript">
  17. <!--
  18. function validate_form ( )
  19. {
  20. valid = true;
  21. if ( document.contactus.name.value == "")
  22. {
  23. alert ( "Please type in your Name." );
  24. document.contactus.name.focus();
  25. return false;
  26. }
  27. if ( document.contactus.email.value == "")
  28. {
  29. alert ( "Please enter an email address." );
  30. document.contactus.email.focus();
  31. return false;
  32. }
  33. var checkEmail = "@.";
  34.         var checkStr = document.contactus.email.value;
  35.         var EmailValid = false;
  36.         var EmailAt = false;
  37.         var EmailPeriod = false;
  38.         for (i = 0;  i < checkStr.length;  i++)
  39.         {
  40.         ch = checkStr.charAt(i);
  41.         for (j = 0;  j < checkEmail.length;  j++)
  42.         {
  43.         if (ch == checkEmail.charAt(j) && ch == "@")
  44.         EmailAt = true;
  45.         if (ch == checkEmail.charAt(j) && ch == ".")
  46.         EmailPeriod = true;
  47.           if (EmailAt && EmailPeriod)
  48.                 break;
  49.           if (j == checkEmail.length)
  50.                 break;
  51.         }
  52.         // if both the @ and . were in the string
  53.         if (EmailAt && EmailPeriod)
  54.         {
  55.                 EmailValid = true
  56.                 break;
  57.         }
  58.         }
  59.         if (!EmailValid)
  60.         {
  61.         alert("The \"email\" field must contain an \"@\" and a \".\".");
  62.         document.contactus.email.focus();
  63.         return (false);
  64.         }
  65. if ( document.contactus.subber.value == "")
  66. {
  67. alert ( "Please type in a Subject." );
  68. document.contactus.subber.focus();
  69. return false;
  70. }
  71. return valid;
  72. }
  73. //-->
  74. </script>
  75. </head>
  76. <body>
  77. <form action="contactus.asp" method=post name="contactus" onsubmit="return validate_form ( );">
  78. <input type="hidden" name="subject" value="ContactUs Form Submission">
  79. <input type="hidden" name="redirect" value="thankyou.html">
  80. <pre>
  81. <b><center><font face="comics sans ms" size="+3">If you wish to contact us, please fill out the form below.</font> 
  82. <br><font face="comic sans ms"><b>Name:          <input type="text" name="name" size="25">
  83. <br>Email Address: <input type="text" name="email" size="25">
  84. <br>Subject:          <input type="text" name="subber" size="25">
  85. <br>Message:
  86. <textarea cols="50" rows="4" name="message"></textarea>
  87. <input type="submit" value="Submit"><input type="reset">
  88. </form>
  89. </body>
  90. </html>
Dec 20 '08 #3

P: 88
I didn't read the entire code but this is what disables the mouse click in Firefox. Remove the following lines from your code and test.

Expand|Select|Wrap|Line Numbers
  1. if (window.sidebar){
  2. document.onmousedown=disableselect
  3. document.onclick=reEnable
  4. }
And these two functions are not needed in this case:
Expand|Select|Wrap|Line Numbers
  1. function disableselect(e){
  2. return false
  3. }
  4. function reEnable(){
  5. return true
  6. }
  7.  
Dec 20 '08 #4

P: 67
great, thank you very much. this works now.
Dec 21 '08 #5

Post your reply

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