the src int he iframe needs to access parent's java script. I have to
set src.

On Feb 6, 2:02 pm, "Andy Matthews" <li...@commadelimited.com> wrote:
> It might be easier to just use the location method.
>
> <yourTarget>.location.href = 'newlink.html';
>
> -----Original Message-----
> From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On
>
> Behalf Of cindy
> Sent: Friday, February 06, 2009 3:35 PM
> To: jQuery (English)
> Subject: [jQuery] how to change the iframe src
>
> Hi,
>
> what I want to do is to change iframe src, when click the tab. The click
> function is called, but the iframe src is not changed at all. Do you know
> what is wrong?
>
> Cindy
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
>         <meta content="text/html; charset=iso-8859-1" http-equiv="Content-
> Type"/>
>     <title>RAP Console</title>
>     <link type="text/css" media="screen" rel="stylesheet" href="clilib/
> mainpage.css">
>     <script src="jscripts/wizard/jquery-1.2.3.pack.js" type="text/
> javascript"></script> </head> <script> var refreshTime=30000; var
> summaryTab=1; var connectTab=2; var diagTab=3; var isSummaryInit= true; var
> isConnectInit=false; var isDiagInit=false; var mode="protype"; var
> currentTab=summaryTab;
>
> function clickTab( tabName)
> {
>         if(tabName==currentTab) return;
>         if(tabName==summaryTab)
>         {
>
> $('summaryframe'+'iframe').attr("src","http://www.google.com";);
>                   setFocus('summaryframe');
>         }
>         else if(tabName==connectTab)
>         {
>
> $('connectframe'+'iframe').attr("src","http://www.yahoo.com";);
>                  setFocus('connectframe');
>         }
>         else if(tabName==diagTab)
>         {
>                 $('diagframe'+'iframe').attr("src","http://www.yelp.com";);
>                 setFocus('diagframe');
>         }
>         currentTab=tabName;
> };
>
> $(document).ready(init);
> function init()
> {
>         $('#Summary').bind('click',function(){clickTab(summaryTab)});
>         $('#Connectivity').bind('click',function(){clickTab(connectTab)});
>         $('#Diag').bind('click',function(){clickTab(diagTab)});
> };
>
> </script>
> <body>
>         <div id="header">
>         <div id="title"><img src="images/alogo.gif"></div>
>         <div id="header_logo"><img src="images/ogo.gif"></div>
>         </div>
>     <div id="tab">
>                 <ul id="tab_ul" class="up">
>                         <li id="Summary">Summary</li>
>                         <li id="Connectivity">Connectivity</li>
>                         <li id="Diag">Diagnostics</li>
>                 </ul>
>         </div>
>         <div id="global_content">
>                 <div id="status">Connection Status:</div>
>         <div id="updateTime"> Last updated: 10:31:14 AM</div>
>         <div id="refresh">Refresh</div>
>         <div id="gensupport"> Generate & save support file</div>
>         </div>
>         <div id="frame">
>                 <div id=""summaryframe">
>                         <iframe width="100%" height="100%"
> frameborder="1"></iframe>
>                 </div>
>                 <div  id ="connectframe">
>                         <iframe width="100%" height="100%"
> frameborder="1"></iframe>
>                 </div>
>                 <div  id ="diagframe">
>                         <iframe  width="100%" height="100%"
> frameborder="1"></iframe>
>                 </div>
>         </div>
> </body>
>  </html>

Reply via email to