• Browser Compatability problems

    Author
    Topic
    #386327

    I would like to verify a form before submition.

    The form has a name, the calls are fully qualified (used document.formname…) but it does not work for me.

    The function:

    function monkeyLove()
    {
    document.forms[0].action = “./survey2003.php”;
    document.forms[0].method = “post”;
    document.forms[0].submit();
    }

    also tried the form name
    function monkeyLove()
    {
    document.text_entry_form.action = “./survey2003.php”;
    document.text_entry_form.method = “post”;
    document.text_entry_form.submit();
    }

    Both work in M$IE and Netscape, but not in Mozilla.

    Less than 1% of the hits on my site use Mozilla, but this may change.

    Viewing 0 reply threads
    Author
    Replies
    • #670151

      Try it with an ID instead of a name. These are sample W3C-DOM compliant functions that are supposed to work in IE5+ and NS6+. They toggles various attributes of DIV, TR, and IMG tags, and should, at least in theory, work just as well with a FORM:

      function toggleFrm()
      {
      	//IE5+ and NS6+
      	//Toggle visibility of a DIV block when link in form is clicked
      	var frmDiv1 = document.getElementById("cliSrchFrm");
      	var frmDiv2 = document.getElementById("matSrchFrm");
      	if (frmDiv2.style.display == "none")
      	{
      		frmDiv2.style.display = "block";
      		frmDiv1.style.display = "none";
      	}
      	else
      	{
      		frmDiv1.style.display = "block";
      		frmDiv2.style.display = "none";
      	}
      }
      function ToggleClt(strIdentifier)
      {
      	//IE5+ and NS6+
      	//Expand or collapse outline (show or hide table rows) based on current icon
      	var colRows = document.getElementsByTagName("TR");
      	var myIMG = document.getElementById('tog' + strIdentifier);
      	if (myIMG.src.indexOf("open11.png") > -1)
      	{
      		// show the mtrSum rows
      		for (intCount = 0 ; intCount < colRows.length ; intCount++)
      		{
      			if (colRows[intCount].className == "mtrSum" + strIdentifier)
      			{
      				colRows[intCount].style.display = "block";
      			}
      		}
      		// change the image to the close image
      		myIMG.src = "images/close11.png";
      		myIMG.title = "Click to hide matter detail";
      	}
      	else
      	{
      		// hide the mtrSum rows
      		for (intCount = 0 ; intCount < colRows.length ; intCount++)
      		{
      			if (colRows[intCount].className == "mtrSum" + strIdentifier)
      			{
      				colRows[intCount].style.display = "none";
      			}
      		}
      		// change the image to the open image
      		myIMG.src = "images/open11.png";
      		myIMG.title = "Click to show Matter subtotals";
      	}
      }
      

      Actually, the hard part is figuring out the exact case-sensitive CSS attribute names, because nothing happens if you have even the tiniest typo. (Well, at least nothing good happens.)

    Viewing 0 reply threads
    Reply To: Browser Compatability problems

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: