Click to See Complete Forum and Search --> : How to change field value of subwindow?


marmot101
07-30-2003, 02:55 PM
Hi, All,

I create a subwindow and want to fill in some field by default, how can I do that?

My code is like:

function openNewWindow() {
win = window.open("Mypage.html", 'smallwin', 'resizable=yes');
win.document.Form_Login.user_name.vaule = "me";
}

When I run above code, it doesn't work. However, if I put this code in
"Mypage.html", it works fine (automatically set the user_name field to "me")

Is this because IE tighten the security rule and forbid javascript to change value of subwindow?

pyro
07-30-2003, 03:25 PM
Just a type... You misspelled value. ;)

marmot101
07-30-2003, 07:55 PM
oops, that's a typo :)

However, this is the real page, still not working, any idea? IE reports an error in the page.

BTW, I just test, if both pages are on my machine, it works.

=========================================

<html>
<head>
<script language="JavaScript">
var win;

function AutoLogin() {
win = window.open("http://login.yahoo.com/config/login?.src=www&.done=http://www.yahoo.com", "smallwin", "resizable=yes");
setTimeout("changeValue()", 2500);
}

function changeValue() {
win.document.login_form.login.value = "username";
win.document.login_form.passwd.value = "password";
//win.document.login_form.submit();
}
</script>
</head>
<body>
<h1>This is test page</h1>
<a href="#" onclick="AutoLogin();">Test</a>
</body>
</html>
===========================================

pyro
07-30-2003, 09:08 PM
A typo on typo? wow... :D

Anyway, due to security protocols, javascript can't access/modify information on different domains...