Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-26-2005, 02:19 PM   PM User | #1
shannon
New to the CF scene

 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
shannon is an unknown quantity at this point
assign a variable to textbox

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
shannon is offline   Reply With Quote
Old 01-26-2005, 04:04 PM   PM User | #2
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
try this in frame's head

PHP Code:
<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?)
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 01-26-2005, 07:06 PM   PM User | #3
shannon
New to the CF scene

 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
shannon is an unknown quantity at this point
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
shannon is offline   Reply With Quote
Old 01-27-2005, 08:41 AM   PM User | #4
Kor
Red Devil Mod


 
Kor's Avatar
 
Join Date: Apr 2003
Location: Bucharest, ROMANIA
Posts: 8,478
Thanks: 58
Thanked 379 Times in 375 Posts
Kor has a spectacular aura aboutKor has a spectacular aura about
Quote:
no form associated
Than associate it simply nest the text box inside a form
<form>
...your text box
...
</form>

and the code should work
__________________
KOR
Offshore programming
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
Kor is offline   Reply With Quote
Old 01-27-2005, 11:42 AM   PM User | #5
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
As I understand, jNum is a variable and not an element's name.
Code:
onload = function(){
  document.forms[0].elements['T122'].value = parent.frames['content1'].jNum;
}
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:09 AM.


Advertisement
Log in to turn off these ads.