Click to See Complete Forum and Search --> : Forms, Iframes, etc...
Bhima
06-28-2003, 04:53 AM
I have a web page. On the page there is an IFrame and in that IFrame there is a web page with a Form in it. The forms name is 'bhimaform' and the form contains a text box called 'bhimatext'. In the main web page, the one with the IFrame in, there is also a button. When you click the button, it calls up a javascript function called bhima(). bhima() at the moment does nothing but I want it to make the value of the text box in the web page in the IFrame to change to 'bhima'. What do I write in the bhima() function to make this happen?:confused: :confused: :confused: :confused:
Charles
06-28-2003, 05:56 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Example</title>
<iframe name="bhimaframe" src="test2.html"><p><a href="test2.html">test2.html</a></p></iframe>
<script type="text/javascript">
<!--
if (document.bhimaframe) {
document.write('<button name="bhima">Bhima</button>');
document.getElementById('bhima').onclick = function () {document.bhimaframe.bhimaform.bhimatext.value = 'bhima'}
}
// -->
</script>
Bhima
06-28-2003, 07:07 AM
It doesn't work!
take a look:
http://www.geocities.com/badboybdb2/Alex.html
Does it work for you?
PS: I modified your script a bit because it didn't work AT ALL at first.
Charles
06-28-2003, 07:21 AM
I tested my method above before posting and found that all was well.
A full 13% of users do not use JavaScript and some use browsers that do not understand IFRAMEs. You need to use JavaScript to draw the button to avoid embarrassing yourself.
Your problem is a security thing. You're not allowed to play around with other people's forms.
Bhima
06-28-2003, 07:42 AM
Did it work for you?
I was just using that page in the IFrame as an example.
Charles
06-28-2003, 07:53 AM
Originally posted by Charles
I tested my method above before posting and found that all was well.