| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| DesignersTalk > Javascript, CSS and XHTML Compatability Help |
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
I'm currently creating a page and I want it to go by coding stardards so how do I make the following code Valid XHTML 1.0 Transitional? <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Documentation Audit</title> <meta http-equiv="Content-Type" content="text/xml; charset=iso-8859-1" /> <link href="allstyle.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> <!-- Begin var NS4 = (document.layers); var IE4 = (document.all); var win = this; var n = 0; function findInPage(str) { var txt, i, found; if (str == "") return false; if (NS4) { if (!win.find(str)) while(win.find(str, false, true)) n++; else n++; if (n == 0) alert(str + " was not found on this page."); } if (IE4) { txt = win.document.body.createTextRange(); for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) { txt.moveStart("character", 1); txt.moveEnd("textedit"); } if (found) { txt.moveStart("character", -1); txt.findText(str); txt.select(); txt.scrollIntoView(); n++; } else { if (n > 0) { n = 0; findInPage(str); } else alert(str + " was not found on this page."); } } return false; } // End --> </script> </head> I've tried all I can but can't figure it out. Would be grateful for any help. To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
|
#3 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
Yeh but how do u make it so its compatable with XHTML 1.0. (Making it so it follows coding standards) Or is it just impossible? To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
#4 (permalink) | |
|
Dr. Lucien Sanchez
Join Date: Mar 2003
Location: UK
Posts: 5,625
|
How well a bit of javascript adheres to standards depends on what it does. Can people use your site without it? Anyway, just link to it: Quote:
|
|
|
|
|
#6 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
I'll try that No, people cant use the site without it. I've designed it for an intranet and its an audit of all the businesses files. There plenty of them. So the site search helps them quickly find the document they are look for. To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
#9 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
You'd be wrong. It still didnt validate. Without the Javascript it validates nicely. But with it it just gets... urgh! To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
#10 (permalink) | |
|
trouble free and loverlee
Join Date: Mar 2003
Location: YooKay
Posts: 2,875
|
Quote:
There's more to implementing standards-compliant javascript than simply considering whether or not a page remains accessible without it. A good source of info for you, blazedesign: http://www.w3.org/DOM/faq.html http://www.mozilla.org/docs/dom/domref/ http://www.mozilla.org/docs/dom/domr...ro.html#997525 http://www.quirksmode.org/ - Do you have an online example which we can view for ourselves? We will also be able to see what error the validator is throwing up. As erilidon says, using an external js file should bypass any problems with js in your markup causing it to invalidate the page. |
|
|
|
|
#11 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
I'll see what I can do. It's just the information it shows is confidential so I can't upload all of the document. Bare with me.... To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
#12 (permalink) | |
|
teh sUxX0r
Join Date: Jun 2004
Posts: 43
|
Quote:
how interestingly peculiar.. I used that code up there and linked to it then checked it with a xhtml valuator.. and there were no errors. do you have an online example? did you use the right format.. <script type="text/javascript" src="./blah.js"></script> |
|
|
|
|
#13 (permalink) |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Here's the results. When I take the Javascript out none of the errors are shown. To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
#14 (permalink) | |
|
teh sUxX0r
Join Date: Jun 2004
Posts: 43
|
Quote:
do you know CSS? I'm not sure.. but I think thats the only way to fix that. also watch your captilization |
|
|
|
|
#15 (permalink) |
|
I Ain't Losing Any Sleep™
Join Date: Apr 2003
Posts: 5,236
|
Everything needs to be in lower case onSubmit == onsubmit etc... You also need to double quote your values. size=15 == size="15" try that for now. That's fuckin' ingenious, if I understand it correctly. It's a Swiss fuckin' watch.
|
|
|
|
#16 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
Yeh I know CSS. But I dont see how that would help as the css s fine with the document. Its when the javascript is placed in that all the errors occur. I validated it before I put th javascript in and it was fine. But once it was in it created a whole load of other errors. To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
|
#18 (permalink) |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
OK, now i'm down to th following Below are the results of attempting to parse this document with an SGML parser. Line 18, column 140: required attribute "action" not specified ...eturn findinpage(this.string.value);"> The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element. Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>. ✉ Line 19, column 133: end tag for "input" omitted, but OMITTAG NO was specified ...e="text" size="20" onchange="n = 0;"> You may have neglected to close a tag, or perhaps you meant to "self-close" a tag; that is, ending it with "/>" instead of ">". ✉ Line 19, column 72: start tag was here ... <input name="string" type="text" size="2 Line 20, column 118: end tag for "input" omitted, but OMITTAG NO was specified ...pe="submit" value="Search Page"></div></td> ✉ Line 20, column 72: start tag was here ... <input type="submit" value="Search Page" Line 20, column 118: end tag for "form" omitted, but OMITTAG NO was specified ...pe="submit" value="Search Page"></div></td> ✉ Line 18, column 72: start tag was here ...v align="center" class="smallheader"><form name="search" onsubmit="return fin To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
|
#19 (permalink) | |
|
Senior Member
Join Date: Mar 2004
Location: Somewhere you can't find me
Posts: 101
|
Quote:
I did, the problems are my own stupidity now. Still not valid though To recover from my internet addiction I will eat breakfast with a knife and fork and not with one hand typing.
|
|
|
![]() |