...

View Full Version : calling function



LukeJrs
05-12-2007, 08: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.


Like

here a example

client.html

<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() {
alert('testing')
}
</script>

<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')
}
</script>

</head>
<body>

<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"
name="RSIFrame"
style="width:0px; height:0px; border: 0px"
src="blank.html"></iframe>

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

</body>
</html>


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

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum