Click here to Skip to main content
11,432,168 members (54,319 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
i have a html page with iframe having login input n password and submit button...... now how i determine on my parents page that the submit of iframe is called or the submit on parent page is called ......
Posted 19-Dec-12 3:26am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hello, please follow this sample:

Parent page:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
 
      <script type="text/javascript">
 
          function alert_me() {
              alert('hello this is parent');
 
          }
      </script>
 </head>
 <body>
 <iframe src="iframePage.aspx" width="800px" height="600px">
 </iframe>
 </body>
</html>


Iframe Page( Child Page):

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 
    <script type="text/javascript">
 
        function ClickMe() {
            parent.alert_me('hello there!');
        }
    </script>
 </head>
    <body>
        <br/>
        <br/>
        <input type="button" value="Click me" id="button_click" onclick="ClickMe()"/>
    </body>
</html>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This looks not too honest to me. If both sources are yours, avoid using iframe. But look around on the following urls...

First consult the "same origin policy": http://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_DOM_access[^].

Than read the really exhaustive tutorial here: http://stackoverflow.com/questions/3076414/ways-to-circumvent-the-same-origin-policy[^], and maybe watch this screencast too. http://alexsexton.com/blog/2011/06/breaking-the-cross-domain-barrier-screencast/[^]
  Permalink  
Comments
vaibhavraidwivedi at 19-Dec-12 8:50am
   
both on same domain

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150428.2 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100