473,548 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Buttons on Frames in JavaScript

I am working with 2 frames, Left and Right and the main code is in the
left frame, which has been attached.

Can someone please help me with this code. I am new to JavaScript and
can't figure it out.

What needs to happen is this:

On the left frame you should have a series of buttons, which when pushed
makes things happen on the right frame.
1) Prompt the user to enter back ground color, text color, link colors,
title and some lines of text.
2) A button which when pushed shows text, back ground color etc. on the
RIGHT frame...not the LEFT frame.
3) A Script/Prompt box on the left frame, which when the user types in
"What is background Color", say user types in Blue and pushes
submit...it changes the background color to be blue on the RIght frame
and not the left...

What I have done so far, is create buttons to change background color
but it changes it in the LEFT frame and not the RIGHT frame...So my
question is How do I get the buttons and text information to appear on
the Right frame, but created in the left frame.

Confusing isn't it...Is there anyone out there who could help me pretty
promptly???

Thanks so much....
<HTML>
<HEAD>

<TITLE>Exerci se Left8-2 - LEFT FRAME PAGE with Document Object</TITLE>

<H3>This is the left document of Exercise 8-2</H3>

<SCRIPT LANGUAGE="JavaS cript"

function checkField (field) {
if (field.value == "") {
window.alert("P lease enter a Back ground Color");
field.focus ();
}
}
</Script>
<BODY>
<SCRIPT LANGUAGE="JavaS cript">

var username = window.prompt(" Welcome to Exercise 8-2",
"Enter your name here");
window.prompt(" Welcome to Exercise 8-2");
document.write( username - + "Welcome to Exercise 8-2");

</SCRIPT>
<H1 Align=center> <Font Face=Arial Color=Green> Exercise 8-2 -
JavaScript Buttons </Font></H1>
<Center>
<Font Face=Arial Size=3 Color=Green>

<FORM NAME="FrmMyForm " action="Right8-2.html">
Enter a Back Ground Color:
<INPUT TYPE="text" Name="MyField" onBlur-"checkField(thi s)")
<INPUT TYPE="Submit">
<INPUT TYPE="button" VALUE="Change Back Ground Color" NAME="MyField"
onClick="docume nt.bgColor='blu e' ">
<INPUT type="button" value="Change to Red!" name="redbutton "
onClick="docume nt.bgColor='red '"> <br>

<INPUT type="button" value="Change to Yellow!" name="yellowbut ton"
onClick="docume nt.bgColor='yel low'"> <br>

<INPUT type="button" VALUE="Change to Blue!" NAME="Bluebutto n"
onClick="docume nt.bgColor='blu e'"><BR>

<INPUT TYPE="button" NAME="buttonPri nt" VALUE="Print"
onClick="window .print()">
<INPUT type="button" value="Go to the Right Page" name="rightbutt on"
onClick="window .location="Righ t8-2.html">

</FORM>
</BODY>

</HTML>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #1
7 1965
Ron
Heya Trvl,
There were quite a few errors in both HTML and javascript. Note that
frames are no longer supported in XHTML, so you may as well get used to
coding without them. The object element in combination with simple
javascript allows similar functionality. Instead of a frameset document,
you should have this:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Untitled </title>
<!--All the lines above are required for XHTML documents that use
intrinsic javascript events. Copy
them to a file you can use for a template; don't bother memorizing
it. The template should end with
</head><body></body></html>. These are all required elements.-->
<style type="text/css">
#left {
float:left;
}
#right {
float:right;
}
</style>
<!--The language attribute is deprecated in favor of MIME type-->
<script type="text/javascript">
var rightDoc = null;

function getUserName() {
var username = window.prompt(" Welcome to Exercise 8-2", "Enter
your name here");
var rightText = rightDoc.create TextNode(userna me + "Welcome to
Exercise 8-2");
rightDoc.body.a ppendChild(righ tText);
rightDoc.body.n ormalize();
/* In almost all cases, it is bad form to use document.write( )
unless one knows exactly what they are doing.
This function was moved here because it needs to run after the
right frame has finished loading. You'll
notice with javascript that if you call elements before they have
been loaded, they will always be null.
Learn more about the standard methods above at
http://www.w3.org/TR/DOM-Level-3-Core .
Note that as of this date, no browsers implement properties and
methods introduced in Level 3 Core. */
}

function setRightDoc() {
rightDoc = document.getEle mentById('right ').contentDocum ent;
}
</script>
</head>
<body onload="setRigh tDoc();getUserN ame()">
<object id="left" data="Left8-2.xhtml"
type="applicati on/xhtml+xml" height="600" width="50%"></object>
<object id="right" data="Right8-2.xhtml"
type="applicati on/xhtml+xml" height="600" width="50%"></object>
</body>
</html>

Note how all tag names and attributes are in lower-case, and all tags
are closed. Now you'll want to modify Left8-2.xhtml to be the following:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Exerci se Left8-2 - LEFT FRAME PAGE with Document
Object </title>
<script type="text/javascript">
function checkField(fiel d) {
if (field.value == "") {
window.alert("P lease enter a Back ground Color");
field.focus ();
}
}

function changeRightTo(v alue) {
var rightDoc =
parent.document .getElementById ("right").conte ntDocument;
if(document.imp lementation.has Feature("CSS2", "2.0")) {
rightDoc.body.s tyle.setPropert y("background-color", value,
"important" );
}
}
</script>
<style type="text/css">
h2 {
text-align:center;
font-family:Arial, sans-serif;
color:green;
}
.my-form {
text-align:center;
font-family:Arial, sans-serif;
font-size:small;
color:green;
}
</style>

<!--All tags must be closed. Empty tags can be closed by adding a
slash before the closing '>' of the tag-->
</head>
<body>

<!-- Headings are structural, not aesthetic. If you don't like the
heading style, use stylesheets, but
never put heading numbers out of order simply for aesthetic reasons-->
<h1>This is the left document of Exercise 8-2</h1>

<!--The font element is no longer supported. Use stylesheets to
effect document aesthetics-->
<h2>Exercise 8-2 -JavaScript Buttons</h2>

<!--The center element is no longer supported. Use stylesheets for
aesthetic positioning.-->
<!--For most top-level elements, the functionality of name has been
replaced with id. Form components must still use
name to be successful.-->
<form id="FrmMyForm" action="Right8-2.html" class="my-form">

<!--It is good form to use label/control structure instead of having
controls in a sea of unrelated text.-->
<label for="MyField">E nter a Back Ground Color:</label>
<input type="text" name="MyField" id="MyField"
onblur="checkFi eld(this)" />

<!--The button element allows greater flexibility than the input
element of type button-->
<button type="button" name="Userbutto n"
onclick="change RightTo(documen t.getElementByI d('MyField').va lue)">
Change Back Ground Color
</button>
<button type="button" value="red" name="redbutton "
onclick="change RightTo(this.va lue)">
Change to Red!
</button>
<br />
<button type="button" value="yellow" name="yellowbut ton"
onclick="change RightTo(this.va lue)">
Change to Yellow!
</button>
<br />
<button type="button" name="buttonPri nt"
onclick="window .print()">Print </button>
<button type="button" name="rightbutt on"
onclick="window .location='Righ t8-2.html'">
Go to the Right Page
</button>
</form>
</body>
</html>

The Right8-2.xhtml file is just an empty XHTML document:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Exerci se Right8-2 - RIGHT FRAME PAGE with Document
Object</title>
</head>
<body>
</body>
</html>

You should be able to work from here. Learn more about the current XHTML
standard at http://www.w3.org/TR/xhtml11 .
Jul 23 '05 #2
On Thu, 06 May 2004 02:47:09 GMT, Ron <we*******@slid er142.com> wrote:
There were quite a few errors in both HTML and javascript. Note that
frames are no longer supported in XHTML, so you may as well get used to
coding without them.
I was lead to believe that IE is incapable of handling XHTML properly. All
it ends up doing is switching into quirks mode and "error-correcting" it
to HTML. Specifying the content type as text/html isn't much better as
normal HTML will do just as well without the conversion. Is it really
worthwhile? For now, it seems much more sensible to use Strict HTML. Any
browser from the NN4 generation onwards can handle that.

[snip]
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
Unless your server sends the content type, you should append the character
set:

content="applic ation/xhtml+xml; charset=xxx"

[snip]
Learn more about the standard methods above at
http://www.w3.org/TR/DOM-Level-3-Core .
Note that as of this date, no browsers implement properties and
methods introduced in Level 3 Core. */
I question the point of that. If DOM 3 Core isn't implemented, why learn
it? It would make more sense to learn DOM 1 or 2 Core and HTML, followed
by DOM 2 Events and Style, coupled with Microsoft's event model (isn't
browser scripting fun :).
function setRightDoc() {
rightDoc = document.getEle mentById('right ').contentDocum ent;
You should certainly be demonstrating, or at least mentioning, feature
detection (see FAQ) with DOM methods and properties. Though it would be
nice to ignore older browsers, you shouldn't.

[snip]
if(document.imp lementation.has Feature("CSS2", "2.0")) {
You are aware that most browsers won't return true, but will support the
objects below, yes? The only browser that I have that will pass this test
is Mozilla 1.8a[1], yet both IE and Opera will allow the alteration of the
background-color CSS property through script.
rightDoc.body.s tyle.setPropert y("background-color", value,
"important" );
[snip]
You should be able to work from here. Learn more about the current XHTML
standard at http://www.w3.org/TR/xhtml11 .


Again, I'd recommend starting with Strict HTML[2] and CSS:

HTML 4.01 Specification (don't use deprecated elements or attributes)
<URL:http://www.w3.org/TR/html4/>

CSS 2
<URL:http://www.w3.org/TR/REC-CSS2/>

It should be noted that IE doesn't support some elements of CSS 2 very
well.

Mike
[1] It should be noted that Mozilla's claims should be taken with a pinch
of salt. Though it may support the various properties and methods, its
implementations do not always follow specification.
[2] I feel that it should be learnt first as it's the cornerstone of
well-formed XHTML.

--
Michael Winter
M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 23 '05 #3
Ron
Michael Winter wrote:
I was lead to believe that IE is incapable of handling XHTML properly.
All it ends up doing is switching into quirks mode and
"error-correcting" it to HTML. Specifying the content type as
text/html isn't much better as normal HTML will do just as well
without the conversion. Is it really worthwhile? For now, it seems
much more sensible to use Strict HTML. Any browser from the NN4
generation onwards can handle that.

[snip]
Heya Michael,
IE6 renders XHTML documents with embedded objects fine on my end, as
long as one uses the compatibility tips for XHTML. :) Documents
identified as XHTML are rendered more efficiently than HTML in newer
browsers, and it is a simpler language which is in the process of
incorporating other XML applications, so I tend to encourage its use.
Unless your server sends the content type, you should append the
character set:

content="applic ation/xhtml+xml; charset=xxx"

[snip]
I would add this, but I have no way of knowing what character encoding
the reader is using.
I question the point of that. If DOM 3 Core isn't implemented, why
learn it? It would make more sense to learn DOM 1 or 2 Core and HTML,
followed by DOM 2 Events and Style, coupled with Microsoft's event
model (isn't browser scripting fun :).
I wouldn't suggest "learning" any of the DOMs. :) I provide the link as
a reference document, and as such, providing the most up-to-date version
makes sense, as long as the reader doesn't expect browsers to use DOM 3
properties and methods as of this date. It extends the useful life of
this thread a little. :)
You should certainly be demonstrating, or at least mentioning, feature
detection (see FAQ) with DOM methods and properties. Though it would
be nice to ignore older browsers, you shouldn't.

[snip]


Hehe. Some things do get judgement calls though. If the browser cannot
access the content document of the frame, then the entire function of
the main document is not just useless, but meaningless as well. A
feature detection here would possibly be useful as a debug to the
author, but wouldn't provide any useful *alternate* information to a
client other than "You can't use this page.".
if(document.imp lementation.has Feature("CSS2", "2.0")) {

You are aware that most browsers won't return true, but will support
the objects below, yes? The only browser that I have that will pass
this test is Mozilla 1.8a[1], yet both IE and Opera will allow the
alteration of the background-color CSS property through script.


Firefox and Mozilla 1.7b pass the test fine. Unfortunately, Opera
doesn't support script elements in XHTML (strange, they say it will be
fixed in the next version), and IE doesn't even load the objects
properly, so this is moot for them.
You should be able to work from here. Learn more about the current
XHTML standard at http://www.w3.org/TR/xhtml11 .

Again, I'd recommend starting with Strict HTML[2] and CSS:

HTML 4.01 Specification (don't use deprecated elements or attributes)
<URL:http://www.w3.org/TR/html4/>

CSS 2
<URL:http://www.w3.org/TR/REC-CSS2/>

It should be noted that IE doesn't support some elements of CSS 2 very
well.

Mike

IE doesn't support a lot of elements of CSS2 very well. :D I guess I
should try to be more friendly to IE user agents. :) For the thread
starter, you'll want to keep
http://msdn.microsoft.com/library/de...node_entry.asp
to reference IE-specific properties and methods and
http://www.mozilla.org/docs/dom/domref/ as a reference to those specific
to Gecko-based browsers.
Jul 23 '05 #4
Ok Thanks Ron, I'll give this a try. If I can't get it to work...I'll let you know..
Thanks Again

Ron <we*******@slid er142.com> wrote in message news:<NG******* *************** *@news4.srv.hcv lny.cv.net>...
Heya Trvl,
There were quite a few errors in both HTML and javascript. Note that
frames are no longer supported in XHTML, so you may as well get used to
coding without them. The object element in combination with simple
javascript allows similar functionality. Instead of a frameset document,
you should have this:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Untitled </title>
<!--All the lines above are required for XHTML documents that use
intrinsic javascript events. Copy
them to a file you can use for a template; don't bother memorizing
it. The template should end with
</head><body></body></html>. These are all required elements.-->
<style type="text/css">
#left {
float:left;
}
#right {
float:right;
}
</style>
<!--The language attribute is deprecated in favor of MIME type-->
<script type="text/javascript">
var rightDoc = null;

function getUserName() {
var username = window.prompt(" Welcome to Exercise 8-2", "Enter
your name here");
var rightText = rightDoc.create TextNode(userna me + "Welcome to
Exercise 8-2");
rightDoc.body.a ppendChild(righ tText);
rightDoc.body.n ormalize();
/* In almost all cases, it is bad form to use document.write( )
unless one knows exactly what they are doing.
This function was moved here because it needs to run after the
right frame has finished loading. You'll
notice with javascript that if you call elements before they have
been loaded, they will always be null.
Learn more about the standard methods above at
http://www.w3.org/TR/DOM-Level-3-Core .
Note that as of this date, no browsers implement properties and
methods introduced in Level 3 Core. */
}

function setRightDoc() {
rightDoc = document.getEle mentById('right ').contentDocum ent;
}
</script>
</head>
<body onload="setRigh tDoc();getUserN ame()">
<object id="left" data="Left8-2.xhtml"
type="applicati on/xhtml+xml" height="600" width="50%"></object>
<object id="right" data="Right8-2.xhtml"
type="applicati on/xhtml+xml" height="600" width="50%"></object>
</body>
</html>

Note how all tag names and attributes are in lower-case, and all tags
are closed. Now you'll want to modify Left8-2.xhtml to be the following:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Exerci se Left8-2 - LEFT FRAME PAGE with Document
Object </title>
<script type="text/javascript">
function checkField(fiel d) {
if (field.value == "") {
window.alert("P lease enter a Back ground Color");
field.focus ();
}
}

function changeRightTo(v alue) {
var rightDoc =
parent.document .getElementById ("right").conte ntDocument;
if(document.imp lementation.has Feature("CSS2", "2.0")) {
rightDoc.body.s tyle.setPropert y("background-color", value,
"important" );
}
}
</script>
<style type="text/css">
h2 {
text-align:center;
font-family:Arial, sans-serif;
color:green;
}
.my-form {
text-align:center;
font-family:Arial, sans-serif;
font-size:small;
color:green;
}
</style>

<!--All tags must be closed. Empty tags can be closed by adding a
slash before the closing '>' of the tag-->
</head>
<body>

<!-- Headings are structural, not aesthetic. If you don't like the
heading style, use stylesheets, but
never put heading numbers out of order simply for aesthetic reasons-->
<h1>This is the left document of Exercise 8-2</h1>

<!--The font element is no longer supported. Use stylesheets to
effect document aesthetics-->
<h2>Exercise 8-2 -JavaScript Buttons</h2>

<!--The center element is no longer supported. Use stylesheets for
aesthetic positioning.-->
<!--For most top-level elements, the functionality of name has been
replaced with id. Form components must still use
name to be successful.-->
<form id="FrmMyForm" action="Right8-2.html" class="my-form">

<!--It is good form to use label/control structure instead of having
controls in a sea of unrelated text.-->
<label for="MyField">E nter a Back Ground Color:</label>
<input type="text" name="MyField" id="MyField"
onblur="checkFi eld(this)" />

<!--The button element allows greater flexibility than the input
element of type button-->
<button type="button" name="Userbutto n"
onclick="change RightTo(documen t.getElementByI d('MyField').va lue)">
Change Back Ground Color
</button>
<button type="button" value="red" name="redbutton "
onclick="change RightTo(this.va lue)">
Change to Red!
</button>
<br />
<button type="button" value="yellow" name="yellowbut ton"
onclick="change RightTo(this.va lue)">
Change to Yellow!
</button>
<br />
<button type="button" name="buttonPri nt"
onclick="window .print()">Print </button>
<button type="button" name="rightbutt on"
onclick="window .location='Righ t8-2.html'">
Go to the Right Page
</button>
</form>
</body>
</html>

The Right8-2.xhtml file is just an empty XHTML document:

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<title>Exerci se Right8-2 - RIGHT FRAME PAGE with Document
Object</title>
</head>
<body>
</body>
</html>

You should be able to work from here. Learn more about the current XHTML
standard at http://www.w3.org/TR/xhtml11 .

Jul 23 '05 #5
Thank you Michael and Ron for your posts. I will give your suggestions
a try and see what happens. If it works - wonderful, if not I'll be
back.

Thanks again.

Ron <we*******@slid er142.com> wrote in message news:<qh******* *************** *@news4.srv.hcv lny.cv.net>...
Michael Winter wrote:
I was lead to believe that IE is incapable of handling XHTML properly.
All it ends up doing is switching into quirks mode and
"error-correcting" it to HTML. Specifying the content type as
text/html isn't much better as normal HTML will do just as well
without the conversion. Is it really worthwhile? For now, it seems
much more sensible to use Strict HTML. Any browser from the NN4
generation onwards can handle that.

[snip]


Heya Michael,
IE6 renders XHTML documents with embedded objects fine on my end, as
long as one uses the compatibility tips for XHTML. :) Documents
identified as XHTML are rendered more efficiently than HTML in newer
browsers, and it is a simpler language which is in the process of
incorporating other XML applications, so I tend to encourage its use.
Unless your server sends the content type, you should append the
character set:

content="applic ation/xhtml+xml; charset=xxx"

[snip]


I would add this, but I have no way of knowing what character encoding
the reader is using.
I question the point of that. If DOM 3 Core isn't implemented, why
learn it? It would make more sense to learn DOM 1 or 2 Core and HTML,
followed by DOM 2 Events and Style, coupled with Microsoft's event
model (isn't browser scripting fun :).


I wouldn't suggest "learning" any of the DOMs. :) I provide the link as
a reference document, and as such, providing the most up-to-date version
makes sense, as long as the reader doesn't expect browsers to use DOM 3
properties and methods as of this date. It extends the useful life of
this thread a little. :)
You should certainly be demonstrating, or at least mentioning, feature
detection (see FAQ) with DOM methods and properties. Though it would
be nice to ignore older browsers, you shouldn't.

[snip]


Hehe. Some things do get judgement calls though. If the browser cannot
access the content document of the frame, then the entire function of
the main document is not just useless, but meaningless as well. A
feature detection here would possibly be useful as a debug to the
author, but wouldn't provide any useful *alternate* information to a
client other than "You can't use this page.".
if(document.imp lementation.has Feature("CSS2", "2.0")) {

You are aware that most browsers won't return true, but will support
the objects below, yes? The only browser that I have that will pass
this test is Mozilla 1.8a[1], yet both IE and Opera will allow the
alteration of the background-color CSS property through script.


Firefox and Mozilla 1.7b pass the test fine. Unfortunately, Opera
doesn't support script elements in XHTML (strange, they say it will be
fixed in the next version), and IE doesn't even load the objects
properly, so this is moot for them.
You should be able to work from here. Learn more about the current
XHTML standard at http://www.w3.org/TR/xhtml11 .

Again, I'd recommend starting with Strict HTML[2] and CSS:

HTML 4.01 Specification (don't use deprecated elements or attributes)
<URL:http://www.w3.org/TR/html4/>

CSS 2
<URL:http://www.w3.org/TR/REC-CSS2/>

It should be noted that IE doesn't support some elements of CSS 2 very
well.

Mike

IE doesn't support a lot of elements of CSS2 very well. :D I guess I
should try to be more friendly to IE user agents. :) For the thread
starter, you'll want to keep
http://msdn.microsoft.com/library/de...node_entry.asp
to reference IE-specific properties and methods and
http://www.mozilla.org/docs/dom/domref/ as a reference to those specific
to Gecko-based browsers.

Jul 23 '05 #6
Ron wrote:
Michael Winter wrote:
I was lead to believe that IE is incapable of handling XHTML
properly. ... <snip>
IE6 renders XHTML documents with embedded objects fine on my end, as
long as one uses the compatibility tips for XHTML. :)
The compatibility requirement for using XHTML with IE browsers is to
send a content type header that asserts that the contents are text/html.
The effect is that IE treats the content as HTML and interprets the
XHTML features (explicitly closed empty tag (" /"), unknown attributes
and the like) as erroneous mark up, error-correcting it back into HTML
tag soup and construct a scriptable HTML DOM for the page.
Documents identified as XHTML are rendered more
efficiently than HTML in newer browsers,


Receiving content asserting that it is text/html induces browsers that
could handle genuine XHTML to treat that content as HTML, and they also
error-correct it back to tag soup HTML and construct a scriptable HTML
DOM for the page. It is unlikely that the added burden of
error-correcting the mark-up would result in XHTML served as text/html
being rendered faster than formally valid HTML.

<snip> Unless your server sends the content type, you should append the
character set:

content="applic ation/xhtml+xml; charset=xxx"

[snip]

I would add this, but I have no way of knowing what character encoding
the reader is using.

<snip>

Because the XHTML appendix C compatibility guidelines recommend sending
the content type as text/html, putting a META tag in the document
asserting that the content type is application/xhtml+xml is a bit
perverse, probably pointless (what is the browser expected to do, switch
to an XML parser when it is encountered?) and potentially dangerous.
HTML DOMs and XHTML DOMs are similar but require distinct handling
(particularly with regard to namespaces), so it cannot be a good idea to
produce a page that is expected to result in an HTML DOM (to be
scripted) and then do something that might result in the browser
producing an XHTML DOM (even if nobody is aware of a browser that would
do so).

Richard.
Jul 23 '05 #7
JRS: In article <fa************ **************@ posting.google. com>, seen
in news:comp.lang. javascript, TrvlOrm <ks*****@shaw.c a> posted at Thu, 6
May 2004 11:38:59 :
Lines: 182 Ok Thanks Ron, I'll give this a try. If I can't get it to work...I'll let you
know..
Thanks Again

Ron <we*******@slid er142.com> wrote in message news:<NGhmc.147 072$Gd3.3616314 7@n
ews4.srv.hcvln y.cv.net>...
Heya Trvl,
There were
... ... ...


Learn to trim your quotes; see newsgroup FAQ, section 2.3.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2938
by: martingerber | last post by:
Hi, I have the following script (javascript in html document): <html> <head> <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1"> <title>Standort Speichern</title>
2
2185
by: TeknoCat | last post by:
Hey everyone, I may be repeating myself here, but if someone sent a reply then I missed it, and I can't get Outlook Express to download any messages more than 2 days old. Anyway, I'm having a problem with some new pages I am creating for the Web site at www.weaverdevore.ca and I am wondering if anyone here might be able to help. Here is...
14
2132
by: TrvlOrm | last post by:
OK. After much playing around, I managed to get my frame page this far.. see code below. BUT...there are still errors with it, and what I would like to have happened is this: 1) On the Left Frame (File LeftEx8_2.html) a series of buttons, which when clicked prompt the user to enter information for background color, text color, link...
8
1413
by: heather.memmel | last post by:
I am in no way a scripter/programmer of any kind but I am in charge of a number of online videos. Anyway I need help debugging my javascript which has been pieced together from several other posts/people in relation to the topic of reloading two frames from a link in a image map. Here is the code it doesn't work, Please Help! You can check...
0
5536
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
8
2015
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for button A's mouseup has completed? I beleive event processing to be single-threaded for good reason but I need a "stop" button and it's no good if...
5
3680
by: althafexcel | last post by:
hi everyone Im trying to include an external js in my aspx page under the head tag, it doesn't load or it displays an object expected error whenver the function from the .js is called. Actually for repeated html im using the external js, i mean the TOP, BOTTOM they are repeated in every page, so i include them as functions in the external...
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7954
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5367
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.