Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #14433 > unrolled thread

Problem with FF

Started by"Mel Smith" <med_cutout_syntel@aol.com>
First post2012-06-10 13:31 -0600
Last post2012-06-11 18:32 +0100
Articles 10 — 6 participants

Back to article view | Back to comp.lang.javascript


Contents

  Problem with FF "Mel Smith" <med_cutout_syntel@aol.com> - 2012-06-10 13:31 -0600
    Re: Problem with FF Andrew Poulos <ap_prog@hotmail.com> - 2012-06-11 08:45 +1000
      Re: Problem with FF "Mel Smith" <med_cutout_syntel@aol.com> - 2012-06-10 21:17 -0600
        Re: Problem with FF Gene Wirchenko <genew@ocis.net> - 2012-06-10 21:12 -0700
        Re: Problem with FF Martin Honnen <mahotrash@yahoo.de> - 2012-06-11 13:02 +0200
          Re: Problem with FF Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-06-11 13:28 +0200
            Re: Problem with FF Martin Honnen <mahotrash@yahoo.de> - 2012-06-11 15:11 +0200
              Re: Problem with FF "Mel Smith" <med_cutout_syntel@aol.com> - 2012-06-11 08:11 -0600
                Re: Problem with FF "Mel Smith" <med_cutout_syntel@aol.com> - 2012-06-11 08:33 -0600
      Re: Problem with FF Dr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid> - 2012-06-11 18:32 +0100

#14433 — Problem with FF

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2012-06-10 13:31 -0600
SubjectProblem with FF
Message-ID<a3kb0bFr9bU1@mid.individual.net>
Hi:

    I'm having a problem with FireFox in the code below. However, IE 7 and 
Chrome work properly.

    My code below is surely suspect :((

    Would someone suggest a correction so that FF, Chrome, and IE work in 
the same fashion:  i.e., operation returns to my password box with every 
keystroke except <cr> and <tab>

    I have commented the place where FF signals the error:   " e is 
undefined ", this error occurs every time I enter a character in my password 
text input box.

Thank you !

-- 
Mel Smith


************ Here's relevant code ************

function submitpwd() {

if (!e) var e = window.event ;

// for the next line, FF says:    'e is not defined'.  However,  IE and 
Chrome perform properly
var nkey = e.charCode ? e.charCode : e.keyCode ;

if ((nkey != 9) && (nkey != 13) ) {
   return true ;
   }
if(event.stopPropagation) {
   event.stopPropagation ;
   }
event.cancelBubble = true ;
/*
// I've tried with and without calling stopEvent(). There is no difference.
stopEvent(e) ;
*/

var pwdval = "" ;
var el = document.getElementById("ipwdfld") ;

pwdval = alltrim(el.value) ;

if (pwdval.length < 5) {
   window.alert("Password must 5 or 6 digits. Please Fix.") ;
   return false ;
   }

var pwd = document.getElementById("ipwd") ;
pwd.value = pwdval; // set it to the input value for server to access

var drawel = document.getElementById("idraw") ;
drawel.value = clubdraw ;

// fill in the hidden fields for the server
var pwddivel = document.getElementById("ipassword") ;
pwddivel.style.display = "none" ;
var msgel = document.getElementById("imessage") ;
msgel.style.display = "inline" ;
formel = document.getElementById("iformmenu") ;
formel.submit() ;
return true ;
}

function stopEvent(e) {
 if(!e) var e = window.event;

 //e.cancelBubble is supported by IE - this will kill the bubbling process.
 e.cancelBubble = true;
 e.returnValue = false;

 //e.stopPropagation works only in Firefox.
 if (e.stopPropagation) {
  e.stopPropagation();
  e.preventDefault();
 }
 return false;
}

****************   end of code ************** 

[toc] | [next] | [standalone]


#14436

FromAndrew Poulos <ap_prog@hotmail.com>
Date2012-06-11 08:45 +1000
Message-ID<RtidnaVa6vEWvkjSnZ2dnUVZ_jCdnZ2d@westnet.com.au>
In reply to#14433
On 11/06/2012 5:31 AM, Mel Smith wrote:
>      I'm having a problem with FireFox in the code below. However, IE 7 and
> Chrome work properly.
>
>      My code below is surely suspect :((
>
>      Would someone suggest a correction so that FF, Chrome, and IE work in
> the same fashion:  i.e., operation returns to my password box with every
> keystroke except <cr> and <tab>
>
>      I have commented the place where FF signals the error:   " e is
> undefined ", this error occurs every time I enter a character in my password
> text input box.

function submitpwd(e) {
-------------------^

Does adding an 'e' help?

Andrew Poulos

[toc] | [prev] | [next] | [standalone]


#14438

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2012-06-10 21:17 -0600
Message-ID<a3l6agFkvqU1@mid.individual.net>
In reply to#14436
Andrew said:

>
> function submitpwd(e) {
> -------------------^
>
> Does adding an 'e' help?


Andrew:

    No it doesn't.  I've had all sorts of variations -- with/without the 
'e', but still FF can't get past what it sees as an error.

    Also, below this note here is the 'calling' code for this function:

    I don't know if I should use a parameter to the submitpwd() function or 
not, or what I should use.

    I guess I just don't understand how FF works with 'events', and how it 
is different with IE (7 or 9) or Chrome ??

<div id="ipassword" >
Enter Drawmaster's<br />Password below<br />
<input type="password" id="ipwdfld" name="pwdfld"
  maxlength="6" size="6" value=""
  onkeypress="submitpwd();"/>
</div>

Thanks for your response !

(I'm going golfing with my sons tomorrow, and will re-visit this problem 
late tomorrow afternoon.)

-Mel Smith

*************  the 'calling' code ***************

<div id="ipassword" >
Enter Drawmaster's<br />Password below<br />
<input type="password" id="ipwdfld" name="pwdfld"
  maxlength="6" size="6" value=""
  onkeypress="submitpwd();"/>
</div>

[toc] | [prev] | [next] | [standalone]


#14440

FromGene Wirchenko <genew@ocis.net>
Date2012-06-10 21:12 -0700
Message-ID<jrrat7hksea46pj4p9fkd8rcj67khf1rd6@4ax.com>
In reply to#14438
On Sun, 10 Jun 2012 21:17:32 -0600, "Mel Smith"
<med_cutout_syntel@aol.com> wrote:

>Andrew said:
>
>>
>> function submitpwd(e) {
>> -------------------^
>>
>> Does adding an 'e' help?
>
>
>Andrew:
>
>    No it doesn't.  I've had all sorts of variations -- with/without the 
>'e', but still FF can't get past what it sees as an error.
>
>    Also, below this note here is the 'calling' code for this function:
>
>    I don't know if I should use a parameter to the submitpwd() function or 
>not, or what I should use.

     AFAIK, yes.  See below.

>    I guess I just don't understand how FF works with 'events', and how it 
>is different with IE (7 or 9) or Chrome ??

     Nor do I.  My code is for IE 9, and this is an error of
incompatibility which I am ignoring for the nonce.

><div id="ipassword" >
>Enter Drawmaster's<br />Password below<br />
><input type="password" id="ipwdfld" name="pwdfld"
>  maxlength="6" size="6" value=""
>  onkeypress="submitpwd();"/>
></div>
>
>Thanks for your response !
>
>(I'm going golfing with my sons tomorrow, and will re-visit this problem 
>late tomorrow afternoon.)
>
>-Mel Smith
>
>*************  the 'calling' code ***************
>
><div id="ipassword" >
>Enter Drawmaster's<br />Password below<br />
><input type="password" id="ipwdfld" name="pwdfld"
>  maxlength="6" size="6" value=""
>  onkeypress="submitpwd();"/>
                        ^^
></div>

     As well as a formal parameter for submitpwd(), you also have to
pass an event something.  (I do not know what it is called.  Object?
Event?)  I have code where I pass
          event
as a parameter.

     This is an area that I do not understand very well.  If someone
could explain my answer to me, I would appreciate it.

Sincerely,

Gene Wirchenko

[toc] | [prev] | [next] | [standalone]


#14450

FromMartin Honnen <mahotrash@yahoo.de>
Date2012-06-11 13:02 +0200
Message-ID<4fd5d041$0$9526$9b4e6d93@newsspool1.arcor-online.net>
In reply to#14438
Mel Smith wrote:

>      I guess I just don't understand how FF works with 'events', and how it
> is different with IE (7 or 9) or Chrome ??
>
> <div id="ipassword" >
> Enter Drawmaster's<br />Password below<br />
> <input type="password" id="ipwdfld" name="pwdfld"
>    maxlength="6" size="6" value=""
>    onkeypress="submitpwd();"/>
> </div>

Well inside the onkeypress attribute's event handler code Mozilla 
provides you with an "event" object (passed in as an argument) so you 
need e.g.

<input type="password" id="ipwdfld" name="pwdfld"
   maxlength="6" size="6" value=""
   onkeypress="return submitpwd(event);" />

then function

   function submitpwd(e) {
     e = e || window.event;
     ...
   }

In ancient times you would then have that function return true to allow 
the character and return false to suppress the character, these days you 
can additionally use methods (e.preventDefault(), Mozilla and other W3C 
DOM implementations) or properties (e.returnValue = false, IE before IE 
9) to do that.


-- 

	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

[toc] | [prev] | [next] | [standalone]


#14452

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-06-11 13:28 +0200
Message-ID<2134143.mvXUDI8C0e@PointedEars.de>
In reply to#14450
Martin Honnen wrote:

> Mel Smith wrote:
>>      I guess I just don't understand how FF works with 'events', and how
>>      it
>> is different with IE (7 or 9) or Chrome ??
>>
>> <div id="ipassword" >
>> Enter Drawmaster's<br />Password below<br />
>> <input type="password" id="ipwdfld" name="pwdfld"
>>    maxlength="6" size="6" value=""
>>    onkeypress="submitpwd();"/>
>> </div>
> 
> Well inside the onkeypress attribute's event handler code Mozilla
> provides you with an "event" object (passed in as an argument)

This appears to be ubiquitous among DOM-supporting browsers (down to 
Netscape 4.0), but I am not aware of a public standard or draft to specify 
it.  If anything, this feature should become part of the HTML5 Web 
Applications API.


PointedEars
-- 
Sometimes, what you learn is wrong. If those wrong ideas are close to the 
root of the knowledge tree you build on a particular subject, pruning the 
bad branches can sometimes cause the whole tree to collapse.
  -- Mike Duffy in cljs, <news:Xns9FB6521286DB8invalidcom@94.75.214.39>

[toc] | [prev] | [next] | [standalone]


#14453

FromMartin Honnen <mahotrash@yahoo.de>
Date2012-06-11 15:11 +0200
Message-ID<4fd5ee65$0$9514$9b4e6d93@newsspool1.arcor-online.net>
In reply to#14452
Thomas 'PointedEars' Lahn wrote:
> Martin Honnen wrote:
>
>> Mel Smith wrote:
>>>       I guess I just don't understand how FF works with 'events', and how
>>>       it
>>> is different with IE (7 or 9) or Chrome ??
>>>
>>> <div id="ipassword" >
>>> Enter Drawmaster's<br />Password below<br />
>>> <input type="password" id="ipwdfld" name="pwdfld"
>>>     maxlength="6" size="6" value=""
>>>     onkeypress="submitpwd();"/>
>>> </div>
>>
>> Well inside the onkeypress attribute's event handler code Mozilla
>> provides you with an "event" object (passed in as an argument)
>
> This appears to be ubiquitous among DOM-supporting browsers (down to
> Netscape 4.0), but I am not aware of a public standard or draft to specify
> it.  If anything, this feature should become part of the HTML5 Web
> Applications API.

I think 
http://www.w3.org/TR/html5/webappapis.html#event-handler-content-attributes 
attempts to covert this: "...

Using the script execution environment created above, create a function 
object (as defined in ECMAScript edition 5 section 13.2 Creating 
Function Objects), with:

Parameter list FormalParameterList

     ...
     Otherwise
         Let the function have a single argument called event.

..."





-- 

	Martin Honnen --- MVP Data Platform Development
	http://msmvps.com/blogs/martin_honnen/

[toc] | [prev] | [next] | [standalone]


#14458

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2012-06-11 08:11 -0600
Message-ID<a3mckdFb3nU1@mid.individual.net>
In reply to#14453
Martin said:

>>> Well inside the onkeypress attribute's event handler code Mozilla
>>> provides you with an "event" object (passed in as an argument)
>>
>> This appears to be ubiquitous among DOM-supporting browsers (down to
>> Netscape 4.0), but I am not aware of a public standard or draft to 
>> specify
>> it.  If anything, this feature should become part of the HTML5 Web
>> Applications API.
>
> I think 
> http://www.w3.org/TR/html5/webappapis.html#event-handler-content-attributes 
> attempts to covert this: "...
>
> Using the script execution environment created above, create a function 
> object (as defined in ECMAScript edition 5 section 13.2 Creating Function 
> Objects), with:
>
> Parameter list FormalParameterList
>
>     ...
>     Otherwise
>         Let the function have a single argument called event.
>
> ..."

Martin:

    I'll try that later today.

Thank you for the suggestion !

-Mel Smith

[toc] | [prev] | [next] | [standalone]


#14459

From"Mel Smith" <med_cutout_syntel@aol.com>
Date2012-06-11 08:33 -0600
Message-ID<a3mduoFlaeU1@mid.individual.net>
In reply to#14458
>>         Let the function have a single argument called event.
>>
>> ..."
>
> Martin:
>
>    I'll try that later today.


Martin:

    I tried it and it worked perfectly !!

Thank you very much !

-Mel Smith

(Now I can go golfing with nothing on my mind except trying to 'break 90' 
:))  )

[toc] | [prev] | [next] | [standalone]


#14463

FromDr J R Stockton <reply1224@merlyn.demon.co.uk.not.invalid>
Date2012-06-11 18:32 +0100
Message-ID<bRD5N6Fjui1PFwMA@invalid.uk.co.demon.merlyn.invalid>
In reply to#14436
In comp.lang.javascript message <RtidnaVa6vEWvkjSnZ2dnUVZ_jCdnZ2d@westne
t.com.au>, Mon, 11 Jun 2012 08:45:21, Andrew Poulos
<ap_prog@hotmail.com> posted:

>On 11/06/2012 5:31 AM, Mel Smith wrote:
>>      I'm having a problem with FireFox in the code below. However, IE 7 and
>> Chrome work properly.
>>
>>      My code below is surely suspect :((
>>
>>      Would someone suggest a correction so that FF, Chrome, and IE work in
>> the same fashion:  i.e., operation returns to my password box with every
>> keystroke except <cr> and <tab>
>>
>>      I have commented the place where FF signals the error:   " e is
>> undefined ", this error occurs every time I enter a character in my password
>> text input box.
>
>function submitpwd(e) {
>-------------------^
>
>Does adding an 'e' help?

I'd try removing the var too, in

        if (!e) var e = window.event ;

I use                   e = e || window.event
but would prefer        e ||= window.event      // <g>

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Website  <http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc. : <http://www.merlyn.demon.co.uk/programs/> - see in 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web