Re: prompt not working



joemac wrote:

> Thomas 'PointedEars' Lahn wrote:
>> A) a) You are declaring an XHTML document type and serve it
>> correctly as application/xhtml+xml. Not at all wrong,
>> but it would explain points Ab) and B) below.
>
> Since there are no explicit declarations about document types in my
> code I infer from the above that XHTML must be the "default" document
> type. Is that correct?

No, it is not. The document type must be explicitly declared, you
should declare one of the HTML 4.01 document types. See the Spec.

>> b) document.write() does not work in XHTML 1.1 and later.
>> It also does not work in XHTML 1.0 yet, even though W3C
>> DOM Level 2 HTML says it should.
>>
>> B) You successfully commented out script content with the
>> empty declaration `<!-- ... -->'.
>
> The book that I am using says to use comment tags to enclose all script
> elements so as to prevent wrongful interpretation by browsers lacking
> the ability to process said javascript elements.

Your book (which?) is outdated.

There are no such browsers left that would still conform to Internet
standards. See RFC2854 and, of course, previous discussions on the
subject.

> Are you saying that there are some browsers that are capable of
> processing javascript but do know enough to overlook comment tags
> inside of script begin and end tags?

Probably. The HTML specification does not state it as a MUST or
SHOULD, and examples therein are not normative. In fact, in HTML
the `script' element's content is CDATA that is _not_ really
parsed. (The only parsing that MUST take place is looking for
the CDATA-ending ETAGO delimiter `</'.)

Furthermore, there is no reference material that states script
engines MUST ignore `<!--' at the beginning of script code. And
in XHTML, where an XML parser is used and the `script' element's
content is PCDATA by default, it is allowed to ignore commented
content by removing comments from source before building the
parse tree. (After all, they are only _comments_.)

>> C) 1. There is no global prompt() method in your UA, meaning
>> that either the Global Object is not the same object the
>> `window' reference points to or this host environment
>> method is not supported by your UA's Application Object
>> Model (AOM).
>
> What is "UA"?

([X]HTML) User Agent. Web browsers are the greatest subset.

>> 2. Therefore, a ReferenceError occurs and further expressions
>> are not evaluated.
>
> Is it possible to determine that this (ReferenceError) has occurred,

Yes, if the error reporting feature of your UA does not suffice,
you could use

try
{
// statements that may cause errors
}
catch (e)
{
alert(e.name + ": " + e.message);
}

provided it is supported (ECMAScript 3 compliant implementation).
Or use proprietary

onerror = function()
{
alert("Error!");
onerror = null;
return true;
}

> and why?

Only line-wise debugging can show this.

>> D) Script support is not present, i.e. either it is
>> disabled or not available in the first place.
>
> How would I go about determining this and correcting it if necessary?

Depends on the user agent.

>> <URL:http://jibbering.com/faq/#FAQ4_43>
>
> I examined the referenced article. I do not see any "little yellow
> triangle". In fact I see no triangle at all, of any color.

Which user agent(s) have you tested with?


PointedEars
.



Relevant Pages

  • Re: prompt not working
    ... > A) a) You are declaring an XHTML document type and serve it ... code I infer from the above that XHTML must be the "default" document ... The book that I am using says to use comment tags to enclose all script ... Is it possible to determine that this (ReferenceError) has occurred, ...
    (comp.lang.javascript)
  • Re: asp.net and XHTML
    ... >> this a script while attributes.add doesn't know what you are doing). ... >>> disable XHTML but it didn't work. ... In ASP.NET, if controls generate IDs, as occurs in the Repeater, ... you might not want ASP.NET controls to render ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: IE no doing "onload" function?
    ... don't think it's wrong for an xhtml element to be closed that way... ... HTML script element, while others would not be able ...
    (comp.lang.javascript)
  • Re: Setting dynamically the Greek charset in Firefox ?
    ... I just open the wizard script, ... visitors that use user agents with sufficient client-side script support ... This looks like XHTML, however IE still does not support XHTML, and the ... XHTML, as it is parsed by the Validator's XML parser, would be much easier ...
    (comp.lang.javascript)
  • Re: strange problem.... its probably me... but object expected..
    ... I didn't think it was XHTML... ... is best to avoid XHTML in favour of HTML ... if you intend to script the document. ... box will open when the syntax error happens and you will not miss it. ...
    (comp.lang.javascript)