<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: IE DOM Bugs</title>
	<atom:link href="http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/feed/" rel="self" type="application/rss+xml" />
	<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/</link>
	<description>Thoughts on everything from education and politics to internet usability, and programming.</description>
	<lastBuildDate>Wed, 20 Jan 2010 05:27:55 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: anil</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-35089</link>
		<dc:creator>anil</dc:creator>
		<pubDate>Thu, 26 Nov 2009 05:10:33 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-35089</guid>
		<description>can any one help the onblur event is not working


var element3 = document.createElement(&quot;input&quot;);
									element3.type = &quot;text&quot;;
									element3.id = &quot;txt_discountAmount&quot;;
									element3.size = &quot;8&quot;;
									//element3.onblur = fun1(this.value);
									//inp.setAttribute(’onfocus’, function(){this.select();}); 
									element3.setAttribute(&quot;onblur&quot;,function(){getValue(this);});
									//element3.onblur = &quot;fun(this)&quot;;
									
									cell6.appendChild(element3);

function getValues(value)
{
  alert(value);
}</description>
		<content:encoded><![CDATA[<p>can any one help the onblur event is not working</p>
<p>var element3 = document.createElement(&#8221;input&#8221;);<br />
									element3.type = &#8220;text&#8221;;<br />
									element3.id = &#8220;txt_discountAmount&#8221;;<br />
									element3.size = &#8220;8&#8243;;<br />
									//element3.onblur = fun1(this.value);<br />
									//inp.setAttribute(’onfocus’, function(){this.select();});<br />
									element3.setAttribute(&#8221;onblur&#8221;,function(){getValue(this);});<br />
									//element3.onblur = &#8220;fun(this)&#8221;;</p>
<p>									cell6.appendChild(element3);</p>
<p>function getValues(value)<br />
{<br />
  alert(value);<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg Burghardt</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-32628</link>
		<dc:creator>Greg Burghardt</dc:creator>
		<pubDate>Tue, 10 Mar 2009 11:02:23 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-32628</guid>
		<description>I created a similar workaround that uses three functions. A global createElement() function which has a try-catch block in it, and two other functions that cater to Internet Explorer and standards browsers. The try-catch only executes once, as the createElement function is overwritten at run time to be the createElement variation supported by the current browser.

It might run a tad faster than other variations of this bug fix because the try-catch block is only used once.

http://fundamentaldisaster.blogspot.com/2008/10/cross-browser-javascript-creating-dom.html</description>
		<content:encoded><![CDATA[<p>I created a similar workaround that uses three functions. A global createElement() function which has a try-catch block in it, and two other functions that cater to Internet Explorer and standards browsers. The try-catch only executes once, as the createElement function is overwritten at run time to be the createElement variation supported by the current browser.</p>
<p>It might run a tad faster than other variations of this bug fix because the try-catch block is only used once.</p>
<p><a href="http://fundamentaldisaster.blogspot.com/2008/10/cross-browser-javascript-creating-dom.html" rel="nofollow">http://fundamentaldisaster.blogspot.com/2008/10/cross-browser-javascript-creating-dom.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Max</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-9648</link>
		<dc:creator>Max</dc:creator>
		<pubDate>Sun, 10 Feb 2008 03:19:44 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-9648</guid>
		<description>Fixes for all of these IE bugs can be found here:
http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html

Hope this helps</description>
		<content:encoded><![CDATA[<p>Fixes for all of these IE bugs can be found here:<br />
<a href="http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html" rel="nofollow">http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html</a></p>
<p>Hope this helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lawrence</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-5350</link>
		<dc:creator>Lawrence</dc:creator>
		<pubDate>Fri, 19 Oct 2007 15:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-5350</guid>
		<description>Hi Don, 

your fix worked for me. thanks</description>
		<content:encoded><![CDATA[<p>Hi Don, </p>
<p>your fix worked for me. thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Don</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-1757</link>
		<dc:creator>Don</dc:creator>
		<pubDate>Mon, 23 Apr 2007 22:30:07 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-1757</guid>
		<description>For IE 6 at least, setAttribute does not work, period.  I have resorted to using the node proeprties (onClick, className, colSpan, id, etc.) and yes they are case-sensitive so for example, colspan onclick doesn&#039;t work.  I have the following function:

function setIEAttribute(node,property,value) {
    eval(&quot;node.&quot; + property + &quot; = value&quot;);
}

that seem to do the trick.  So in my code I have, for example, 

cell.setAttribute(&quot;colspan&quot;,&quot;2&quot;);
if (isIE) setIEAttribute(cell,&quot;colSpan&quot;,&quot;2&quot;);

It&#039;s not pretty but I&#039;d rather have the constant reminder that it&#039;s IE that causing this grief, not the DOM.</description>
		<content:encoded><![CDATA[<p>For IE 6 at least, setAttribute does not work, period.  I have resorted to using the node proeprties (onClick, className, colSpan, id, etc.) and yes they are case-sensitive so for example, colspan onclick doesn&#8217;t work.  I have the following function:</p>
<p>function setIEAttribute(node,property,value) {<br />
    eval(&#8221;node.&#8221; + property + &#8221; = value&#8221;);<br />
}</p>
<p>that seem to do the trick.  So in my code I have, for example, </p>
<p>cell.setAttribute(&#8221;colspan&#8221;,&#8221;2&#8243;);<br />
if (isIE) setIEAttribute(cell,&#8221;colSpan&#8221;,&#8221;2&#8243;);</p>
<p>It&#8217;s not pretty but I&#8217;d rather have the constant reminder that it&#8217;s IE that causing this grief, not the DOM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Koos</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-833</link>
		<dc:creator>Koos</dc:creator>
		<pubDate>Wed, 31 Jan 2007 16:32:58 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-833</guid>
		<description>This function works in FF and IE. The main difference with the other scripts on this page is that all of the elements attributes are preserved. 

Usage: 

oElement = document.getElementById(&#039;myElement&#039;);
setInputAttribute(oElement, &#039;type&#039;, &#039;radio&#039;);

The code:

function setInputAttribute(oInputElement, sAttributeName, sAttributeValue)
{
  /* first try the DOM-compliant way
  */
  try
  {    
    oInputElement.setAttribute(sAttributeName, sAttributeValue);
  }
  catch (e)
  {
    /* then try it another way
    */
    
    /* build HTML string for clone input */
    
    //get all attributes
    var aoAttributes = oInputElement.attributes;
    var iLength      = aoAttributes.length;
    
    //create html string for new input element
    var sHTML = &quot;&#039;;
    
    /* create new element using the HTML string */
    oNewElement = document.createElement(sHTML);

    /* replace old element with new one */
    oInputElement.parentNode.replaceChild(oNewElement, oInputElement);
  }
}

Good luck!</description>
		<content:encoded><![CDATA[<p>This function works in FF and IE. The main difference with the other scripts on this page is that all of the elements attributes are preserved. </p>
<p>Usage: </p>
<p>oElement = document.getElementById(&#8217;myElement&#8217;);<br />
setInputAttribute(oElement, &#8216;type&#8217;, &#8216;radio&#8217;);</p>
<p>The code:</p>
<p>function setInputAttribute(oInputElement, sAttributeName, sAttributeValue)<br />
{<br />
  /* first try the DOM-compliant way<br />
  */<br />
  try<br />
  {<br />
    oInputElement.setAttribute(sAttributeName, sAttributeValue);<br />
  }<br />
  catch (e)<br />
  {<br />
    /* then try it another way<br />
    */</p>
<p>    /* build HTML string for clone input */</p>
<p>    //get all attributes<br />
    var aoAttributes = oInputElement.attributes;<br />
    var iLength      = aoAttributes.length;</p>
<p>    //create html string for new input element<br />
    var sHTML = &#8220;&#8216;;</p>
<p>    /* create new element using the HTML string */<br />
    oNewElement = document.createElement(sHTML);</p>
<p>    /* replace old element with new one */<br />
    oInputElement.parentNode.replaceChild(oNewElement, oInputElement);<br />
  }<br />
}</p>
<p>Good luck!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 太阳神 &#187; 博客文章 &#187; 利用JavaScript DOM函数动态创建radio buttons后在IE里无法做选择问题的解决</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-548</link>
		<dc:creator>太阳神 &#187; 博客文章 &#187; 利用JavaScript DOM函数动态创建radio buttons后在IE里无法做选择问题的解决</dc:creator>
		<pubDate>Wed, 06 Dec 2006 05:44:52 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-548</guid>
		<description>[...] 参考：1、http://www.thunderguy.com/semicolon/2005/05/23/setting-the-name-attribute-in-internet-explorer/2、http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/ [...]</description>
		<content:encoded><![CDATA[<p>[...] 参考：1、http://www.thunderguy.com/semicolon/2005/05/23/setting-the-name-attribute-in-internet-explorer/2、http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/ [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kiran</title>
		<link>http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/comment-page-1/#comment-214</link>
		<dc:creator>Kiran</dc:creator>
		<pubDate>Thu, 21 Sep 2006 06:36:56 +0000</pubDate>
		<guid isPermaLink="false">http://tag-strategia.com/blog/?p=31#comment-214</guid>
		<description>Finished…

I finally got it all to work the way I want it. The next script has been tested in: IE6.0, NS7.1, MFirefox1.5, and Mozilla 1.6 on XP service pack 1. Don’t know about any Mac browsers or other compatibilities…

thanx for the help!



but if u have more rows coming dynamically u ll get prob again. so just follow this code so that u ll get perfect result.

replace

inp.setAttribute(’onfocus’, “this.select();”);

&amp;&amp;&amp; 

inp.setAttribute(’onfocus’, function(){this.select();}); 


with following code

inputTag3.setAttribute(&#039;onblur&#039;, function(){convertToUpperCase(this);}); 


and in fucntion convertToUpperCase() write as follows.

 function convertToUpperCase(fieldId)
	{
		fieldId.value = fieldId.value.toUpperCase();
	}</description>
		<content:encoded><![CDATA[<p>Finished…</p>
<p>I finally got it all to work the way I want it. The next script has been tested in: IE6.0, NS7.1, MFirefox1.5, and Mozilla 1.6 on XP service pack 1. Don’t know about any Mac browsers or other compatibilities…</p>
<p>thanx for the help!</p>
<p>but if u have more rows coming dynamically u ll get prob again. so just follow this code so that u ll get perfect result.</p>
<p>replace</p>
<p>inp.setAttribute(’onfocus’, “this.select();”);</p>
<p>&amp;&amp;&amp; </p>
<p>inp.setAttribute(’onfocus’, function(){this.select();}); </p>
<p>with following code</p>
<p>inputTag3.setAttribute(&#8217;onblur&#8217;, function(){convertToUpperCase(this);}); </p>
<p>and in fucntion convertToUpperCase() write as follows.</p>
<p> function convertToUpperCase(fieldId)<br />
	{<br />
		fieldId.value = fieldId.value.toUpperCase();<br />
	}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
