root / trunk / tests / html / ie_byId_bug.html

Revision 5739, 2.9 kB (checked in by bill, 2 years ago)

Fixes #1415 (dojo.byId fails due to IE bug confusing name attribute and id attribute)

Patch from Doug Hays (IBM, CCLA on file)

  • Property svn:eol-style set to native
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3        <head>
4                <title>document.getElementById bug</title>
5
6                <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
7                <meta name="author" content="" />
8                <meta name="robots" content="all" />
9                <meta name="MSSmartTagsPreventParsing" content="true" />
10                <meta name="Description" content="" />
11
12                <meta name="DC.Date" content="2005-01-10" />
13                <meta name="Keywords" content="" />
14
15                <script type="text/javascript"> djConfig = { isDebug: true }; </script>
16<script type="text/javascript" src="../../dojo.js"></script>
17<script type="text/javascript">
18function testMe(){
19alert('dojo.byId(\'foo\'): value='+dojo.byId('foo').value + ' , id=' + dojo.byId('foo').id + ', name:' + dojo.byId('foo').name + "\n" + ' dojo.byId( \'bar\') =: value='+dojo.byId('bar').value + ', id=' + dojo.byId('bar').id + ', name:' + dojo.byId('bar').name );
20
21}
22</script>
23          <style type="text/css">
24<!--
25.style1 {color: #FF0000}
26.style2 {color: #009900}
27-->
28    </style>
29        </head>
30        <body>
31        original: <a href="http://www.csb7.com/test/ie_getelementbyid_bug/index.php">http://www.csb7.com/test/ie_getelementbyid_bug/index.php</a>
32        <p>This page tests a bug in Internet Explorer whereby the document.getElementById()
33        function may return an element with a name attribute equal to the id that is
34        specified. This can cause unexpected results.</p>
35
36        <p>Test case:</p>
37
38        <form name="form1" id="form1" method="get" action="javascript: void(0)" style="border: 1px dashed red;">
39                <table width="100%%"  border="0" cellspacing="0" cellpadding="2">
40        <tr>
41                <td nowrap="nowrap"><input name="bar" type="text" id="foo" value="foo" readonly="readonly" /></td>
42                <td>&nbsp;</td>
43                <td width="100%">&lt;input name=&quot;bar&quot; type=&quot;text&quot; id=&quot;foo&quot; value=&quot;foo&quot; /&gt;</td>
44
45                </tr>
46        <tr>
47                <td nowrap="nowrap"><input name="foo" type="text" id="bar" value="bar" readonly="readonly" /></td>
48                <td>&nbsp;</td>
49                <td width="100%">&lt;input name=&quot;foo&quot; type=&quot;text&quot; id=&quot;bar&quot; value=&quot;bar&quot; /&gt;</td>
50
51                </tr>
52        <tr>
53                <td nowrap="nowrap">&nbsp;</td>
54                <td>&nbsp;</td>
55                <td width="100%">&nbsp;</td>
56                </tr>
57        <tr>
58                <td nowrap="nowrap"><input type="button" name="Button" value="Test" onclick="testMe();" /></td>
59                <td>&nbsp;</td>
60
61                <td width="100%">This <em>should</em> show an alert box where foo=foo and
62                        bar=bar </td>
63                </tr>
64        </table>
65        </form>
66        <p>Reported at <a href="http://www.quirksmode.org/bugreports/index.html">http://www.quirksmode.org/bugreports/index.html</a> 2005-08-29</p>
67
68        <p>Noted on <a href="http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerProgrammingBugs">http://channel9.msdn.com/wiki/default.aspx/Channel9.InternetExplorerProgrammingBugs </a></p>
69        </body>
70</html>
Note: See TracBrowser for help on using the browser.