| 1 | <?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 | <!DOCTYPE html |
|---|
| 3 | PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
|---|
| 4 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
|---|
| 5 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
|---|
| 6 | <head> |
|---|
| 7 | <title>Test switch focus in different ways in Webkit</title> |
|---|
| 8 | <script> |
|---|
| 9 | function focusLoop() |
|---|
| 10 | { |
|---|
| 11 | var i = 1; |
|---|
| 12 | window.setInterval( function() |
|---|
| 13 | { |
|---|
| 14 | document.getElementById( 'focus' + i++ ).focus(), |
|---|
| 15 | i = i > 3 ? 1: i; |
|---|
| 16 | }, 1000 ); |
|---|
| 17 | } |
|---|
| 18 | </script> |
|---|
| 19 | </head> |
|---|
| 20 | <body> |
|---|
| 21 | <h2>Call the "focusLoop" function in three ways:</h2> |
|---|
| 22 | <dl> |
|---|
| 23 | <dt>From console.</dt><dd>Result: No focus swtich.</dd> |
|---|
| 24 | <dt>From location toolbar.</dt><dd>Result: No focus switch.</dd> |
|---|
| 25 | <dt>From this <button onclick="focusLoop()">button</button></dt><dd>Result: Focus swtich seen.</dd> |
|---|
| 26 | </dl> |
|---|
| 27 | |
|---|
| 28 | <div> |
|---|
| 29 | <p>Focus testing area:</p> |
|---|
| 30 | <input id="focus1" type="button" value="text input" /> |
|---|
| 31 | <textarea id="focus2" rows="3">text area</textarea> |
|---|
| 32 | <a id="focus3" href="http://webkit.org">link</a> |
|---|
| 33 | </div> |
|---|
| 34 | </body> |
|---|
| 35 | </html> |
|---|