 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
J. McConnell Guest
|
Posted: Fri Dec 01, 2006 1:44 am Post subject: Problem removing readonly in IE |
|
|
I am having trouble with the following code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
</head>
<body>
<input value='test' type='text' readonly='readonly'
onfocus='this.readOnly = false;'
onblur='this.readOnly = true;'></input>
</body>
</html>
In FF, this works as I would expect. When clicking on the input, the
readOnly property is set to false and the focus is given to the element,
with the cursor placed after the last character.
In IE, the readOnly property is set to false, but the element isn't
actually given focus. Instead, I have to click on the input a second
time in order to actually input text with the keyboard.
Is there a way to make this work the same in IE as it does in FF? I
have tried things like calling this.focus() and this.click() after
setting readOnly to false, but they have no effect.
Any help would be greatly appreciated.
Thank you,
- J. |
|
| Back to top |
|
 |
David Griffiths Guest
|
Posted: Thu Nov 08, 2007 1:27 am Post subject: Re: Problem removing readonly in IE |
|
|
Hi J
According to my book (JavaScript - the definitive guide.
In Netscape 4 event model , the onfocus handler function is passed an Event
object as an argument.
In the IE event model, no argument is passed, but the application Event
object is available as the event property of the Window Object that contains
the element.
HTH
Dave
"J. McConnell" <j-dot@j-dotonline.com> wrote in message
news:slrnemucv4.b64.j-dot (AT) kant (DOT) overstock.com...
| Quote: | I am having trouble with the following code:
?xml version="1.0" encoding="UTF-8"?
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"
head
title>Test</title
/head
body
input value='test' type='text' readonly='readonly'
onfocus='this.readOnly = false;'
onblur='this.readOnly = true;'></input
/body
/html
In FF, this works as I would expect. When clicking on the input, the
readOnly property is set to false and the focus is given to the element,
with the cursor placed after the last character.
In IE, the readOnly property is set to false, but the element isn't
actually given focus. Instead, I have to click on the input a second
time in order to actually input text with the keyboard.
Is there a way to make this work the same in IE as it does in FF? I
have tried things like calling this.focus() and this.click() after
setting readOnly to false, but they have no effect.
Any help would be greatly appreciated.
Thank you,
- J. |
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|