比如说:
站点有一大堆网页是A001.HTML,A002.HTML,...A999.HTML格式的。
我想做一个表单,通过输入相应的数字(不带前面的A),然后点击按钮就跳转到相应的页面。
该怎么写代码?
谢谢

解决方案 »

  1.   

    <!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>
        <title>无标题页</title>
        <script language="javascript">
        function jump()
        {
            top.location='HTMLPage'+document.getElementById("num").value+".htm";
        }
       </script>
    </head>
    <body>
        <input type="text" id="num" />
        <input type="button" onclick="jump()" />
    </body>
    </html>
      

  2.   


    <form id='form1' onsubmit=' window.location.href="A"+this.elements["idx"].value+".HTML";return false'>
      <input id='idx' name='idx' value='001' />
      <input type='submit' />
    </form>
      

  3.   

    最好用select!用input会有麻烦<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <select name="1" size="1" onchange="window.location.href='http://www.'+this.options[this.selectedIndex].value+'.com/'; ">
       <option value="google">google</option>
       <option value="yahoo">yahoo</option>
       <option value="msn">msn</option>
       <option value="ask">ask</option>
    </select>
    </body>
    </html>
      

  4.   

    3楼的,我不赞同你的观点。因为数量很多,达到1000多呢,我就是考虑到select不方便找,才求助的!
      

  5.   

    其实1楼也给我提供了参考,只要把
    top.location='HTMLPage'+document.getElementById("num").value+".htm"
    改为top.location='A'+document.getElementById("num").value+".html"
    即可。
    另外,补充一下,如果不足3位的,不加前面的0该怎么做?
    比如:跳转到第2页,可是它是A002.html,那么仅输入2用什么代码?
      

  6.   

    哪有什么不方便的!也不用我从001输到1K!如要有规律用很少js代码就出来了!随你便
      

  7.   

    我就是考虑到select不方便找
    re:
    你可以把size的值放大呀!