...

View Full Version : assign a variable to textbox



shannon
01-26-2005, 02:19 PM
Morning,
I need to assign a variable in one frame to a textbox in another when the textbox page opens.

In a frame named "content" I have
<input type="text" name="T122" size="20" style="position: absolute; left: 213; top: 77; height: 15px; width: 380px; font-size: 8pt; text-transform: uppercase; font-weight: bold; text-align: center; border: 1px solid #FFFFFF" tabindex="1">

The variable is parent.content1.jNum
I need to be able to have this textbox's value show the variable when the page opens in its frame....any ideas would be appreciated
Shannon

Kor
01-26-2005, 04:04 PM
try this in frame's head



<script language="JavaScript" type="text/JavaScript">
onload=function(){document.forms[0].elements['T122'].value=parent.document.forms['content1'].elements['jNum'].value}
</script>


But I am a little cofused... Where is the variable to be passed? (parent? another frame?)

shannon
01-26-2005, 07:06 PM
Thanks for replying KOR,
Perhaps I was unclear...I have a frame called "content" in which a page opens in, that has a text box
(no form associated with this text box -css type page)
This Text box is called T122.
I need this textbox to display the value of jNum when the page is opened in its frame. jNum is a variable in another frame called "content1"
hope this is clearer.
shannon

Kor
01-27-2005, 08:41 AM
no form associated

Than associate it simply nest the text box inside a form
<form>
...your text box
...
</form>

and the code should work

glenngv
01-27-2005, 11:42 AM
As I understand, jNum is a variable and not an element's name.


onload = function(){
document.forms[0].elements['T122'].value = parent.frames['content1'].jNum;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum