Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Site Look 1

Status
Not open for further replies.

GUJUm0deL

Programmer
Jan 16, 2001
3,676
US
This site is still under development

Hi folks, I am developing a real-estate site and need someone to check out the following link of a property listing.

[URL unfurl="true"]http://www.highestateliving.com/propertylisting.cfm?ListingID=DF65D26452DAA33EF8937B45CF24F247[/url]

The problem I have when I run this page on W3C validator, I get about 20 errors, and I'm lost as to why. Any help is appreciated.

Thanks.

_____________________________
Just Imagine.
 
Most of the error messages are self-explanatory:
Line 21, Column 59: there is no attribute "runat".

<script language="javascript" type="text/javascript" runat="server">
Means you have an attribute that isn't valid for that element. Start by fixing this and it will eliminate some of the other errors.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Well, if you read what the validator says it should give you a clue. You're getting thje "there is no attribute "runat"" error because, erm, there's no such attribute as "runat". Well, at least there isn't in HTML - apparently you can do that in asp to run a VBscript at the server, but if that was happening the validator would never see it.

You've got a slew of errors that come from the validator not realising that it's looking at Javascript code instead of plain HTML. You can use HTML comment markup to hide the JS, but I think it's easier just to put all javascript in a seperate file and link it in like this
Code:
<script type="text/javascript" src="myscript.js"></script>

There's one place where you've written [tt]<a/>[/tt] instead of [tt]</a>[/tt] and several where you've put [tt]&[/tt] instead of [tt]&amp;[/tt].

Fix those and you should be on your way.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
<script language="javascript" type="text/javascript" runat="server">
-- I added that last night thinking the JS would be run at the server level. That JS gets complied from a query result. But that error has nothing to do with the rest of the errors I see. Reason being I was seeing these errors before I added the runat="server".

Errors like:
Line 257, Column 66: character "&" is the first character of a delimiter but occurred as data.

…115] = new Array("United States", "Texas", "Dallas & Fort Worth Area");


Comes from the JS function which gets complied from a query call. The dB has the value stored as "Dallas & Fort Worth Area" I don't see how the & would be an issue since the value is inside a JS array, wrapped in double-quotes.
---------------------------------------------------
AND, this error:
Line 366, Column 157: cannot generate system identifier for general entity "action".

…gID=DF65D26452DAA33EF8937B45CF24F247&action=Email','','menubar=0,resizable=1,


Doesn't make sense (to me). Why would that be an error? I am appending a var "action" after the var "listingid" in a HREF tag. I've never seen an error like that. The link syntax is accurate.
---------------------------------------------------
OR, this error:
Line 318, Column 15: XML Parsing Error: StartTag: invalid element name.

for(i=0; i < aryLocation.length; i++) {


Again, this is inside a JS function, why would that cause an error? Nothing wrong with that syntax either.

_____________________________
Just Imagine.
 
Characters are being sent to the browser that aren't permitted within the DOCTYPE being used.

If these characters are all in your Javascript then try the following:

Code:
<script type="text/javascript">
/* <![CDATA[ */

Your javascript here

/* ]]> */
</script>

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Foamcow, thanks. I will make that change tonight and post my findings. It's odd though, I thought I was using the correct DOCTYPE. I know I've used/seen a JS-based doc-drop similar to the one I am doing using the same DOCTYPE and that never caused this issue.

I'll post later tonight.

_____________________________
Just Imagine.
 
Foamcow, adding
Code:
/* <![CDATA[ */
did the trick! I now have three errors, yet they still puzzle me.

Column 177: cannot generate system identifier for general entity "action" .

...gID=DF65D26452DAA33EF8937B45CF24F247&action=Email','','menubar=0,resizable=1,

---------------------------------------------------
OR, this error:
Column 183: reference not terminated by REFC delimiter .

...65D26452DAA33EF8937B45CF24F247&action=Email','','menubar=0,resizable=1,width=


Any ideas?

_____________________________
Just Imagine.
 
You still haven't escaped the ampersand!

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
johnwm said:
You still haven't escaped the ampersand!
i.e.
Code:
...gID=DF65D26452DAA33EF8937B45CF24F247[b]&amp;[/b]action=Email','','menubar=0,resizable=1,

Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
The DOCTYPE used doesn't ALLOW the & as it uses it as a 'system identifier'.

So to include a literal ampersand you need to do what the chaps above said and use the system indentifier code for an ampersand, namely &amp;


The CDATA thing works (you need to add the closing bit too) because that tells the browser that anything within it is not to be parsed as part of the validation process.
It's actually the proper way to do it, though I often forget myself :)

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Thanks for the help!

But I think I'm going to leave this as is. I've come across other sites that have the same issue, although some use a different DOCTYPE. This is a LINK SYNTAX, the notion of doing something like mySite.com/page1.cfm?var1=one&var2=two&var3=three, should not cause this type of error. Doing the above makes sense (to me at least) then doing this: mySite.com/page1.cfm?var1%3Done&amp;var2%3Dtwo&amp;var3%3Dthree

Consider the fact that if your link is passing 10 or 12 parameters then escaping the & and = will drive you bonkers when trying to debug. I know most of you here are very strict in being W3C compliant and validating your code, but this just doesn't sit well with me...

These are just two sites I came across while searching on this topic:
First One
Second One

_____________________________
Just Imagine.
 
The DOCTYPE says which characters you can and can't have. If you use an ampersand it should be escaped because the ampersand has a special meaning within the DOCTYPE.

It really is that simple. Whether you like it or not, the purpose of a DOCTYPE is to lay out specifications for the encoding of a document. This is a fundamental concept of contemporary web authoring.

In the DOCTYPE you have chosen the & character has special meaning - to denote a special character code. It therefore follows that if you use the ampersand the browser expects the characters following it to be that code. This is why you get the error, since the characters after your & character are not a recognised code.

Every single & character, if it's not marking a special code, should itself be represented by a code. (&amp;)

It probably won't break your page because browsers are forgiving, but according to the DOCTYPE, it's wrong I'm afraid.

Incidentally, = is perfectly fine.

--
Tek-Tips Forums is Member Supported. Click Here to donate

<honk>*:O)</honk>

Tyres: Mine's a pint of the black stuff.
Mike: You can't drink a pint of Bovril.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top