Using ajax to change iframe - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:ajax

Description

Using ajax to change iframe

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.4.3.min.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  w w  w .j a v a2s  .  c  om*/
$('#changeframe').click(function() {
    $('#googframe').attr('src','http://www.java2s.com');
});
    });

      </script> 
 </head> 
 <body> 
  <iframe id="googframe" src="http://www.google.com"></iframe> 
  <input type="button" id="changeframe" value="Change">  
 </body>
</html>

Related Tutorials