Js自动添加附件上传浏览框,模仿网易邮箱
这种效果以前发疯似的找也找不见,现在竟然发现了一个代码超简的版本,真是太好了,所以赶紧奉献给需要的朋友们。它可以动态添加上传文件的浏览框,要多少有多少,而且还可以移除,很方便实用。
这种效果以前发疯似的找也找不见,现在竟然发现了一个代码超简的版本,真是太好了,所以赶紧奉献给需要的朋友们。它可以动态添加上传文件的浏览框,要多少有多少,而且还可以移除,很方便实用。
答案:<html>
<head>
<title>类似163添加附件的Js</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body onload="this.document.qiksearch.select_items.selectedIndex = 4">
<center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=3 color=red face="Arial, Helvetica, sans-serif"><strong>效果显示</strong></font></td></tr>
<tr><td align=left>
<script language="javascript">
var no_options;
document.write('<table cellspacing="5" cellpadding="5" style="border:2 solid #808080" align="center"><tr><td>');
document.write('<form name="qiksearch">');
if(navigator.appName=="Microsoft Internet Explorer")
{
document.write('<font face="verdana,arial,helvetica" size="-1" color="#000000">显示<select name="select_items" onchange="javascript:showItems(this.document.qiksearch.select_items.value)" style="font-size:8pt">');
for(var i=1; i<=30; i++)
{
document.write('<option value="' + i + '">' + i + '</option>');
}
this.document.qiksearch.select_items.selectedIndex = 4;
document.write('</select> 链接.<br><br>');
}
document.write('<b>菜单名称:</b><br><br>');
document.write('<input type="text" value="Select" name="combo_caption" size="30" style="height:20; border:1 solid #000000">');
document.write('<br><br><b>菜单内容 :</b><br><br>');
document.write('<div id="items">');
for(var i=1; i<=5; i++)
{
document.write('Option : <input type="text" size="12" name="option' + i + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + i + '" size="15" style="height:20; border:1 solid #000000"><br>');
}
document.write('</div>');
document.write('<br><center><input type="button" name="qiksearch_submit" value="显示代码" onclick="display()" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"> <input type="reset" onclick="javascript:location.reload();" style="font-family:verdana,arial,helvetica; font-size:8pt; height:20; width:48%; background:#EFEFEF; border:1 solid #808080; cursor:hand"></center>');
document.write('</font></form>');
document.write('</td></tr></table>');
function showItems(n)
{
var item_disp = "";
for(var i=0; i<n; i++)
{
item_disp += 'Option : <input type="text" size="12" name="option' + (i+1) + '" style="height:20; border:1 solid #000000"> Link to : <input type="file" name="linkto' + (i+1) + '" size="15" style="height:20; border:1 solid #000000"><br>';
}
no_options=n;
this.document.all.items.innerHTML = item_disp;
}
if(navigator.appName=="Microsoft Internet Explorer")
{
no_options = this.document.qiksearch.select_items.value;
}
else
{
no_options = 5;
}
function display() {
DispWin=window.open('','NewWin','易做图=no,status=no,width=500,height=375')
message="<font face=arial,verdana,helvetica size=-2 color=#000000><b><!--Made with Qiksearch MenuGen-->";
message += "<br><script language='javascript' type='text/javascript'>";
message += "<br>function go()";
message += "<br>{";
message += "<br> if (document.selecter.select1.options[document.selecter.select1.selectedIndex].value != 'none')";
message += "<br> {";
message += "<br> location = document.selecter.select1.options[document.selecter.select1.selectedIndex].value";
message += "<br> }";
message += "<br>}";
message += "<br><\/script>";
message += "<br>";
message += "<br><script language='JavaScript' type='text/javascript'>";
message += "<br>document.write('<form name='selecter'><select name='select1'>');";
message += "<br>document.write('<option value=none>" + this.document.qiksearch.combo_caption.value + "</option>');";
message += "<br>document.write('<option value=none>--------------------</option>');";
for(var i=1; i<=no_options; i++)
{
message += "<br>document.write('<option value=" + eval('this.document.qiksearch.linkto' + i + '.value') + "">" + eval('this.document.qiksearch.option' + i + '.value') + '</option>');";
}
message += "<br>document.write('</select>');";
message += "<br>document.write('<input type='button' value='Go' onclick='go()'>');";
message += "<br>document.write('</form>');";
message += "<br><\/script>";
DispWin.document.write(message);
}
</script>
</td></tr>
</table></center>
</body>
</html>
上一个:让文本框变成一条直线
下一个:常用的JS按钮功能大集合