/    Sign up×
Community /Pin to ProfileBookmark

parent and Iframe problem writing to textbox.

Can’t seem to get this to work?

This function is in the Parent

Tried this does’nt work->

[CODE]parent.document.generator1a.[‘frm2’].nameid.value=”Welcome”
[/CODE]

Tried this does’nt work, thats weird ?->

[CODE]parent.document.generator1a[‘frm2’].nameid.value=”Welcome”
[/CODE]

I did try without the parent.

[CODE]
document.generator1a[‘frm2’].nameid.value=”Welcome”
[/CODE]

this is frm2

[CODE]
<form action=”#” name=”generator1a”>
<div>
<input style=”color: pink; background-color: black” type=’text’ name=’nameid’ id=’nameid’ value=’0′ />
</div>
</form>

[/CODE]

to post a comment
JavaScript

11 Comments(s)

Copy linkTweet thisAlerts:
@nikaJan 10.2009 — To update the content of input field from document:
[code=html]document.generator1a.nameid.value="Welcome"[/code]

To update [b]from parent[b] an iframe content, try something like this (i'm not sure about the syntax):



[code=html]document.frames[frm2].document.generator1a.nameid.value="Welcome"[/code]
Copy linkTweet thisAlerts:
@orlandoauthorJan 10.2009 — Hmm did not work??

should I take it out of

'forms' 'generator1a' is form name I put the parent in there because it did not work with it or without ?

[CODE]
parent.document.frames[fr2].document.generator1a.usercounter7.value="Welcome"

[/CODE]


Like this
[CODE]
parent.document.frames[fr2].document.usercounter7.value="Welcome"

[/CODE]
Copy linkTweet thisAlerts:
@nikaJan 10.2009 — this code works in IE6:
[code=html]document.frames["fr2"].document.generator1a.usercounter7.value="Welcome"[/code]

("fr2" is the name of iframe).

Regarding the parent issue - when you write 'parent.document' outside the iframe, you are getting [u]to the parent of iframe parent[/u]
Copy linkTweet thisAlerts:
@orlandoauthorJan 10.2009 — I am Using IE 7.0.

parent source I am not writing the full source its to large just

writing parts ?

did not work?.
[CODE]
<button type="button" onclick="reloadxx()">test call</button>

<script type="text/javascript">


function reloadxx() {

alert("ready")



document.frames["fr2"].document.generator1a.usercounter7.value="Welcome"


alert("if it gets here it worked!")
}
</script>
[/CODE]



fr2 source

[CODE]

<form action="#" name="generator1a">
<div>
<input style="color: pink; background-color: black" type='text' name='usercounter7' id='UserCounter7' value='0' />usercounter7
</div>
</form>

[/CODE]
Copy linkTweet thisAlerts:
@lepiJan 10.2009 — parent.fr2.document.generator1a.usercounter7.value="Welcome"
Copy linkTweet thisAlerts:
@orlandoauthorJan 10.2009 — lepi Thanks it worked! at first it did 'nt.

parent.fr2 - my iframe name is frm2 .


[CODE]
parent.frm2.document.generator1a.usercounter7.value="Welcome"

[/CODE]
Copy linkTweet thisAlerts:
@lepiJan 10.2009 — u said fr2 in ur posts ?

and u r welcome ?
Copy linkTweet thisAlerts:
@orlandoauthorJan 10.2009 — sorry my typos... I was typing to fast...?
Copy linkTweet thisAlerts:
@lepiJan 10.2009 — u can use this code too (as i remember)

parent.frames["frm2"].document....
Copy linkTweet thisAlerts:
@orlandoauthorJan 10.2009 — Cool I like your first source.

I added it to my Javascript source code collection.

[CODE]parent.frm2.document.generator1a.usercounter7.value="Welcome"
[/CODE]

?
Copy linkTweet thisAlerts:
@lepiJan 10.2009 — kewl ?

chears
×

Success!

Help @orlando spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...