SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict Johana Solendhal's Avatar
    Join Date
    Aug 2004
    Location
    Land of the free
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Is there any possibility to validate this?

    I am trying to validate this, but W3 doesn't seem to recognize the attributes "onFocus", "onBlur", and so on.

    Is there a way to validate this?

    <code>
    <form name="txtlist" action="./index.php" target="txtlist" method="get" onSubmit="JavaScript:window.open('','txtlist','width=300,height=150,toolbar=no,status=no,resizable=no')">
    <input type="hidden" name="type" value="sub" /><br />
    <input type="text" name="email" value="email address" size="20" maxlength="100" onFocus="if (this.value=='email address') this.value=''" onBlur="if (this.value=='') this.value='email address'" />
    <br /><br />
    <input type="submit" name="sub" value="subscribe" />
    </form></code>

  2. #2
    SitePoint Wizard Pedro Monteiro's Avatar
    Join Date
    Sep 2002
    Location
    Lisbon
    Posts
    1,393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don't forget that Xhtml is case sensitive. OnBlur attribute should be onBlur, onFocus should be onfocus. Has for the rest of the validation process, I don't think that the name attribure can be inside <form>, same situation applies in the target attribute.

  3. #3
    SitePoint Wizard Pedro Monteiro's Avatar
    Join Date
    Sep 2002
    Location
    Lisbon
    Posts
    1,393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Johana, you should use rel="external" to open a new browser window. DTDs for "Transitional" and "Frames" were dropped When W3C made XHTML 1.1.

  4. #4
    SitePoint Addict Johana Solendhal's Avatar
    Join Date
    Aug 2004
    Location
    Land of the free
    Posts
    252
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did what you said and it didn't work.

  5. #5
    SitePoint Wizard Pedro Monteiro's Avatar
    Join Date
    Sep 2002
    Location
    Lisbon
    Posts
    1,393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's probably because you forgot to add the javascript.

    Here you go;

    Code:
     function externalLinks() { 
     if (!document.getElementsByTagName) return; 
     var anchors = document.getElementsByTagName("a"); 
     for (var i=0; i<anchors.length; i++) { 
       var anchor = anchors[i]; 
       if (anchor.getAttribute("href") && 
    	   anchor.getAttribute("rel") == "external") 
    	 anchor.target = "_blank"; 
     } 
    } 
    window.onload = externalLinks;


Bookmarks

Posting Permissions

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