473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Javascripts not working under XHTML

When I deliver a page as text/html, the javascripts work, but if delivered
as application/xhtml+xml, the javascripts don't work:

function OpenBrWindow(theURL,winName,features, myWidth, myHeight,
isCenter) { //v3.0
if(window.screen)if(isCenter)if(isCenter=="true"){
var myLeft = (screen.width-myWidth)/2;
var myTop = (screen.height-myHeight)/2;
features+=(features!='')?',':'';
features+=',left='+myLeft+',top='+myTop;
}
window.open(theURL,winName,features+((features!='' )?',':'')+'width='+myWidth+',height='+myHeight);
}
function Glaydon() {
var uservar = "vendas";
var servidor = "cpedobrasil";
var ext = ".com.br";
document.write("<a href=" + "mail" + "to:" + uservar + "@" + servidor+ ext
+ ">" + uservar + "@" + servidor + ext + "</a>");
}

I'm desperate. I include the javascripts this way:
<script type="text/javascript" src="javascript.js"></script>
Is there a way to have them to work?
I just saw that document.write(); doesn't work under XHTML. Is there a way
to have a similar feature ?
Thanks,

--

Kerberos.

http://www.opera.com
http://www.freebsd.org
http://www.osresources.com
http://exodus.jabberstudio.org
Jul 23 '05 #1
2 1176
Kerberos wrote:
When I deliver a page as text/html, the javascripts
work, but if delivered
as application/xhtml+xml, the javascripts don't work:
HTML DOMs and XHTML DOMs are quite distinct creatures (both by
specification and by implementation). If you write a script for an HTML
DOM there is quite a good chance that it will not work correctly (if at
all) with an XTHML DOM (and the other way around).

<snip> document.write("<a href=" + ...

<snip>

There are currently *no* XHTML DOM implementations that support document
write.

In addition, when scripting XHTML you need to be aware of the use of
namespaces and the case sensitivity of XHTML (as covered in the HTML
level 2 DOM specification from the W3C).

Unfortunately there are people who present XHTML and then script it as
if it was HTML, without mentioning the serious caveats about serving
those (exclusively Appendix C XHTML 1.0) pages as text/html so that the
receiving browser will put a lot of additional effort into interpreting
the pages as tag-soup HTML (Thus creating the HTML DOM that the script
is expecting). That is quite dishonest of them, and misleads others into
believing that they can get away with scripting XHTML as if it was HTML.

In practice the vast majority of the people who understand the situation
would recommend that currently, in any commercial context, HTML should
be authored instead of XHTML whenever client-side scripting is to be
used (and often even when scripting is not to be used).

Richard.
Jul 23 '05 #2
On Tue, 14 Dec 2004 01:12:41 +0000, Richard Cornford wrote:
<snip>
document.write("<a href=" + ...

<snip>

There are currently *no* XHTML DOM implementations that support document
write.


And I hope there never will be. The idea of *writing tags* (instead of
adding/deleting/moving objects or modifying properties) is hideously
brain-damaged. (And people who want it, or think they "need" it, are
still in the coils of the tagsoup mindset.)

Jul 23 '05 #3

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

Similar topics

3
by: Kerberos | last post by:
When I deliver a page as text/html, the javascripts work, but if delivered as application/xhtml+xml, the javascripts don't work: function OpenBrWindow(theURL,winName,features, myWidth, myHeight,...
5
by: Barry | last post by:
Hello, I've recently noticed that someone can simply type in the URL to my javaScript, from my HTML source code, to the explorer location bar and an auto-save dialog pops up to let them save it...
2
by: sdvoranchik | last post by:
We have an application that contains links that run javascripts to create pages in a separate frame. When these links open an external site, it causes the javascripts to no longer function. When...
4
by: David Virgil Hobbs | last post by:
My web host inserts banner ads into my html pages. The javascript in these banner ads interferes with the onload triggered javascript functions in my pages. Whether I trigger my javascript...
2
by: and | last post by:
Hi I have been validating all day most things are cool but I cant get by this problem. One I have listed the script (JAVASCRIPT ) in all the right placesnot a prob but the validator insists...
3
by: jon | last post by:
Hello, I am new to trying to validate this xhtml so I will try to explain as best I can. Ok, I currently have a draft html file which I am trying to validate to a xhtml. Right now I have a couple...
4
by: januarynow | last post by:
Generally, my site contains javascripts (a couple of freebie counters plus some CPM (pay-per-impression) and CPC (pay-per-click) ads), from four different firms, but they are all suffering from the...
1
by: Memphis Steve | last post by:
Is it possible to combine multiple javascipts into one file and then call that file from a linked URL in the head section of an XHTML file? Here are the two scripts I want to use with the...
11
by: rfr | last post by:
When I add a transitional doctype to the weather page on my community website, I loose certain Js scripts, but not all of them. This puzzles me. The main menu is powered by a js script and...
6
by: shailen21 | last post by:
Hi everybody, Im trying to use that piece of javascripts for 2 combo box in my web site but its nt working on Firefox but it works well in IE 6.0 :S Can someone please help me in solving this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...

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.