...

View Full Version : passing value problem



JohnnyD
05-02-2006, 03:04 PM
I'm trying to passing values between 2 pages it works when I open page2.html in another frame(mainFrame), but when I want it to open in the same frame(leftFrame) it dosn't work??



source.html (in leftFrame)

<head>
<script language="JavaScript" type="text/javascript">
<!--

function newWindow(file,window) {
msgWindow=open(file,window,'');
if (msgWindow.opener == null) msgWindow.opener = self;
}
//-->
</script>
<body>
<form name="form1a" id="form1a">
<input name="textfield" type="text" value="10" />
<input name="textfield2" type="text" value="20" />

<input type="button" value="Open New Window" onClick="newWindow('page2.html','leftFrame')">
</form>
</body>


page2.html( to open in the same frame)
<head>
<script language="JavaScript"><!--
var etta = opener.document.form1a.textfield.value;
var tvoa = opener.document.form1a.textfield2.value;
function value() {

document.form1.textfield.value=etta;
document.form1.textfield2.value=tvoa;

}
//--></script>


</head>

<body onload="value()">
<form id="form1" name="form1" method="post" action="">
<input name="textfield" type="text" readonly="1" />
<input name="textfield2" type="text" readonly="1" />
</form>


</body>

:confused:

Mr J
05-02-2006, 09:24 PM
To open in the same window you would probably have to use the query string

The information here may help you.

www.huntingground.freeserve.co.uk/scripts/passdata/p_data1.htm

JohnnyD
05-02-2006, 10:10 PM
:thumbsup:

Thank you MR J

I belive that will help me.

You saved my day

JohnnyD



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum