请教:如何实现输入数字,跳转到相应页面? 比如说:站点有一大堆网页是A001.HTML,A002.HTML,...A999.HTML格式的。我想做一个表单,通过输入相应的数字(不带前面的A),然后点击按钮就跳转到相应的页面。该怎么写代码?谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <!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> <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> 最好用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> 3楼的,我不赞同你的观点。因为数量很多,达到1000多呢,我就是考虑到select不方便找,才求助的! 其实1楼也给我提供了参考,只要把top.location='HTMLPage'+document.getElementById("num").value+".htm"改为top.location='A'+document.getElementById("num").value+".html"即可。另外,补充一下,如果不足3位的,不加前面的0该怎么做?比如:跳转到第2页,可是它是A002.html,那么仅输入2用什么代码? 哪有什么不方便的!也不用我从001输到1K!如要有规律用很少js代码就出来了!随你便 我就是考虑到select不方便找re:你可以把size的值放大呀! 获取页面的位置 请教高手 怎么用JS获取word文档中的内容 EXT propertygrid 求助(高手入啊) Ext.grid.property.Grid 如何让文字翻转180度 有没有快速查询JAVA脚本,方法与对象的手册? Extjs4 store给store赋值问题 请教一个与addnew相关的问题! setInterval()停上调用? 高分求教:怎样实现表单内容的检测? escape(string)转换的16进制和JSP 里用URLEecoder.encode(string)...? 急!!!高手解答 关于时间的,急用?围观...
<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>
<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>
<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>
top.location='HTMLPage'+document.getElementById("num").value+".htm"
改为top.location='A'+document.getElementById("num").value+".html"
即可。
另外,补充一下,如果不足3位的,不加前面的0该怎么做?
比如:跳转到第2页,可是它是A002.html,那么仅输入2用什么代码?
re:
你可以把size的值放大呀!