Making Mozilla Crash

admin

Administrator
Staff member
I built a "homemade" popup dialog window in javascript. On Safari for my mac, it works just fine. On Mozilla, it crashes the browser.

The popup has one text field, an OK button, a Cancel button, and text and image display. The content of the text and image depend on what the user previously clicked on to call the popup. The field is just a two-character field with a default value. The user changes the value or leaves it as-is and clicks the ok button.
The problem occurs if you accidently hit 'tab' while the text field is in focus. I've tried to trap the tab event in the field, but to no avail.

Here's the offending code:

var entryLine = "<form id = 'selectForm' >
<input type = 'text' name = 'bodyId' id = 'bodyId' size = '2' value = <!-- m --><a class="postlink" href="http://www.webdeveloper.com/forum/archive/index.php/">http://www.webdeveloper.com/forum/archive/index.php/</a><!-- m -->" + document.systemSetup.numbodies.value
+ " onkeypress ='opener.trapTab'>";


I originally didn't use the 'onkeypress' trap, and it works fine without it unless someone hits the tab key. Then Mozilla quits with an error. However, the way it's coded now, Mozilla ignores the function call for trapTab. If I use 'opener.trapTab()' NOTICE the parentheses..., then the function DOES get called, but the keypress event doesn't seem to get passed to it -- at least not in a form that I can recognize. According to what I've read, the parentheses need to be left out of the call in order for the keyboard event to be passed. But apparently, when the html is embedded in javascript, the dynamic changes in ways I don't understand.

Has anybody else encountered anything like this?
 
Top