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


Groups > comp.lang.javascript > #19042

Re: Scope of search / reduce scope / about "this"

Message-ID <19780129.Cq2cY1Hk6d@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-03-28 18:33 +0100
Subject Re: Scope of search / reduce scope / about "this"
Newsgroups comp.lang.javascript
References <82de1eb3-5b51-4960-8b65-b43bbd5013b4@googlegroups.com> <17725500.x5YR6M0e2C@PointedEars.de>

Show all headers | View raw


Thomas 'PointedEars' Lahn wrote:

> thomas.lehmann@adtech.com wrote:
>>       </script>
>>     </table>
> 
> Not Valid.  The child element of a “table” element can only be a “thead”,
> “tbody”, “tfoot”, or “tr” element.

To be precise, other child elements are possible, like “colgroup”.  But 
definitely not “script” elements.

<http://www.w3.org/TR/1999/REC-html401-19991224/struct/tables.html#h-11.2.1>
<http://www.w3.org/TR/2012/CR-html5-20121217/tabular-data.html#the-table-
element>
 
> But if you already know the form the control is in, access the
> corresponding form object as you did, then use the form object's
> “elements” collection to access the form control:
> 
>   <body onload="setFocus(document.forms[…].elements["myControl"])" …>
> 
> or
> 
>   <… on…="setFocus(this.form.elements["myControl"])">

This is not Valid.  Valid possibilities are:

  <body onload="setFocus(document.forms[…].elements['myControl'])" …>

  <body onload='setFocus(document.forms[…].elements["myControl"])' …>

  <… on…="setFocus(this.form.elements['myControl'])">

  <… on…='setFocus(this.form.elements["myControl"])'>

An attribute value delimiter cannot be used as string literal delimiter 
within that attribute value, not even as ECMAScript escape sequence.  The 
only possibility to have that is to use character and character entity 
references in the script code, which will be resolved by the markup parser 
before they get to the script engine – e.g.,

  <… on…="setFocus(this.form.elements[&quot;myControl&quot;])">
 
– or move the offending code out of the attribute value.

-- 
PointedEars

Twitter: @PointedEars2
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Scope of search / reduce scope / about "this" thomas.lehmann@adtech.com - 2013-03-28 06:50 -0700
  Re: Scope of search / reduce scope / about "this" "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-28 15:29 +0100
  Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 18:13 +0100
    Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 18:33 +0100
  Re: Scope of search / reduce scope / about "this" Danny <dann90038@gmail.com> - 2013-03-28 12:37 -0700
    Re: Scope of search / reduce scope / about "this" Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-28 21:01 +0100
      HTML5 “autofocus” attribute (was: Scope of search / reduce scope / about "this") Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-29 23:27 +0100

csiph-web