View Full Version : calling function

05-12-2007, 09:11 AM
At my job we have intranet web page, Once i'm in the webpage we look customer information by their phone number after we put their phone number and hit enter. I get button to press to review their account.

The thing i'm trying to do is use Iframe as scr=mywebpage that i have for work then use the javascript that is on that iframe webpage from my work.


here a example


<input type="button" value="Client" onclick="window.parent.innerframe.handleResponse()">

<iframe id="innerframe" name="innerframe" src="server.html"></iframe>

here is the server.html

<script type="text/javascript">
function handleResponse() {

<input type="button" value="Server" onclick="handleResponse()">

as you notice the click work even the javascript is loaded on serverside but i was able to call it as a resource in my iframe.

here another one example

<input type="button" value="Client" onclick="window.parent.innerframe.handleResponse()">

<iframe id="innerframe" name="innerframe" src="http://developer.apple.com/internet/webcontent/client-simple.html"></iframe>

Now this javascript won't be able make the call because of something not right i'm trying to call a function from website http://developer.apple.com/internet/...nt-simple.html that inside the html have this source

<html><head><title>Remote Scripting with an IFrame - simple client page</title>

<script type="text/javascript">
function handleResponse() {
alert('this function is called from server.html')


<p>This is our client application. We want to be able to make calls to the server from this page without reloading.</p>

<iframe id="RSIFrame"
style="width:0px; height:0px; border: 0px"

<a href="server.html" target="RSIFrame">make RPC call</a>


I would like to call this function handleResponse() from my client.html window that I have iframe to connect a webpage

The thing is I want call javascript function from different site and just input a button to call it out from my client.html even though the javascript is not in my client is just in the website i'm linking to and trying call their function with a button on my client.html

05-12-2007, 07:27 PM
For security reasons, javascript has no access to a page on a different domain.

05-13-2007, 05:46 AM
Any other language beside javascript can do it? like java,php,c++, and etc?