I am using iFrame in my application. Let me give you an example here. I have a homepage like
<html>
<head>
<script src='jquery.js'></script>
<script>
function TestFunction()
{
var FirstName = $("#first_name").val();
alert(FirstName);
}
</script>
<head>
<body>
Enter First Name: <input type='text' size='20' id='first_name'><br />
<input type='button' value='Cilck' onclick='TestFunction();'><br />
<iframe id='test_iframe' src='test_iframe.htm' height='200' width='200'>
</iframe>
</body>
</html>
... and this works great with a warning about what is entered in the text box
But is it possible to call the same function in the iframe, which will warn the value present in the text field of the parent page?
Assume the code test_iframe.htm is similar to this
<html>
<head>
<script src='jquery.js'></script>
<script>
function IframeFunction()
{
TestFunction();
}
</script>
<head>
<body>
<input type='button' value='Click' onclick='IframeFunction();'>
</body>
</html>
Can this be done?
source
share