www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 16

Thread: Trying to validate my page

  1. #1
    Join Date
    Feb 2004
    Posts
    1,345

    Trying to validate my page

    Hi there.

    I'm trying to validate my page. I'm suing:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    I have a few errors that I have no idea how to fix. Here it is:

    there is no attribute "target":
    <a href="http://mywebsite.com/" target="_blank">www.mywebsite.com</a>

    end tag for element "br" which is not open:
    text text text text text text text text</br>

    there is no attribute "align":
    <img align="top" src="imgs/image.jpg" width="45" height="38" alt=""/>

    Hope you can help.

    Thanks!

  2. #2
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    (1)There's no align attribute in XHTML 1.0 Strict. Try this:

    Code:
    <a href="http://mywebsite.com/" onclick="window.open(this.href);">www.mywebsite.com</a>
    (2) You've got that tag messed up. You use <br /> And only once to break. thus:

    Code:
    <p>
    text text text text text text text text <br />
    text text text text text text 
    </p>
    (3) There's no align attribute. You should be using CSS. HTML is not meant for layout!

    Code:
    <img src="imgs/image.jpg" width="45" height="38" alt=""/>

  3. #3
    Join Date
    Feb 2004
    Posts
    1,345

    How do I do the align=top

    in CSS?

    The onClick didn't work out, why's that?
    <a href="http://mywebsite.com/" onclick="window.open(this.href);">www.mywebsite.com</a>

  4. #4
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    The javascript I gave you should work, I don't have any issues with it. Odd.


    In terms of your image align, I'd have to see what you want to do, I can't guess. Though, I really hope you aren't using tables to layout your page.

  5. #5
    Join Date
    Feb 2004
    Posts
    1,345

    The JavaScript is working now but

    I doesn't open in a new window.
    Why do I have to do it with JS?

    I'm just tryin' to get to align the photo to "top" like that:
    <img src="imgs/image.jpg" align="top" width="45" height="38" alt=""/>

  6. #6
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    (1) Because the target attribute should only be used in frames, where it targets a specific frame. HTML should not tell a browser how to display data, only define it. And it's telling the browser to display the link in a new window. That's not the purpose of HTML, thus for that and other reasons, it's not a part of the XHTML 1.0 specification, except for XHTML 1.0 FRAMESET. I've tested that in IE and Firefox, so unless I screwed up, it should work.

    (2) The vertical-align attribute can be used, but only works for table cells, as it should. The image should normally go to the top, what do you have that wouldn't? If you are (incorrectly) using tables for layout, you can put style="vertical-align:top;" I believe for the cell. The align attribute, once again, is telling a browser not about the data, but how to display it. Thus, it isn't part of the HTML 4.01 Strict nor XHTML 1.0 Strict, nor XHTML 1.1 If, however, you are using a more accessible and semantic design, there is probably an easy way to achieve what you want.

  7. #7
    Join Date
    Feb 2004
    Posts
    1,345

    The thing with the JS code u gave is that...

    I'm getting a new window with the URL I wanted but the original page itself goes to the same URL. Can I prevent it somehow?

  8. #8
    Join Date
    Aug 2003
    Location
    In my house
    Posts
    4,004
    Code:
    <a href="page.html" onclick="window.open(this.href); return false;">Page</a>

  9. #9
    Join Date
    Jul 2003
    Location
    New York City
    Posts
    2,771
    This is why I never visit the javascript forum... It still opens a window! Sorry...

  10. #10
    Join Date
    Aug 2003
    Location
    In my house
    Posts
    4,004
    lol. So it's fixed now, no?

  11. #11
    Join Date
    Feb 2004
    Posts
    1,345

    Yea, Thanks!

    It's cool now but my problem is that I have a lot of link in the page (100 or so) so I need to go through each one of'em?

  12. #12
    Join Date
    Nov 2002
    Location
    Baltimore, Maryland
    Posts
    12,279

    Re: Yea, Thanks!

    Originally posted by weee
    It's cool now but my problem is that I have a lot of link in the page (100 or so) so I need to go through each one of'em?
    You can use JavaScript to step through some or all of the links and add the handler as desired. Post a link and tell us which links you want to abuse.
    “The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect.”
    —Tim Berners-Lee, W3C Director and inventor of the World Wide Web

  13. #13
    Join Date
    Feb 2004
    Posts
    1,345

    Cn you show me how does it look like?

    I didn't started yet to add the links to the page yet.

  14. #14
    Join Date
    Aug 2003
    Location
    In my house
    Posts
    4,004
    Something like this, maybe?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    	http://www.w3.org/TR/html4/strict.dtd">
    
    <html lang="en">
    <head>
    	<title>Example</title>
    	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    	<meta http-equiv="content-script-type" content="text/javascript">
    	<meta http-equiv="content-style-type" content="text/css">
    	<script type="text/javascript"><!--
    		if(document.getElementById) onload = function() {
    			var links = document.getElementsByTagName('a');
    			for(var i=0; i<links.length; i++) {
    				links[i].onclick = function() {
    					window.open(this.href);
    					return false;
    				}
    			}
    		}
    	//--></script>
    </head>
    <body>
    	<ul id="links">
    		<li><a href="http://www.w3.org/" title="World Wide Web Consortium">W3C</a></li>
    		<li><a href="http://www.w3.org/" title="World Wide Web Consortium">W3C</a></li>
    		<li><a href="http://www.w3.org/" title="World Wide Web Consortium">W3C</a></li>
    		<li><a href="http://www.w3.org/" title="World Wide Web Consortium">W3C</a></li>
    		<li><a href="http://www.w3.org/" title="World Wide Web Consortium">W3C</a></li>
    	</ul>
    </body>
    </html>
    Last edited by Paul Jr; 10-29-2004 at 05:46 PM.

  15. #15
    Join Date
    Feb 2004
    Posts
    1,345

    Thanks but now I need to know...

    How can I seperate certin links that should oen in the same menu?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles