当前位置:编程学习 > html/css >>

求一个简单的javascript功能的代码,做成一个html吧

页面就一个多行文本输入框,然后一个按钮。 我想要的效果就是:我在输入框里写进很多网址,是一行一条网址,如 www.zzzyk.com www.google.com www.sise.com.cn 点击确定按钮后浏览器自动弹出 www.zzzyk.com/aaaa www.google.com/aaaa www.sise.com.cn/aaaa 这个目录的路径网址, /aaaa,这里最好能让我输入多个,还有/bbbb,一次过弹出 www.zzzyk.com/aaaa www.google.com/aaaa www.sise.com.cn/aaaa www.zzzyk.com/bbbb www.google.com/bbbb www.sise.com.cn/bbbb
追问:那个网址输入的地方可以设置用一个多行文本输入框么,然后分开每一行一个网址
答案:hi 兄弟 你的30分我预定了行么? 。。。 先占个座,一会儿把代码再贴上来。。哈哈。。稍等。 

----------------

<html>
<head>
<script type="text/javascript">

function doit(){
	for(var i=1;i<99;i++){
		var startStr = "";
		if(document.getElementById("start"+i)!=null)
			startStr = document.getElementById("start"+i).value;
    		if(startStr!=""){
			for(var j=1;j<99;j++){
				var endStr = "";
				if(document.getElementById("end"+j)!=null)
					endStr = document.getElementById("end"+j).value;
				if(endStr!=""){
					var oneUrl = "http://" + startStr + "/" + endStr;
					window.open(oneUrl);
				}
			}
		}
	}
}

</script>
</head>
<body>
请输入前半部分:<br/>
<input type="text" id="start1" name="start1" value=""/><br/>
<input type="text" id="start2" name="start2" value=""/><br/>
<input type="text" id="start3" name="start3" value=""/><br/>
<input type="text" id="start4" name="start4" value=""/><br/>
<input type="text" id="start5" name="start5" value=""/><br/>
<input type="text" id="start6" name="start6" value=""/><br/>
<input type="text" id="start7" name="start7" value=""/><br/>
<input type="text" id="start8" name="start8" value=""/><br/>
<input type="text" id="start9" name="start9" value=""/><br/>

<hr/>

请输入后半部分:<br/>
<input type="text" id="end1" name="end1" value=""/><br/>
<input type="text" id="end2" name="end2" value=""/><br/>
<input type="text" id="end3" name="end3" value=""/><br/>
<input type="text" id="end4" name="end4" value=""/><br/>
<input type="text" id="end5" name="end5" value=""/><br/>
<input type="text" id="end6" name="end6" value=""/><br/>
<input type="text" id="end7" name="end7" value=""/><br/>
<input type="text" id="end8" name="end8" value=""/><br/>
<input type="text" id="end9" name="end9" value=""/><br/>


<input type="button"  value="确定" onclick='doit()' />
</body>
</html>
其他:<html>
<head>
<title>test</title>
<script type="text/javascript">
openWin(arg1){
 targetHtml = document.getElementById("url").value + "/" + arg1;
 window.open (targetHtml);
}
</script>
</head>
<body>
<input type="text" id="url" value=""/>
<input type="button"  value="确定" onclick='openWin("aaaa")' />
</body>
</html> 

上一个:能不能在html中书写只让ie6执行,别的浏览器忽略的html代码?
下一个:问下HTML表单

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,