You have 2 issues
- By doing
nonClosableWindow.getContent().innerHTML = '<table width="100%"
height="100%"><tr><td valign="middle" align="center">'+ $
('login').innerHTML+"</td></tr></table>";
you will have your login's div code twice in the DOM, so two objects
with same ID. $('accessKey').focus() will have problem to find the
correct field.
You can get HTML code, remove the element and then display your
window or use $$ to be sure to get the correct one like this:
var html = $$("#" + nonClosableWindow.getId() + " #accessKey")
[0].innerHTML
- As you call $('accessKey').focus() juste after
nonClosableWindow.show(), it could be still "hidden" (because of the
fadein effect) and IE do not like it at all. You can do it in
afterFinish effect callback or just with a little timeout like this
setTimeout(function() {$('accessKey').focus()}, 100)
On Feb 6, 2007, at 2:52 AM, Todd Brady wrote:
I create a window object then set the html with a form element. I
want to set focus to the text field inside the form. Is this
possible?
This is the hidden div on the page with the html I want to use inside
the window:
<div id="login" style="visibility:hidden;"><form name="frmAccessKey"
method="post"
action="javascript:ajax_enterAccessCode('<? echo
($_SESSION[height]-300)/2;?>','<? echo ($_SESSION[width]-300)/2;?>')">
<div align="center">
<? if ($error == 1){ echo '<span
class="style27">Access code is invalid, please try again.</span><br
/>'; } ?>
Enter your access code to login: <br />
<input name="accessKey" type="password"
id="accessKey" style="font-size:24px;" size="8" maxlength="10" />
</div>
</form></div>
This is the script I use to make the window and set the html:
<script>
nonClosableWindow = new Window('dialog3', {className: "Gilouche",
title: "LOGIN",
top:topParam,
left:leftParam, width:300, height:100,
closable: false})
nonClosableWindow.getContent().innerHTML = '<table width="100%"
height="100%"><tr><td valign="middle" align="center">'+
$('login').innerHTML+"</td></tr></table>";
nonClosableWindow.show();
$('accessKey').focus();
</script>
I want to set focus to 'accessKey' but nothing seems to work.
Thanks!
_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com
_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com