解决方案 »

  1.   

    <head>
    <script type="text/javascript" src=css/js.js></script>
    <script>
    function $(id){
    return document.getElementById(id);
    }
    function t(){
    var num=1;
    var n='t';
    num+=1;
    name=n+num;
    if(num<4){ //页面数,总共有3页
    $(name).selected='selected';
    $('frameid').src=name;
    }
    }
    </script>
    </head>
    <body>
     <select id="page">
     <option value="t1.html" selected id="t1">t1.html</option>
     <option value="t2.html" id="t2">t2.html</option>
     <option value="t3.html" id="t3">t3.html</option>
     </select>
     <iframe id=frameid src="test.php" width=100 height=100 onload="t()"></iframe>
    </body>
    这个可以吗
      

  2.   

    to jbk3311 :感谢您的回复。
    不过option中t1.html这个并不是有t1,t2,t3这样的规律的,是没有规律的随机的页面。
    非自动的时候是通过<select id="page" onchange="xxx();">这样调用相应页面的。
    现在就是想让自动按selectindex顺序调用。
      

  3.   


    <select id="page">
      <option value="1.html" selected>1.html</option>
      <option value="2.html">2.html</option>
      <option value="3.html">3.html</option>
    </select>
    <iframe id="frameid" src="1.html" width=100 height=100></iframe>
    <script type="text/javascript">
    document.getElementById("frameid").onload = function ()
    {
    var sel = document.getElementById("page");
    if(sel.selectedIndex<sel.options.length-1)
    {
    sel.selectedIndex++;
    document.getElementById("frameid").src = sel.value;
    }
    }
    </script>
      

  4.   

    太感谢了!测试的结果如下:
    不过顺序是自动播放了,但是页面跳转太快了。没有等1.html,2.html执行完成就快速跳转到最后一个页面3.html,是否有办法控制这个速度或者是加一个时间,比如1分钟,2分钟然后再跳转到下一个页面。时间跳转间隔可自己定义的?
      

  5.   

    规则是:比如有可能1.html需要30秒,2.html需要50秒,每个页面的执行时间是已知的。
      

  6.   

    var time = [20,50,30];
    document.getElementById("frameid").onload = function ()
    {
    var sel = document.getElementById("page");
    if(sel.selectedIndex<sel.options.length-1)
    setTimeout(function(){
    sel.selectedIndex++;
    document.getElementById("frameid").src = sel.value;
    },time[sel.selectedIndex]*1000);
    }
      

  7.   


    var time = [20,50,30];
    document.getElementById("frameid").onload = function ()
    {
    var sel = document.getElementById("page");
    if(sel.selectedIndex<sel.options.length-1)
    setTimeout(function(){
    sel.selectedIndex++;
    document.getElementById("frameid").src = sel.value;
    },time[sel.selectedIndex]*1000);
    }