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

MAC, Safari, Javascript does not run

P: 1
This script does not run on MAC OS 10 w/Safari, but it does run under XP w/IE. This is a report setup screen. The user selects a customer from a select window and picks a date range from a popup calendar.

The problem is in the validation routine that checks for proper setup before continuing. When the user clicks on Continue image button, the form does not submit. I would appreciate any education passed along. I want to write code that runs everywhere. Thank you.

Expand|Select|Wrap|Line Numbers
  1. <head>  
  2. <script language='JavaScript' type='text/javascript'> 
  3.    function IsComplete(theForm) { 
  4.       if (theForm.m_DATE_BEGIN.value == "")  
  5.       {alert("Beginning Date required.");return false;}  
  6.       else if (theForm.m_DATE_END.value == "")  
  7.       {alert("Ending Date required.");return false;}  
  8.       else 
  9.       {return true;} 
  10.    } 
  11.  
  12.    function  NotEmptySelect(theForm) {
  13.       var oCustomer = theForm.m_ID_CUSTOME; 
  14.       var lCustomer = false; 
  15.       for( var i=0; i<oCustomer.length;i++)  
  16.       { 
  17.          if (oCustomer.options[i].selected) {lCustomer = true;}")
  18.       } 
  19.       if (lCustomer==true) { return true; }  
  20.       else {alert('Pick a Customer'); return false; } 
  21.    } 
  22. </script> 
  23. </head> 
  24. <body>
  25. ...           
  26. <input type="image" 
  27.           src="/images/btn_continue.gif"
  28.           onclick="if( NotEmptySelect(document.getElementById('fS')) && IsComplete(document.getElementById('fS')) )
  29.              {javascript:document.getElementById('fS').submit();}">
Aug 31 '06 #1
Share this Question
Share on Google+
1 Reply


acoder
Expert Mod 15k+
P: 16,027
On line 17, remove ") at the end of the line.

No need for "javascript:" in the onclick.

The script language attribute is deprecated, so you can safely remove it.
May 12 '08 #2

Post your reply

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