javascript function not found onclick -- works fine in version 1.5, broken in 2.0

RESOLVED WORKSFORME

Status

()

Firefox
General
RESOLVED WORKSFORME
11 years ago
11 years ago

People

(Reporter: Leigh Power, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

11 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

<!-- 32989:2 -->
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>noname@domain.org - 04/18/2007 01:08:30 pm -0400 - iso-8859-1 - Open WebMail (+z)</TITLE>
<LINK rel="shortcut icon" href="/openwebmail/images/openwebmail.ico">
</HEAD>
<BODY BACKGROUND="/openwebmail/images/backgrounds/Globe.gif" BGCOLOR="#FFFFFF" 
ONHELP="window.open('/openwebmail/help/en/index.html', '_help'); return false;">
<style type="text/css">
<!--
body
{
    background-image: url(/openwebmail/images/backgrounds/Globe.gif);
    background-repeat: repeat;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 10pt;
}
th { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-weight: bold; background-color: #D3DCE3; }
td { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; }
td.msgbody { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; }
form { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; margin-bottom: 0; }
input.mono { font-family: monospace; font-size: 9pt; }
select.mono { font-family: monospace; font-size: 9pt; }
h1 { font-family: Arial, Helvetica, sans-serif; font-size: 16pt; font-weight: bold; }
A:link { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
A:visited { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
A:hover { font-family: Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: red; }
A.msgbody:link { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
A.msgbody:visited { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: blue; }
A.msgbody:hover { font-family:  Arial, Helvetica, sans-serif; font-size: 10pt; text-decoration: none; color: red; }
.medtext { font-size: 9pt; }
.smalltext { font-size: 8pt; }
.smallblacktext { font-size: 8pt; color: #000000; }
.smallcolortext { font-size: 8pt; color: #c00000; }
.hilighttext { font-style: normal; font-weight: bold; background-color: #DCDCDC; }
-->

</style>
<FONT FACE="Arial, Helvetica">
<form method="post" action="/cgi-bin/openwebmail/openwebmail-send.pl?action=composemessage&amp;sessionid=noname*user.domain.org-session-0.568392100316611&amp;sort=date&amp;keyword=&amp;searchtype=subject&amp;folder=INBOX&amp;page=1&amp;compose_caller=main" enctype="multipart/form-data" name="composeform">
<INPUT TYPE="hidden" NAME="action" VALUE="sendmessage">
<INPUT TYPE="hidden" NAME="compose_caller" VALUE="main">
<INPUT TYPE="hidden" NAME="composecharset" VALUE="iso-8859-1">
<INPUT TYPE="hidden" NAME="composetype" VALUE="continue">
<INPUT TYPE="hidden" NAME="deleteattfile" VALUE="">
<INPUT TYPE="hidden" NAME="folder" VALUE="INBOX">
<INPUT TYPE="hidden" NAME="inreplyto" VALUE="">
<INPUT TYPE="hidden" NAME="keyword" VALUE="">
<INPUT TYPE="hidden" NAME="page" VALUE="1">
<INPUT TYPE="hidden" NAME="references" VALUE="">
<INPUT TYPE="hidden" NAME="searchtype" VALUE="subject">
<INPUT TYPE="hidden" NAME="session_noupdate" VALUE="0">
<INPUT TYPE="hidden" NAME="sessionid" VALUE="noname*user.domain.org-session-0.568392100316611">
<INPUT TYPE="hidden" NAME="sort" VALUE="date">
<INPUT TYPE="hidden" NAME="mymessageid" VALUE="<20070418170830.M11248@domain.org>">
<INPUT TYPE="hidden" NAME="show_phonekbd" VALUE="0">

<table border="0" align="center" width="90%" cellpadding="1" cellspacing="1">
<tr><td colspan="2" bgcolor="#002266">
<font color="#FFFFFF" face="Arial, Helvetica" size="3">
<B>Compose Message</B></font>
</td></tr><tr><td colspan="2" bgcolor="#DCDCDC">
<table width="100%" cellspacing="0" cellpadding="0"><tr>
<td><a accesskey="B" href="/cgi-bin/openwebmail/openwebmail-main.pl?action=listmessages&amp;sessionid=noname*user.domain.org-session-0.568392100316611&amp;folder=INBOX&amp;page=1&amp;sort=date&amp;keyword=&amp;searchtype=subject" title="Back to Inbox"><IMG SRC="/openwebmail/images/iconsets/Default/backtofolder.gif" border="0" align="absmiddle" alt="Back to Inbox"></a>
&nbsp;
<a accesskey="R" href="javascript:document.composeform.addbutton.click();" title="Refresh"><IMG SRC="/openwebmail/images/iconsets/Default/refresh.gif" border="0" align="absmiddle" alt="Refresh"></a></td>
<td align="right">
<table border="0" cellpadding="0" cellspacing="0"><tr>
<td>Charset for composing: </td>
<td><select name="convto"  accesskey="I" onchange="javascript:bodygethtml(); return(sessioncheck() &amp;&amp; submit());">
<option selected="selected" value="none">iso-8859-1 *</option>
<option value="utf-8">iso-8859-1 &gt; utf-8</option>
<option value="windows-1252">iso-8859-1 &gt; windows-1252</option>
<option value="big5">big5</option>
<option value="euc-jp">euc-jp</option>
<option value="euc-kr">euc-kr</option>
<option value="gb2312">gb2312</option>
<option value="iso-2022-jp">iso-2022-jp</option>
<option value="iso-2022-kr">iso-2022-kr</option>
<option value="iso-8859-13">iso-8859-13</option>
<option value="iso-8859-2">iso-8859-2</option>
<option value="iso-8859-5">iso-8859-5</option>
<option value="iso-8859-6">iso-8859-6</option>
<option value="iso-8859-7">iso-8859-7</option>
<option value="iso-8859-8">iso-8859-8</option>
<option value="iso-8859-9">iso-8859-9</option>
<option value="koi8-r">koi8-r</option>
<option value="koi8-u">koi8-u</option>
<option value="ksc5601">ksc5601</option>
<option value="shift_jis">shift_jis</option>
<option value="tis-620">tis-620</option>
<option value="windows-1250">windows-1250</option>
<option value="windows-1251">windows-1251</option>
<option value="windows-1253">windows-1253</option>
<option value="windows-1254">windows-1254</option>
<option value="windows-1255">windows-1255</option>
<option value="windows-1256">windows-1256</option>
<option value="windows-1257">windows-1257</option>
</select>&nbsp;</td>
</tr></table>
</td>
</tr></table>
</td></tr><tr><td colspan="2">&nbsp;</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>From:</B>
</td><td bgcolor="#DDDDDD">
<table border="0" cellpadding="0" cellspacing="1"><tr>
<td><select name="from"  accesskey="F">
<option value="&quot;noname&quot; &lt;noname@user.domain.org&gt;">&quot;noname&quot; &lt;noname@user.domain.org&gt;</option>
<option value="account.webmaster@power.com">account.webmaster@power.com</option>
<option value="account.webmaster@domain.org">account.webmaster@domain.org</option>
<option value="hostmaster1@domain.org">hostmaster1@domain.org</option>
<option value="hostmaster1@domain.org">hostmaster1@domain.org</option>
<option value="hostmaster@domain.org">hostmaster@domain.org</option>
<option value="hostmaster@domain.org">hostmaster@domain.org</option>
<option selected="selected" value="&quot;noname Power&quot; &lt;noname@domain.org&gt;">&quot;noname Power&quot; &lt;noname@domain.org&gt;</option>
<option value="&quot;noname Power&quot; &lt;noname@domain.org&gt;">&quot;noname Power&quot; &lt;noname@domain.org&gt;</option>
<option value="lrpower@comcast.net">lrpower@comcast.net</option>
<option value="postmaster@power.com">postmaster@power.com</option>
<option value="surplus@domain.org">surplus@domain.org</option>
<option value="webmaster@power.com">webmaster@power.com</option>
</select>&nbsp;&nbsp;</td>
<td><B>Priority:</B></td>
<td><select name="priority" >
<option value="urgent">Urgent</option>
<option selected="selected" value="normal">Normal</option>
<option value="non-urgent">Non-Urgent</option>
</select></td>
</tr></table>
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>To:</B>
</td><td bgcolor="#DDDDDD">
<input type="text" name="to"  size="66" accesskey="T" />
 <a href="javascript:GoAddressWindow()" title="Address book"><IMG SRC="/openwebmail/images/iconsets/Default/addrbook.s.gif" border="0" align="absmiddle" alt="Address book"></a>
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>CC:</B>
</td><td bgcolor="#DDDDDD">
<input type="text" name="cc"  size="66" accesskey="C" />
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>BCC:</B>
</td><td bgcolor="#DDDDDD">
<input type="text" name="bcc" value="noname@domain.org" size="66" />
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>Reply-To:</B>
</td><td bgcolor="#DDDDDD">
<table border="0" cellpadding="0" cellspacing="0"><tr>
<td><input type="text" name="replyto"  size="45" accesskey="R" />&nbsp;&nbsp;</td>
<td><B>Confirm Reading</B></td>
<td><label><input type="checkbox" name="confirmreading" value="1" /></label></td>
</tr></table>
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>Attachment:</B>
</td><td bgcolor="#DDDDDD">
<input type="file" name="attachment"  size="45" accesskey="A" /><input type="submit" name="addbutton" value="Add" onclick="bodygethtml(); return sessioncheck();" />&nbsp;<INPUT TYPE="hidden" NAME="webdisksel" VALUE="">

 <a href="#" onClick="bodygethtml(); window.open('/cgi-bin/openwebmail/openwebmail-webdisk.pl?sessionid=noname*user.domain.org-session-0.568392100316611&amp;action=sel_addattachment', '_addatt','width=500,height=330,scrollbars=yes,resizable=yes,location=no'); return false;" title="WebDisk"><IMG SRC="/openwebmail/images/iconsets/Default/webdisk.s.gif" border="0" align="absmiddle" alt="WebDisk"></a>
</td></tr>
<tr><td align="right" bgcolor="#DDDDDD" nowrap>
<B>Subject:</B>
</td><td bgcolor="#DDDDDD">
<table border="0" cellpadding="0" cellspacing="0"><tr>
<td><input type="text" name="subject"  size="45" accesskey="S" />&nbsp;&nbsp;</td>
<td><B>Backup sent message</B></td>
<td><label><input type="checkbox" name="backupsentmsg" value="1" checked="checked" /></label></td>
</tr></table>
</td></tr>

<tr><td colspan="2" bgcolor="#EEEEEE" class=msgbody>
<table cellspacing="2" cellpadding="2" border="0"><tr><td align="center"><input type="submit" name="sendbutton" value="Send" accesskey="G" override="1" onclick="bodygethtml(); return (sessioncheck() &amp;&amp; sendcheck());" /></td>
<td align="center"><input type="submit" name="savedraftbutton" value="Save Draft" accesskey="W" override="1" onclick="bodygethtml(); return sessioncheck();" /></td>
<td nowrap align="center"><!--spellcheckstart-->
<table cellpadding="0" cellspacing="0"><tr><td><select name="dictionary2"  onchange="JavaScript:document.spellcheckform.dictionary.value=this.value;">
<option selected="selected" value="english">english</option>
<option value="american">american</option>
</select></td><td><input type="button"  name="spellcheckbutton" value="Spell Check" onclick="spellcheck(); return (sessioncheck() &amp;&amp; document.spellcheckform.submit());" override="1" title="aspell" /></td></tr></table><!--spellcheckend-->
</td>
<td align="center">
<!--newmsgformatstart-->
<table cellspacing="1" cellpadding="1" border="0"><tr><td nowrap align="right">&nbsp;MsgFormat</td><td><select name="newmsgformat"  onchange="return (sessioncheck() &amp;&amp; msgfmtchangeconfirm());">
<option selected="selected" value="text">Text</option>
<option value="html">HTML</option>
<option value="both">HTML and Text</option>
</select><INPUT TYPE="hidden" NAME="msgformat" VALUE="text">
</td></tr></table>
<!--newmsgformatend-->
</td>
<td align="center"><input type="button"  name="cancelbutton" value="Cancel" onclick="document.cancelform.submit();" override="1" /></td>
<td><!--kbdiconstart-->
<!--kbdiconend-->
</td>
</tr></table>

<table width="100%" cellspacing="1" cellpadding="0" border="0"><tr valign=top><td width="2"></td><td>
<textarea name="body"  rows="24" cols="78" accesskey="M" wrap="hard" id="body">
</textarea></td><td width="2"></td></tr></table>


</td></tr>

</form><!-- End of message composition form -->
<form method="post" action="/cgi-bin/openwebmail/openwebmail-spell.pl" enctype="multipart/form-data" target="_spellcheck" name="spellcheckform">
<INPUT TYPE="hidden" NAME="dictionary" VALUE="english">
<INPUT TYPE="hidden" NAME="field" VALUE="">
<INPUT TYPE="hidden" NAME="form" VALUE="">
<INPUT TYPE="hidden" NAME="htmlmode" VALUE="">
<INPUT TYPE="hidden" NAME="sessionid" VALUE="noname*user.domain.org-session-0.568392100316611">
<INPUT TYPE="hidden" NAME="string" VALUE="">

</form>
<form method="post" action="/cgi-bin/openwebmail/openwebmail-main.pl" enctype="multipart/form-data" name="cancelform">
<INPUT TYPE="hidden" NAME="action" VALUE="listmessages">
<INPUT TYPE="hidden" NAME="folder" VALUE="INBOX">
<INPUT TYPE="hidden" NAME="keyword" VALUE="">
<INPUT TYPE="hidden" NAME="page" VALUE="1">
<INPUT TYPE="hidden" NAME="searchtype" VALUE="subject">
<INPUT TYPE="hidden" NAME="sessionid" VALUE="noname*user.domain.org-session-0.568392100316611">
<INPUT TYPE="hidden" NAME="sort" VALUE="date">

</form>
</table>

<script language="JavaScript">
<!--
   if (self.document.composeform.to.value == "") {
      self.document.composeform.to.focus();
   } else {
      self.document.composeform.body.focus();
   }

   function OnLoadHandler()
   {
      document.composeform.to.focus();
   }

   function GoAddressWindow()
   {
      var url = "/cgi-bin/openwebmail/openwebmail-abook.pl?action=addrlistview&sessionid=noname*user.domain.org-session-0.568392100316611&abookkeyword=&abooksearchtype=&listviewmode=composeselect";

      url += "&to=" + escape (document.composeform.to.value);
      url += "&cc=" + escape (document.composeform.cc.value);
      url += "&bcc=" + escape (document.composeform.bcc.value);

      var hWnd = window.open(url,"_addressbook","width=600,height=400,resizable=yes,scrollbars=yes");
      if ((document.window != null) && (!hWnd.opener))
         hWnd.opener = document.window;
   }

   function DeleteAttFile(deleteattfile)
   {
      document.composeform.deleteattfile.value=deleteattfile;
      bodygethtml();
      document.composeform.submit();
   }

   function msgfmthelp()
   {
      alert("Sorry, IE 5.5+(Windows) or Mozilla 1.3+(all OS) is required for HTML composing support.");
   }

   function msgfmtchangeconfirm()
   {
      if ((document.composeform.msgformat.value == "html" ||
           document.composeform.msgformat.value == "both") &&
          document.composeform.newmsgformat.value == "text" ) {
         if (confirm("The HTML data format will be lost after the conversion, are you sure to change to Text mode?")) {
            bodygethtml();
            document.composeform.submit();
            return true;
         } else {
            document.composeform.newmsgformat.value = document.composeform.msgformat.value;
            return false;
         }
      }
      if (document.composeform.msgformat.value == "text" &&
          (document.composeform.newmsgformat.value == "html" ||
           document.composeform.newmsgformat.value == "both") ) {
         document.composeform.submit();
         return true;
      }
      // else always follow new format but no need to submit to CGI
      document.composeform.msgformat.value = document.composeform.newmsgformat.value;
      return true;
   }

   function bodygethtml()
   {
      if (document.composeform.msgformat.value == "html" ||
          document.composeform.msgformat.value == "both") {
         document.composeform.body.value = editor.getHTML();
      }
   }

   function bodysethtml()
   {
      if (document.composeform.msgformat.value == "html" ||
          document.composeform.msgformat.value == "both") {
         editor.setHTML(document.composeform.body.value);
      }
   }

   function spellcheck()
   {
      bodygethtml();
      document.spellcheckform.sessionid.value = document.composeform.sessionid.value;
      document.spellcheckform.form.value = "composeform";
      document.spellcheckform.field.value = "body";
      document.spellcheckform.string.value = document.composeform.body.value;
      window.open('','_spellcheck','width=600,height=400,top=40,left=80,scrollbars=yes,resizable=yes,location=no');
      return true;
   }

   function sendcheck()
   {
      if (document.composeform.to.value == ""
       && document.composeform.cc.value == ""
       && document.composeform.bcc.value == "" ) {
         alert("Please specify the receiver before sending.");
         return false;
      }
      if (document.composeform.subject.value == "" 
       || document.composeform.subject.value == "N/A" ) {
         return(confirm("This message has no subject, do you still want to send it?"));
      }
      return true;
   }
//-->
</script>
<script language="JavaScript">
<!--
   // alert before session end
   var remainingseconds=85752;
   var url = "/cgi-bin/openwebmail/openwebmail-prefs.pl?action=timeoutwarning&sessionid=noname*user.domain.org-session-0.568392100316611&session_noupdate=1";
   var tid;
   var hWnd;
   var warn=0;

   function timeoutcheck () {
      remainingseconds=remainingseconds-1;
      if (remainingseconds>0) {
         tid=setTimeout("timeoutcheck()", 1*1000);
         if (remainingseconds<65) {
            if (remainingseconds>6) {
               window.defaultStatus="session time : "+ (remainingseconds-5) +" seconds left";
            } else if (remainingseconds>=5) {
               window.defaultStatus="session time : "+ (remainingseconds-5) +" second left";
            }
            if (!warn) {
               warn=1;
               document.composeform.session_noupdate.value=1;document.composeform.savedraftbutton.click();
               hWnd = window.open(url,"_timeoutwarning","width=400,height=140,resizable=no,scrollbars=no");
               hWnd.focus();
            }
         }
      } else {
         window.defaultStatus="session timeout";
         clearTimeout(tid);
      }
   }

   function sessioncheck () {
      if (remainingseconds>0) {
         return true;
      } else {
         alert("Sorry, your session is timeouted, please login again.");
         return false;
      }
   }

   timeoutcheck();
//-->
</script>
<p align="center">
<br>
<a href="/openwebmail/openwebmail.html" target="_blank">Open WebMail</a>
version 2.51
&nbsp;
<a accesskey="H" href="/openwebmail/help/en/index.html" target="_help">Help?</a>

<br>
</p>
</BODY></HTML>


Reproducible: Always

Steps to Reproduce:
1. load attached html file into browser
2. click on "Spell Check" button
3. a pop-up should appear -- firebug says can't find function spellcheck()
   -- works fine in version 1.5
Actual Results:  
no pop-up -- firebug says can't find function spellcheck()

Expected Results:  
popup should appear for spell checking -- contents and it's url not relevant to test
I think your javascript has to be in the head, not the body.
Created attachment 261983 [details]
Example (Not minimal) from comment 0
Also, this html doesn't validate.
http://validator.w3.org/check?uri=https%3A%2F%2Fbugzilla.mozilla.org%2Fattachment.cgi%3Fid%3D261983

Comment 4

11 years ago
That is because the function name "spellcheck" collides with the input element's property "spellcheck" (new in Firefox 2). The input object is in front of the window object in the onclick handler's scope chain. Thus you're basically trying to call this.spellcheck() but that property is a boolean, not a function, just what the error message says.

Btw, please don't copy & paste HTML containing script to or from Bugzilla, it introduces line breaks in string constants that need to be fixed manually.
(Reporter)

Comment 5

11 years ago
Seno.Aiko -- thanks so much for your rapid response.  I change the name
of the javascript function and this page is working again under firefox 2.0.
Open source is great!!

Based on this information, I'm change status to WORKSFORME with change
to function name.

Sorry about the HTML paste -- I'll do better next time.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.