PDA

View Full Version : is it possible to run a function from another frame?



smansakra
01-22-2009, 09:27 AM
hello... is it possible to run a function from another frame?

let's see this example
<html>
<head>
<title>hum</title>
<script type="text/javascript">
function check(){
// the code is here
}
</script>
</head>
<body>
ha ha

<iframe src="onother_iframe.html"></iframe>

</body>
</html>


what should i write on my "another_iframe.html" to execute/run "function check"? what i want there is: function check run on "this page" ( sorry i dont know how to call this contained frame page), not run on "another_iframe.html".

anyone?

jscheuer1
01-22-2009, 12:56 PM
Since check apparently does nothing, it is irrelevant which page it runs against, though it could be passed an argument. That argument could be a page or an element on a page. However, to run it from the page in the iframe, just do:


parent.check();

smansakra
01-23-2009, 10:02 AM
so simple, thanks..