• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 328
  • Last Modified:

Firefox 3.0.10 no longer processing a javascript function

The following function worked in previous versions of Firefox and continues to work in both IE and Google Chrome. The function calls a window that contains a dbase-generated list used to define a database query. Firefox doesn't  even recognize the alerts. Can someone can take a look at the script and flag the stuff that might cause Firefox to choke?
function dmsJS_displayKeywordPickList(form,fieldName,controlType) {
	var newWin
	var doc
//	alert("name=" + form.name)
//	alert("fieldName=" + fieldName + " controlType=" + controlType)
	// Check for netscape browser
	   var xMax=screen.width, yMax=screen.height;
	else //IE browser
	      var xMax=window.outerWidth, yMax=window.outerHeight;
	      var xMax=640, yMax=480;
	var xOffset=(xMax-200)/2, yOffset=(yMax-200)/2;
	newWin = window.open('','wDmsKeyList',
	doc.write("<html>" + "\n")
	doc.write("<head>" + "\n")
	doc.write("<META HTTP-EQUIV='Expires' content='Sunday, 01 Jan 1995 12:00:00 GMT'>")
	doc.write("</head>" + "\n")
	doc.write("<title>Falcon/DMS</title>" + "\n")
	doc.write("<body bgcolor='' onLoad='javascript:document.dmsKeywordList.submit()'>\n")
	doc.write("<table width='100%' height='100%'>")
	doc.write("<tr><td align='center'><font face='Arial' color='BLACK' size=4>")
	doc.write("<b>Building List<br>Please Wait...</b></font>\n")
	doc.write("<form action='/scripts/falcon/dmsWebLists2.exe' name='dmsKeywordList' Method='Post'>" + "\n")
	//doc.write("<form action='/scripts/falcon/dmstest.exe' name='dmsDirList' Method='Post'>" + "\n")
	doc.write("<input type='hidden' name='sessionid' value='" + "userid" +"'>\n")
	doc.write("<input type='hidden' name='cmd' value='getKeywordList'>\n")
	doc.write("<input type='hidden' name='formName' value=" + form.name + ">\n")
	doc.write("<input type='hidden' name='fieldName' value=" + fieldName + ">\n")
	doc.write("<input type='hidden' name='controlType' value=" + controlType + ">\n")
	for(var ict=0; ict < form.elements.length; ict++) {
	   // Process text fields
	   if(form.elements[ict].name.substring(0,4) == 'dir_'){
	   	//Sumbit the directory level values for the autoGenerate
		if(controlType == 5  || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
	   if(form.elements[ict].name.substring(0,7) == 'keyword' ||
		form.elements[ict].name.substring(0,5) == 'ffmtk'){
	   	//Sumbit the keyword values for any hiearchical keywords
		if(controlType == 4 || controlType == 5 || controlType == 6 || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
	   if(form.elements[ict].name == 'file_format' ||
		form.elements[ict].name == 'drawing_status'){
	   	//Sumbit values needed for auto-generate
		if(controlType == 5 || controlType == 8){
			doc.write("<input type='hidden' name='" + form.elements[ict].name + "' " + 
		  	"value='" + form.elements[ict].value + "'>\n")
	} // end for
	//doc.dmsDirList.submit() did not work on the MAC, switch to body onLoad
	//return false

Open in new window

  • 2
1 Solution
Can you show the same code with the <script> and the html code that comes with it so that we can test it and amend it?

(btw & OT, the document.all is supported by IE, not by netscape, which used to support document.layers, your if statement is the other way around, but that's only a comment, and does not involve code execution).
If the first alert is not executing, the error is either the code prior to the function call or the function is not being called. If other browsers are still working, I would guess the former so I would check that the code is executing up to the point of the call.

I tested the script. At least the first few lines are executing in FF3, so that enforces that the error is prior to the function call.
tsynnottAuthor Commented:
abel and dlastlee
Thanks for your attention to this issue (sorry it took so long to respond).

Before I proceed further with your recommendations, I discovered something that may add to your understanding of my problem: The search form that produces the problem I described is programmatically generated using a 'template' html file that with the xhtml-strict.dtd DocType declaration in the header (one of our client's 508 compliance requirements).

During my latest troubleshooting, I changed the DocType to the transitional declaration, which didn't work, and then to <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">, which did work! I talked to one of my programmers about this and it was suggested that the problem probably relates to how the form's name/id is being processed, and that the problem will be addressed in the coming version release. Based on this information, if you can think of anything else I would appreciate hearing from you. In the meantime, we're probably just going to go with changing the DocType for that form and address the problem more completely in the next release.

That is clearly possible. Transitional and Strict are both more strict on the syntax, than the more lenient HTML 3.2 Final DOCTYPE which would allow you a temporary relief to the issue.

To find the root cause still requires the same type of debugging, in your case, more alerts prior to the function provided. The script will still end when it reaches a run-time error except it would be earlier than a more lenient type. Another possibility is to use FF error console which may be able to provide you more clues to locating the error.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now