473,847 Members | 2,462 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validator doesnt like my javascript can some help me?

Hey everyone,

I have this browser detect script and the validator is having problems with
it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
function button()
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {
document.write( '<input type="button" onclick="ClipBo ard();" value="Copy"
/>');
} else {
document.write( "");
}
}
</script>

1.. Line 14, column 55: character "&" is the first character of a
delimiter but occurred as data

...pName=="Micr osoft Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

If you wish to include the "<" character in your output, you should escape
it as "&lt;". Another possibility is that you forgot to close quotes in a
previous tag.

2.. Line 14, column 56: character "&" is the first character of a
delimiter but occurred as data

if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

3.. Line 15, column 75: document type does not allow element "input" here

...ton" onclick="ClipBo ard();" value="Copy" />');

The element named above was found in a context where it is not allowed.
This could mean that you have incorrectly nested elements -- such as a
"style" element in the "body" section instead of inside "head" -- or two
elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this error can
create cascading effects. For instance, using XHTML's "self-closing" tags
for "meta" and "link" in the "head" section of a HTML document may cause the
parser to infer the end of the "head" section and the beginning of the
"body" section (where "link" and "meta" are not allowed; hence the reported
error).
Jul 20 '05 #1
13 2014
Sheperd wrote:
I have this browser detect script and the validator is having problems
with it, im trying to validate a page for XHTML 1.0 Transitional


http://www.w3.org/TR/xhtml1/#h-4.8
http://www.hixie.ch/advocacy/xhtml

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2
Sheperd wrote:
I have this browser detect script and


Why are you trying to detect the browser?

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #3
Sheperd wrote:
Hey everyone,

I have this browser detect script and the validator is having problems with
it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
function button()
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {
document.write( '<input type="button" onclick="ClipBo ard();" value="Copy"
/>');
} else {
document.write( "");
}
}
</script>

1.. Line 14, column 55: character "&" is the first character of a
delimiter but occurred as data

...pName=="Micr osoft Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

If you wish to include the "<" character in your output, you should escape
it as "&lt;". Another possibility is that you forgot to close quotes in a
previous tag.

2.. Line 14, column 56: character "&" is the first character of a
delimiter but occurred as data

if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

3.. Line 15, column 75: document type does not allow element "input" here

...ton" onclick="ClipBo ard();" value="Copy" />');

The element named above was found in a context where it is not allowed.
This could mean that you have incorrectly nested elements -- such as a
"style" element in the "body" section instead of inside "head" -- or two
elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this error can
create cascading effects. For instance, using XHTML's "self-closing" tags
for "meta" and "link" in the "head" section of a HTML document may cause the
parser to infer the end of the "head" section and the beginning of the
"body" section (where "link" and "meta" are not allowed; hence the reported
error).


You're not alone.

Their *HTML validator hates Yahoo's Geocities javascript Ad Boxes, too.
My HTML is valid 4.01 Transitional, but Yahoo's ads generate 21 errors
on my home page!
Jul 20 '05 #4

Sheperd wrote:
Hey everyone,

I have this browser detect script and the validator is having problems with
it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
function button()
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {
document.write( '<input type="button" onclick="ClipBo ard();" value="Copy"
/>');
} else {
document.write( "");
}
}
</script>


Change the < and > to &lt; and &gt; in the "input" string, like this:

('&lt;input type="button" onclick="ClipBo ard();" value="Copy"/&gt;')

I belive that solve all errors

--
/Arne
Jul 20 '05 #5
Hey Arne

That worked perfectly thank you very much

The reason I have it detect different browsers is because I have a script
that copies text to the clip board but it only works for IE and so the
detect doest create the copy button

Thanks to all who responded to my cry help

Sheperd

"Arne" <ar********@tel ia.com> wrote in message
news:YW******** **********@news b.telia.net...

Sheperd wrote:
Hey everyone,

I have this browser detect script and the validator is having problems with it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
function button()
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {
document.write( '<input type="button" onclick="ClipBo ard();" value="Copy" />');
} else {
document.write( "");
}
}
</script>


Change the < and > to &lt; and &gt; in the "input" string, like this:

('&lt;input type="button" onclick="ClipBo ard();" value="Copy"/&gt;')

I belive that solve all errors

--
/Arne

Jul 20 '05 #6
DU
Sheperd wrote:
Hey everyone,

I have this browser detect script and the validator is having problems with
it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
language is deprecated; I recommend you just use type instead.

Here, you need to escape the code

http://www.w3.org/TR/2002/REC-xhtml1-20020801/#h-4.8

like this:

<script type="text/javascript">
// <![CDATA[
function button()
{
....
}
// ]]>
</script>

so that &, <, >, \ are not interpreted as markup

function button()
I recommend you choose another name for that function, a more
descriptive name; this helps reviewing your code by others and helps
your own understanding of your functions script.
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {
document.write( '<input type="button" onclick="ClipBo ard();" value="Copy"
/>');
This is definately not the best way to detect a browser. You should use
object support detection for whatever your real webpage design needs are.

http://jibbering.com/faq/#FAQ4_26

DU
} else {
document.write( "");
}
}
</script>

1.. Line 14, column 55: character "&" is the first character of a
delimiter but occurred as data

...pName=="Micr osoft Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

If you wish to include the "<" character in your output, you should escape
it as "&lt;". Another possibility is that you forgot to close quotes in a
previous tag.

2.. Line 14, column 56: character "&" is the first character of a
delimiter but occurred as data

if ((navigator.app Name=="Microsof t Internet
Explorer")&&(pa rseInt(navigato r.appVersion)>= 4)) {

3.. Line 15, column 75: document type does not allow element "input" here

...ton" onclick="ClipBo ard();" value="Copy" />');

The element named above was found in a context where it is not allowed.
This could mean that you have incorrectly nested elements -- such as a
"style" element in the "body" section instead of inside "head" -- or two
elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this error can
create cascading effects. For instance, using XHTML's "self-closing" tags
for "meta" and "link" in the "head" section of a HTML document may cause the
parser to infer the end of the "head" section and the beginning of the
"body" section (where "link" and "meta" are not allowed; hence the reported
error).

Jul 20 '05 #7
Sheperd wrote:
That worked perfectly thank you very much
First, please don't top-post.
The reason I have it detect different browsers is because I have a
script that copies text to the clip board but it only works for IE
Then the solution is to make it work on the www, instead of in one
operating system component that pretends (sort of) to be a browser.
and so the detect doest create the copy button


Not hardly. What happens when someone fakes the ua string -- all too
common, often to defeat clueless browser sniffing.

--
Brian (remove ".invalid" to email me)
http://www.tsmchughs.com/
Jul 20 '05 #8
DU
Sheperd wrote:
Hey Arne

That worked perfectly thank you very much

The reason I have it detect different browsers is because I have a script
that copies text to the clip board
Then you should do a browser detect based on its support for the
particular property involved within your webpage design needs. It's not
only much more reliable but it's also more sensible script design.
Spoofed appName is very common with alternative browsers.

if(self.clipboa rdData) {button display on} else {button display off}.
should work in MSIE 5+. Your code assumes that clipboard data is
available in MSIE 4 but that's not true.

DU
but it only works for IE and so the detect doest create the copy button

Thanks to all who responded to my cry help

Sheperd

"Arne" <ar********@tel ia.com> wrote in message
news:YW******** **********@news b.telia.net...
Sheperd wrote:

Hey everyone,

I have this browser detect script and the validator is having problems
with
it, im trying to validate a page for XHTML 1.0 Transitional

If you have any ideas or suggestions they would be greatly appericated
Here is the script and the error that validtor spits out

<script language="JavaS cript" type="text/javascript">
function button()
{
if ((navigator.app Name=="Microsof t Internet
Explorer")&& (parseInt(navig ator.appVersion )>=4)) {
document.write( '<input type="button" onclick="ClipBo ard();"
value="Copy"
/>');
} else {
document.write( "");
}
}
</script>

Change the < and > to &lt; and &gt; in the "input" string, like this:

('&lt;input type="button" onclick="ClipBo ard();" value="Copy"/&gt;')

I belive that solve all errors

--
/Arne


Jul 20 '05 #9
On Mon, 26 Jul 2004 18:49:04 -0400, Brian
<us*****@juliet remblay.com.inv alid> wrote:
Sheperd wrote:
That worked perfectly thank you very much


First, please don't top-post.
The reason I have it detect different browsers is because I have a
script that copies text to the clip board but it only works for IE


Then the solution is to make it work on the www, instead of in one
operating system component that pretends (sort of) to be a browser.


In theory, this is a situation where something unessential is added as an
optional feature. I don't see a problem if you're doing something just in
IE, so long as page functionality is maintained on all UAs.
and so the detect doest create the copy button


Not hardly. What happens when someone fakes the ua string -- all too
common, often to defeat clueless browser sniffing.


Right. That's the real problem here. Many browsers which are not IE will
dress up as IE for the server - and they get the button, and it won't
work. Choose a method which is not susceptible to that fakeout.
Jul 20 '05 #10

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

Similar topics

17
4018
by: Colin Cogle | last post by:
------- Line 47, column 8: there is no attribute "id" <DIV id="LeftNavigation" style="position:absolute; left:8px; top:6px; width:200p ------- Line 47, column 31: there is no attribute "style" <DIV id="LeftNavigation" style="position:absolute; left:8px; top:6px; width:200p ------- Line 47, column 127: element "DIV" undefined
0
1515
by: Heinz Kleinbauer | last post by:
Hello I have a Java Application with a CSS Validator in it (http://jigsaw.w3.org/css-validator/). Now I should modify certain properties but i dont know exactly how i have to do this. I have to check a Css2 Stylesheet und certain properties should be modified. For example the property margin top shouldn't be negative or things like background-image, background repeat shouldnt be in the stylesheet. Can someone tell me how i can achive...
2
3924
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
4
9911
by: moondaddy | last post by:
Is there a asp.net validator control that validates the length of the text being entered or does everyone just write jscript for this? -- moondaddy@nospam.com
2
9877
by: Dot net work | last post by:
Hello. Say I have a .net textbox that uses a .net regularexpressionvalidator. If the regular expression fails, is it possible to launch a small client side javascript function to do something, such as change the border color of the textbox to red? That would look quite nice: if the expression fails, the red validator text is shown, plus the textbox's border goes red. TIA,
8
7840
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the VALUE ENTERED BY THE USER EXISTS IN THE DB , then THE ERROR MESSAGE OF THE COMPARE VALIDATOR SHOULD BE DISPLAYED. For this, I used the reference artiicle "http://msdn.microsoft.com/library/default.asp?url=/library/en-...
1
2855
by: MattB | last post by:
I have a page with dual controls for a person to enter their height and weight. The dual controls are for English and metric units, and Javascript onChange events handle populating the other control when one if filled. This works well. I also have some asp.net validation controls to make sure the values entered are within certain limits. The problem I'm having is that if I fill in my weight in the Lbs. TextBox, the Javascript fires and...
43
2631
by: SLH | last post by:
hi people. im trying to validate input received via a text area on an ASP page before writing it to a database. i cant use client side javascript due to policy, so it all has to happen on the server. here is what i was trying, but pieces of it continue to break for one reason or another. the thinking behind this function was like this: if the input is less than 10 characters long, fail. if its 10 characters or greater, but it doesnt...
0
1195
by: Dhanashree | last post by:
I have a RangeValidator which uses AJAX to call server-side validation function from the client. The code works fine, but I have one problem. following is my range validator class: public class RangeValidator: BaseValidator,ICallbackEventHandler { public event ServerValidateEventHandler ServerValidate; String _controlToValidateValue;
0
9727
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10978
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10705
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9477
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7879
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5907
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4521
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
2
4113
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3158
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.