/    Sign up×
Community /Pin to ProfileBookmark

Onclick, get a value on an other page

Hi, I made a form and I have some difficulties with this:

I have an iframe in my html page (motorola-t720.html).
In this iframe, i have two radio button, and I would like to get the value in the page “motorola-t720.html” in the text field name “telephonetotal” and the form name “myform”.

Here is my code, It doesn’t work
Help me please
Rachel

<SCRIPT LANGUAGE=”JavaScript”>
<!–
function telpaiement()
{
window.location.href=”motorolla-t720.html?resultat=”+telephonetotal;
}
–>
</script>

<form method=”get” name=”descriptionplan”>
<table class=”Description” width=”320″ border=”0″ cellspacing=”1″ cellpadding=”2″>
<tr>
<td colspan=”2″ width=”325″><b>Abonnement/coût du téléphone</b><br>
<input type=”radio” name=”paiement” value=”130.00″ border=”0″ onclick=”telpaiement()”> un an – 130.00$<br>
<input type=”radio” name=”paiement” value=”25.00″ border=”0″ onclick=”telpaiement()”> deux ans – 25.00$<br>
<br>
</td>

</tr>
</table>

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@steelersfan88Mar 02.2004 — Try this:[code=php]<SCRIPT LANGUAGE="JavaScript">
<!--
function telpaiement(val)
{
document.frames['top'].myForm.telephonetotal.value = val
}
-->
</script>

<form method="get" name="descriptionplan">
<table class="Description" width="320" border="0" cellspacing="1" cellpadding="2">
<tr>
<td colspan="2" width="325"><b>Abonnement/coût du téléphone</b><br>
<input type="radio" name="paiement" value="130.00" border="0" onclick="telpaiement(this.value)"> un an - 130.00$<br>
<input type="radio" name="paiement" value="25.00" border="0" onclick="telpaiement(this.value)"> deux ans - 25.00$<br><br></td></tr></table>[/code]
This will send the value to the text box on the main frame from the iframe!
Copy linkTweet thisAlerts:
@KorMar 02.2004 — or

top.frames['[i]iframe_name[/i]'].document.myForm.telephonetotal.value = val

you must name iframe somehow...
Copy linkTweet thisAlerts:
@fredmvMar 02.2004 — Note that you could alsoe reference it using its index in the array.
Copy linkTweet thisAlerts:
@steelersfan88Mar 02.2004 — Note: If you want to change the text box value from the iframe, see my first post.

If have a button on the mainframe to retrieve the value of the radio button in the iframe, see Kor's post above.

And yes, it would be easier to do fredmv, your right ... again
Copy linkTweet thisAlerts:
@KorMar 02.2004 — I didn't want to intricate the solution, yes, you may use the order index, without give a neme.

I think the bellow may be the same correct reference:

top.frames[[i]i[/]].document.myForm.telephonetotal.value = val



where i is the order number of your iframes/frames in page, top to bottom. If first or if only one, i=0



top.frames[0].document.myForm.telephonetotal.value = val
Copy linkTweet thisAlerts:
@rnadeauauthorMar 02.2004 — Hi, my iframe is an other web page so I need to call my web page that contains my iframe

But thanks so much for your help

You can see my page at:

http://www3.sympatico.ca/nadeaulise/datacanada/motorola-t720/motorola-t720.html
Copy linkTweet thisAlerts:
@KorMar 03.2004 — 
my iframe is an other web page
[/quote]


In this case, for implemented security reasons, it is almost impossible to refere something on the other page.

Reference between perent-iframe works only if in iframe is a page from the same site.

I say almost, as there may be an ActiveX solution to get a value from other web page. And, of course, there are the server-side solutions.

Javascript ca not do that.
Copy linkTweet thisAlerts:
@rnadeauauthorMar 04.2004 — Yes the two pages are in the same folder of my web site.

Is it possible to get a javascript, I saw one time some thing like that

<SCRIPT LANGUAGE="JavaScript">
<!--

function telpaiement()

{

window.location.href="motorolla-t720.html?resultat="+telephonetotal;

}

-->

</script>

So i would like to have my value from a radio button of my iframe to an other page name: motorola-t720.html in the text field name:telephonetotal

thank you

Rachel
×

Success!

Help @rnadeau 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 5.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...