aaa.html页面上有一段js,实现根据变量ttt值的不同,载入不同的页面
//ttt是一个变量值
ttt=111
if (ttt != ""){
//使当前页面载入111.html这个框架页}
else{
//使当前页面载入222.html这个框架页
}在普通的.html页面上载入框架基本代码是<iframe width="800" height="500" src="111.html"></iframe>请问//使当前页面载入111.html这个框架页处该怎么写呢?

解决方案 »

  1.   

    var a=document.getElementById("a");
    if(a){a.src="111.html";}
    else{
    a=document.createElement("iframe");
    a.id="a";
    a.src="111.html";
    }
      

  2.   

    if (ttt != ""){
    location.href = '111.html';//使当前页面载入111.html这个框架页}
    else{
    //使当前页面载入222.html这个框架页
    }
      

  3.   

    <iframe id="test" width="800" height="500" src="111.html"> </iframe> 
    ttt=111 
    if (ttt != ""){ 
    document.getElementByID("test").src='你的框架页面';
    else{ 
    document.getElementByID("test").src='你的框架页面';}