SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    USA
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Object doesn't support property

    Code:
    <script language="JavaScript" type="text/JavaScript">
    			
    		function LockButtons (whichform) {
    			ua = new String(navigator.userAgent);
    			if (ua.match(/IE/g)) {
    				for (i=1; i<whichform.elements.length; i++) {
    					if ((whichform.elements[i].type == 'submit') || (whichform.elements[i].type == 'button')) {
    						whichform.elements[i].disabled = true;
    					}
    				}
    			}
    			whichform.submit();
    		}
    		
    </script>
    I have this javascript in use in a contact form but when someone on Win OS submits the form the following error occurs.

    Line:97
    Char :4
    Error: Object doesn't support this property or method
    Code: 0
    URL: http://www.cedarrunhc.com/contactusx.php

    Do you want to continue running scripts on this page?


    Line 97 of the source code would yield:
    whichform.submit();

    So..any ideas why this is generated on WinOS but not MacOS? Is there some other reason why this error would be generated from this page?

  2. #2
    I'll take mine raw silver trophy MikeFoster's Avatar
    Join Date
    Dec 2002
    Location
    Alabama, USA
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try

    var f = document.forms['whichform'];

    if 'whichform' is the 'name'. If it is the 'id' then try

    var f = document.getElementById('whichform');

  3. #3
    SitePoint Wizard silver trophy
    Join Date
    May 2003
    Posts
    1,843
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try naming your submit button something other than "submit".
    ::: certified wild guess :::


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •