Don't forget the space between iframe and id: $('#connectframe'+' iframe').attr("src","
Why do you have a concatination there anyway ??? $('#connectframe iframe').attr("src"," ---- Read jQuery HowTo Resource - http://jquery-howto.blogspot.com On Sat, Feb 7, 2009 at 4:08 AM, cindy <ypu01...@yahoo.com> wrote: > > I tried to use Richardo' method, it is still not working. > SourceCOde: > <!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"); > } > else if(tabName==connectTab) > { > $('#connectframe'+'iframe').attr("src","http://www.yahoo.com"); > } > else if(tabName==diagTab) > { > $('#diagframe'+'iframe').attr("src","http://www.yelp.com"); > } > 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/logo.gif"></div> > <div id="header_logo"><img src="images/logo.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> > > On Feb 6, 2:48 pm, Ricardo Tomasi <ricardob...@gmail.com> wrote: >> $('connectframe'+'iframe') >> >> should be >> >> $('#connectframe'+' iframe') (notice the whitespace) and so on.. >> >> On Feb 6, 7:34 pm, cindy <ypu01...@yahoo.com> wrote: >> >> > 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>