<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: xhtml code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Tue, 07 Oct 2008 09:16:01 GMT</pubDate>
    <description>DZone Snippets: xhtml code</description>
    <item>
      <title>target= not valid in XHTML</title>
      <link>http://snippets.dzone.com/posts/show/4074</link>
      <description>Used for pages with strict doctypes (i.e. no target="_blank"). Automagically adds them back in to links with rel="external"&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;function externalLinks() {&lt;br /&gt; if (!document.getElementsByTagName) return;&lt;br /&gt; var anchors = document.getElementsByTagName("a");&lt;br /&gt; for (var i=0; i&lt;anchors.length; i++) {&lt;br /&gt;   var anchor = anchors[i];&lt;br /&gt;   if (anchor.getAttribute("href") &amp;&amp; anchor.getAttribute("rel") == "external") {&lt;br /&gt;     anchor.target = "_blank";&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;window.onload = externalLinks;&lt;br /&gt;&lt;br /&gt;//////////////&lt;br /&gt;&lt;br /&gt;&lt;a href="whatever" rel="external" title="whatever"&gt;Whatever&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 30 May 2007 14:16:55 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4074</guid>
      <author>Booma (Alan Coleman)</author>
    </item>
    <item>
      <title>Form name not valid in strict XHTML</title>
      <link>http://snippets.dzone.com/posts/show/4073</link>
      <description>&lt;form name="search" id="search"... &lt;br /&gt;&lt;br /&gt;'name' is not valid in strict XHTML. So instead use the id&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;form id="search"...&lt;br /&gt;&lt;br /&gt;&lt;a href="#" onclick="document.forms['search'].submit();return false" title="Search"&gt;Search&lt;/a&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 30 May 2007 14:08:39 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4073</guid>
      <author>Booma (Alan Coleman)</author>
    </item>
    <item>
      <title>Javascript commands from 'a' tags rather than buttons</title>
      <link>http://snippets.dzone.com/posts/show/3269</link>
      <description>In this instance the relevant form is called 'search_form'. This is specified in the a tag version because it's not an input and as such cannot have submit or reset associated with it.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;    	&lt;input type="submit" value="Search" onclick="javascript:return text_validate()" /&gt;&lt;br /&gt;   	&lt;input type="reset" value="Reset" /&gt;&lt;br /&gt;    	&lt;input type="button" value="Show All News" onclick="javascript:return showAll();" title="Show all news button." /&gt;&lt;br /&gt;&lt;br /&gt;Could be shown as:&lt;br /&gt;&lt;br /&gt;        &lt;a class="blockbutton" title="Search" href="javascript:document.search_form.submit();" onclick="javascript:return text_validate();"&gt;Search&lt;/a&gt;	&lt;br /&gt;	&lt;a class="blockbutton" title="Reset" href="javascript:document.search_form.reset();"&gt;Reset&lt;/a&gt;&lt;br /&gt;	&lt;a class="blockbutton" title="Show All News" href="javascript:showAll();"&gt;Show All News&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Okay, as pointed out by Blonkm this is bad for usability. A better way of doing things would be like this:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;&lt;br /&gt;  function doSubmit(){    &lt;br /&gt;        document.getElementById("whatever").submit();&lt;br /&gt;        return true;   &lt;br /&gt;     }   &lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="#" onclick="doSubmit();return false;" title="Search"&gt;Link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 10 Jan 2007 22:23:49 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3269</guid>
      <author>Booma (Alan Coleman)</author>
    </item>
    <item>
      <title>Conditional comment</title>
      <link>http://snippets.dzone.com/posts/show/3268</link>
      <description>From the microsoft website. Better than browser sniffing, the content within the tags will be shown if the condition within [] is met, in the this case IE, but you could also use IE 7 for example&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  &lt;!--[if IE]&gt;&lt;br /&gt;    Content&lt;br /&gt;  &lt;![endif]--&gt;&lt;br /&gt;&lt;br /&gt;  &lt;!--[if lt IE6]&gt; //lower than IE6&lt;br /&gt;    Content&lt;br /&gt;  &lt;![endif]--&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;and the XSL version&lt;br /&gt;&lt;br /&gt;  &lt;xsl:comment&gt;[if IE 7]&amp;gt;&lt;br /&gt;    Content &amp;lt;![endif]&lt;/xsl:comment&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 10 Jan 2007 22:14:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3268</guid>
      <author>Booma (Alan Coleman)</author>
    </item>
    <item>
      <title>When producing XHTML output with XSL files, you have to use</title>
      <link>http://snippets.dzone.com/posts/show/2957</link>
      <description>The method="xml" is needed if you want XHTML valid output, "xhtml" is not a valid parameter.&lt;br /&gt;&lt;br /&gt;The encoding="us-ascii" is needed if you want pound, euro, nbsp and any other html entities to show up correctly.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;xsl:output method="xml" omit-xml-declaration="yes" encoding="us-ascii"/&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Thu, 02 Nov 2006 20:22:17 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2957</guid>
      <author>Booma (Alan Coleman)</author>
    </item>
  </channel>
</rss>
