Help with 'this' keyword 
Author Message
 Help with 'this' keyword

From a JavaScript book... here is an example of how the keyword 'this'
should work...

but it doesn't work properly with IE5.0... The author says it should "dump
the content of the object named directions"... but the alert window
displays... "Here is the object" with nothing following...???

Is it something to do with the way IE5.0 handles 'this' ???

The code follows...

<HTML>
<HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
</HEAD>
<BODY>
<BR>
<FORM NAME="feedbackForm">
<BR>Enter any comments:

<TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the
object:\n' + this)">
This is default text.  You can type right over it,
add to it, cut it, paste it, or copy it.  Make a change
and then click somewhere else and see what happens.
</TEXTAREA>

</FORM>
</BODY>
</HTML>

thanks - Will



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
onChange='Here is the object:\n' + this.name

--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> From a JavaScript book... here is an example of how the keyword 'this'
> should work...

> but it doesn't work properly with IE5.0... The author says it should "dump
> the content of the object named directions"... but the alert window
> displays... "Here is the object" with nothing following...???

> Is it something to do with the way IE5.0 handles 'this' ???

> The code follows...

> <HTML>
> <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
> </HEAD>
> <BODY>
> <BR>
> <FORM NAME="feedbackForm">
> <BR>Enter any comments:

> <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the
> object:\n' + this)">
> This is default text.  You can type right over it,
> add to it, cut it, paste it, or copy it.  Make a change
> and then click somewhere else and see what happens.
> </TEXTAREA>

> </FORM>
> </BODY>
> </HTML>

> thanks - Will



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
Mark...

I added the "dot name' to the 'this' keyword... as you suggested... but the
popup window still does not show the "contents of the object" as the book
tells me it should...

The popup window displays...

Here is the object:
[object]

This example is from Emily A. Vander Veer's Java Script for Dummies 2nd
edition...  page 127.

Any more idea's?

Thanks for your help - Will



onChange='Here is the object:\n' + this.name

--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:
> From a JavaScript book... here is an example of how the keyword 'this'
> should work...

> but it doesn't work properly with IE5.0... The author says it should "dump
> the content of the object named directions"... but the alert window
> displays... "Here is the object" with nothing following...???

> Is it something to do with the way IE5.0 handles 'this' ???

> The code follows...

> <HTML>
> <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
> </HEAD>
> <BODY>
> <BR>
> <FORM NAME="feedbackForm">
> <BR>Enter any comments:

> <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is
the
> object:\n' + this)">
> This is default text.  You can type right over it,
> add to it, cut it, paste it, or copy it.  Make a change
> and then click somewhere else and see what happens.
> </TEXTAREA>

> </FORM>
> </BODY>
> </HTML>

> thanks - Will



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
Mark...

Update to my last note...

When I add the .name and then save the source... then look at the results in
IE5.0... the popup window shows...

Here is the object:
directions

The book said it should show...

Here is the object:
(textarea name="directions" value="This is default text. You can type right
over it.... bla bla "size=4" size=60 "onchange='alert("Here is the
object:\n" +this);'>

I hate it when this happens... any idea's?

Thanks again for your help - Will



onChange='Here is the object:\n' + this.name

--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:
> From a JavaScript book... here is an example of how the keyword 'this'
> should work...

> but it doesn't work properly with IE5.0... The author says it should "dump
> the content of the object named directions"... but the alert window
> displays... "Here is the object" with nothing following...???

> Is it something to do with the way IE5.0 handles 'this' ???

> The code follows...

> <HTML>
> <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
> </HEAD>
> <BODY>
> <BR>
> <FORM NAME="feedbackForm">
> <BR>Enter any comments:

> <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is
the
> object:\n' + this)">
> This is default text.  You can type right over it,
> add to it, cut it, paste it, or copy it.  Make a change
> and then click somewhere else and see what happens.
> </TEXTAREA>

> </FORM>
> </BODY>
> </HTML>

> thanks - Will



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword

(also attached)
<div onclick='alert(this.innerHTML)'><TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the object:\ntextarea Name=' + this.name + ' Rows=' +this.rows+ ' Cols=' +this.cols)">...</div>
--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Quote:

> Mark...

> Update to my last note...

> When I add the .name and then save the source... then look at the results in
> IE5.0... the popup window shows...

> Here is the object:
> directions

> The book said it should show...

> Here is the object:
> (textarea name="directions" value="This is default text. You can type right
> over it.... bla bla "size=4" size=60 "onchange='alert("Here is the
> object:\n" +this);'>

> I hate it when this happens... any idea's?

> Thanks again for your help - Will



> onChange='Here is the object:\n' + this.name

> --
> Mark L. Ferguson    Please reply in Newsgroup
> marfer's notes for OE 5 >
> http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


> > From a JavaScript book... here is an example of how the keyword 'this'
> > should work...

> > but it doesn't work properly with IE5.0... The author says it should "dump
> > the content of the object named directions"... but the alert window
> > displays... "Here is the object" with nothing following...???

> > Is it something to do with the way IE5.0 handles 'this' ???

> > The code follows...

> > <HTML>
> > <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
> > </HEAD>
> > <BODY>
> > <BR>
> > <FORM NAME="feedbackForm">
> > <BR>Enter any comments:

> > <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is
> the
> > object:\n' + this)">
> > This is default text.  You can type right over it,
> > add to it, cut it, paste it, or copy it.  Make a change
> > and then click somewhere else and see what happens.
> > </TEXTAREA>

> > </FORM>
> > </BODY>
> > </HTML>

> > thanks - Will

  this_example.htm
< 1K Download


Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword

Mark... your code worked.

Wonder why her code doesn't?

<TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the object:\n' + this)">

Maybe it is because I am using IE5.0 and she used Netscape for her illustrations in the book.

Any idea's?

thanks again for your assistance.

Will


  (also attached)
  <div onclick='alert(this.innerHTML)'><TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the object:\ntextarea Name=' + this.name + ' Rows=' +this.rows+ ' Cols=' +this.cols)">...</div>
  --
  Mark L. Ferguson    Please reply in Newsgroup
  marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

  > Mark...
  >
  > Update to my last note...
  >
  > When I add the .name and then save the source... then look at the results in
  > IE5.0... the popup window shows...
  >
  > Here is the object:
  > directions
  >
  > The book said it should show...
  >
  > Here is the object:
  > (textarea name="directions" value="This is default text. You can type right
  > over it.... bla bla "size=4" size=60 "onchange='alert("Here is the
  > object:\n" +this);'>
  >
  > I hate it when this happens... any idea's?
  >
  > Thanks again for your help - Will
  >


  > onChange='Here is the object:\n' + this.name
  >
  > --
  > Mark L. Ferguson    Please reply in Newsgroup
  > marfer's notes for OE 5 >
  > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


  > > From a JavaScript book... here is an example of how the keyword 'this'
  > > should work...
  > >
  > > but it doesn't work properly with IE5.0... The author says it should "dump
  > > the content of the object named directions"... but the alert window
  > > displays... "Here is the object" with nothing following...???
  > >
  > > Is it something to do with the way IE5.0 handles 'this' ???
  > >
  > > The code follows...
  > >
  > > <HTML>
  > > <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
  > > </HEAD>
  > > <BODY>
  > > <BR>
  > > <FORM NAME="feedbackForm">
  > > <BR>Enter any comments:
  > >
  > > <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is
  > the
  > > object:\n' + this)">
  > > This is default text.  You can type right over it,
  > > add to it, cut it, paste it, or copy it.  Make a change
  > > and then click somewhere else and see what happens.
  > > </TEXTAREA>
  > >
  > > </FORM>
  > > </BODY>
  > > </HTML>
  > >
  > > thanks - Will
  > >
  > >
  > >
  >
  >
  >



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
There is an ever widening gulf between IE and old NS. The pretence that they are trying to run together is purely cosmetic. Most people prepare two pages, and 'sniff' for the browser type.

if(document.all)
var IsIE=true;
else
IsIE = false;

if (document.layer)
var IsNS = true;
else
IsNS=false;

If(IsIE)
<mycode>
else if(IsNS)
<hercode>
else
<really crippled code>

--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm
Mark... your code worked.

Wonder why her code doesn't?

<TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the object:\n' + this)">

Maybe it is because I am using IE5.0 and she used Netscape for her illustrations in the book.

Any idea's?

thanks again for your assistance.

Will


  (also attached)
  <div onclick='alert(this.innerHTML)'><TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the object:\ntextarea Name=' + this.name + ' Rows=' +this.rows+ ' Cols=' +this.cols)">...</div>
  --
  Mark L. Ferguson    Please reply in Newsgroup
  marfer's notes for OE 5 > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

  > Mark...
  >
  > Update to my last note...
  >
  > When I add the .name and then save the source... then look at the results in
  > IE5.0... the popup window shows...
  >
  > Here is the object:
  > directions
  >
  > The book said it should show...
  >
  > Here is the object:
  > (textarea name="directions" value="This is default text. You can type right
  > over it.... bla bla "size=4" size=60 "onchange='alert("Here is the
  > object:\n" +this);'>
  >
  > I hate it when this happens... any idea's?
  >
  > Thanks again for your help - Will
  >


  > onChange='Here is the object:\n' + this.name
  >
  > --
  > Mark L. Ferguson    Please reply in Newsgroup
  > marfer's notes for OE 5 >
  > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


  > > From a JavaScript book... here is an example of how the keyword 'this'
  > > should work...
  > >
  > > but it doesn't work properly with IE5.0... The author says it should "dump
  > > the content of the object named directions"... but the alert window
  > > displays... "Here is the object" with nothing following...???
  > >
  > > Is it something to do with the way IE5.0 handles 'this' ???
  > >
  > > The code follows...
  > >
  > > <HTML>
  > > <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
  > > </HEAD>
  > > <BODY>
  > > <BR>
  > > <FORM NAME="feedbackForm">
  > > <BR>Enter any comments:
  > >
  > > <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is
  > the
  > > object:\n' + this)">
  > > This is default text.  You can type right over it,
  > > add to it, cut it, paste it, or copy it.  Make a change
  > > and then click somewhere else and see what happens.
  > > </TEXTAREA>
  > >
  > > </FORM>
  > > </BODY>
  > > </HTML>
  > >
  > > thanks - Will
  > >
  > >
  > >
  >
  >
  >



Tue, 12 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
Mark,

On programming to accommodate for two or more implementations of
html/JavaScript/etc...

What a burden on programmers... and definitely an additional hurdle for
producing a universal web product... not to mention the added expense of
trying to accommodate the different implementations of
html/JavaScript/etc...

Multiply the number of web pages times the extra time it takes for to think
of, implement and test the "extra step coding" to accommodate a 2nd
implementation of html/JavaScript/etc... and you got zillions of dollars...

And regardless of who one chooses to point the finger at (MS or NS or
whoever)... the extra programming time is real... the extra headaches are
real...  and the dollar cost are real...



There is an ever widening gulf between IE and old NS. The pretence that they
are trying to run together is purely cosmetic. Most people prepare two
pages, and 'sniff' for the browser type.

if(document.all)
var IsIE=true;
else
IsIE = false;

if (document.layer)
var IsNS = true;
else
IsNS=false;

If(IsIE)
<mycode>
else if(IsNS)
<hercode>
else
<really crippled code>

--
Mark L. Ferguson    Please reply in Newsgroup
marfer's notes for OE 5 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm

Mark... your code worked.

Wonder why her code doesn't?

<TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here is the
object:\n' + this)">

Maybe it is because I am using IE5.0 and she used Netscape for her
illustrations in the book.

Any idea's?

thanks again for your assistance.

Will



  (also attached)
  <div onclick='alert(this.innerHTML)'><TEXTAREA NAME="directions" ROWS="4"
COLS="60" onChange="alert('Here is the object:\ntextarea Name=' + this.name
+ ' Rows=' +this.rows+ ' Cols=' +this.cols)">...</div>
  --
  Mark L. Ferguson    Please reply in Newsgroup
  marfer's notes for OE 5 >
http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


  > Mark...
  >
  > Update to my last note...
  >
  > When I add the .name and then save the source... then look at the
results in
  > IE5.0... the popup window shows...
  >
  > Here is the object:
  > directions
  >
  > The book said it should show...
  >
  > Here is the object:
  > (textarea name="directions" value="This is default text. You can type
right
  > over it.... bla bla "size=4" size=60 "onchange='alert("Here is the
  > object:\n" +this);'>
  >
  > I hate it when this happens... any idea's?
  >
  > Thanks again for your help - Will
  >


  > onChange='Here is the object:\n' + this.name
  >
  > --
  > Mark L. Ferguson    Please reply in Newsgroup
  > marfer's notes for OE 5 >
  > http://www.geocities.com/SiliconValley/Bay/6386/IE_ng_notes.htm


  > > From a JavaScript book... here is an example of how the keyword 'this'
  > > should work...
  > >
  > > but it doesn't work properly with IE5.0... The author says it should
"dump
  > > the content of the object named directions"... but the alert window
  > > displays... "Here is the object" with nothing following...???
  > >
  > > Is it something to do with the way IE5.0 handles 'this' ???
  > >
  > > The code follows...
  > >
  > > <HTML>
  > > <HEAD><TITLE>Example of Multiple-Line Entry Field</TITLE>
  > > </HEAD>
  > > <BODY>
  > > <BR>
  > > <FORM NAME="feedbackForm">
  > > <BR>Enter any comments:
  > >
  > > <TEXTAREA NAME="directions" ROWS="4" COLS="60" onChange="alert('Here
is
  > the
  > > object:\n' + this)">
  > > This is default text.  You can type right over it,
  > > add to it, cut it, paste it, or copy it.  Make a change
  > > and then click somewhere else and see what happens.
  > > </TEXTAREA>
  > >
  > > </FORM>
  > > </BODY>
  > > </HTML>
  > >
  > > thanks - Will
  > >
  > >
  > >
  >
  >
  >



Sat, 16 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword


Quote:
> And regardless of who one chooses to point the finger at (MS or NS or
> whoever)... the extra programming time is real... the extra headaches are
> real...  and the dollar cost are real...

[Back from the dead (for a brief time at least)]

Hi,

Just wanted to assure you that -- at least from an ECMAScript perspective --
we are working with Netscape, HP, and IBM to make sure that both Microsoft's
and Netscape's implementations (JScript and JavaScript, respectively) are as
compatible as possible. We meet with them every month, and we are making
progress on Edition 4 of the ECMA standard. To be sure, it's very slow
progress, but it is progress nonetheless.

Peter -- see you at TechEd 2000 Florida / Amsterdam!

--
Peter J. Torr - Microsoft Windows Script Program Manager

Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!



Sun, 17 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword



Quote:


> > And regardless of who one chooses to point the finger at (MS or NS or
> > whoever)... the extra programming time is real... the extra headaches
are
> > real...  and the dollar cost are real...

> [Back from the dead (for a brief time at least)]

Oh dear and we thought are luck was really in... :-)

Quote:
> Hi,

> Just wanted to assure you that -- at least from an ECMAScript
perspective --
> we are working with Netscape, HP, and IBM to make sure that both
Microsoft's
> and Netscape's implementations (JScript and JavaScript, respectively) are
as
> compatible as possible.

What about Alcatel, Callscan, Compaq and Sun?  and why doesn't Jeff Dyer get
a seperate mention?

and why June 2001?

Jim.



Sun, 17 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword

Quote:
> Oh dear and we thought are luck was really in... :-)

Feel the love, baby. Bring it on!

Quote:
> What about Alcatel, Callscan, Compaq and Sun?

I don't know. Netscape, HP, and IBM are the only other companies that are
consistently represented at the meetings. I *think* (note to Wired: don't
quote me here) that Sun might, at some stage, have been part of the
committee, but they aren't any more.

Quote:
> and why doesn't Jeff Dyer get a seperate mention?

I don't know.

Quote:
> and why June 2001?

I don't know.

That's not true ;-). Designing a language by committee takes a long time.
Heck, designing a language full stop takes a long time. We're going as fast
as we (reasonably) can.

Although I can say you'll see *something* from us a long time before June
2001.

Peter, helpful as always.

--
Peter J. Torr - Microsoft Windows Script Program Manager

Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!



Mon, 18 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword



Quote:


> > What about Alcatel, Callscan, Compaq and Sun?

> I don't know. Netscape, HP, and IBM are the only other companies that are
> consistently represented at the meetings. I *think* (note to Wired: don't
> quote me here) that Sun might, at some stage, have been part of the
> committee, but they aren't any more.

ECMA still list them as members (and I'm pretty sure it's changed since the
original list.)

Quote:
> That's not true ;-). Designing a language by committee takes a long time.
> Heck, designing a language full stop takes a long time. We're going as
fast
> as we (reasonably) can.

Why not just meet twice a month, bring it forward 6 months that way... :-)

Quote:
> Although I can say you'll see *something* from us a long time before June
> 2001.

Hurrah, got a release date for ME yet (not that I want the O/S but I
understand IE5.5 arrives at the same time, not that I want the browser but I
understand JScript 5.5 arrives (properly, not a beta release)

Anyway classes would be nice...

Cheers,

Jim.



Mon, 18 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword

Quote:
> Hurrah, got a release date for ME yet (not that I want the O/S but I
> understand IE5.5 arrives at the same time, not that I want the browser but
I
> understand JScript 5.5 arrives (properly, not a beta release)

Nope. Can't give release dates. Sorry.

Although Millennium is much better than Windows 98, so everyone should
upgrade the day it comes out ;-)

Quote:
> Anyway classes would be nice...

Yeah, until you hit a whole bunch of really funky problems with them... :-)

Peter

--
Peter J. Torr - Microsoft Windows Script Program Manager

Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!



Mon, 18 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword
Peter...

Thanks for your note.

How can I find out more about TechEd 2000 Florida?

Best regards,

Will Standley



Quote:


> > And regardless of who one chooses to point the finger at (MS or NS or
> > whoever)... the extra programming time is real... the extra headaches
are
> > real...  and the dollar cost are real...

> [Back from the dead (for a brief time at least)]

> Hi,

> Just wanted to assure you that -- at least from an ECMAScript
perspective --
> we are working with Netscape, HP, and IBM to make sure that both
Microsoft's
> and Netscape's implementations (JScript and JavaScript, respectively) are
as
> compatible as possible. We meet with them every month, and we are making
> progress on Edition 4 of the ECMA standard. To be sure, it's very slow
> progress, but it is progress nonetheless.

> Peter -- see you at TechEd 2000 Florida / Amsterdam!

> --
> Peter J. Torr - Microsoft Windows Script Program Manager

> Please do not e-mail me with questions - post them to this
> newsgroup instead. Thankyou!



Tue, 19 Nov 2002 03:00:00 GMT  
 Help with 'this' keyword

Quote:
> Peter...

> Thanks for your note.

> How can I find out more about TechEd 2000 Florida?

Hi,

Since it starts next week, I think it's far too late to sign up, but just in
case, the web site is at:

http://msdn.microsoft.com/events/teched/

I will also be presenting at TechEd Amsterdam in July, if you are in
Europe...

Peter

--
Peter J. Torr - Microsoft Windows Script Program Manager

Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!



Tue, 19 Nov 2002 03:00:00 GMT  
 
 [ 16 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Using the 'LIKE' keyword

2. ByRef keyword doesn't work

3. HELP vbs capture of 'backspace'

4. Help with 'ps', how to print postscript centered on A3

5. Can't find Adobe's EPS help manual

6. help me to encapsulate '.js' file

7. Help with 'cannot use parens' error

8. Can''t paging - HELP !!!

9. i need help with 'wscript.run'

10. Help - VBScript runtime error '800a0005'

11. Run-time error '91' - HELP

12. HELP: illegal format character 'o'

 

 
Powered by phpBB® Forum Software