<script language=vbscript>
function reg_Onsubmit()
if document.reg.file.value="" then
msgbox "请选择要上传的附件!"
reg_onsubmit=false
exit function
else
document.reg.action="imgs.asp"
end if
end function
</script>请将上面VBS改成JS。
注意document.reg.action="imgs.asp"这句。
谢谢。
function reg_Onsubmit()
if document.reg.file.value="" then
msgbox "请选择要上传的附件!"
reg_onsubmit=false
exit function
else
document.reg.action="imgs.asp"
end if
end function
</script>请将上面VBS改成JS。
注意document.reg.action="imgs.asp"这句。
谢谢。
解决方案 »
- (新手上路,求回答……)jsp中怎样设置table在ie单个页面内的最大行数
- 从后台返回一条JSON数据,如何转换成ext的record
- 急!求一个用javascript编写一个链接颜色变换的问题
- 求助html 高手请进 感激不禁
- 论坛上发帖的时间和系统的时间差八小时
- jquery 嵌套的each,怎么区分this?
- 关于document.write的一个问题
- html中调用javascript函数中怎样传递数组
- 如何将自字符串"document.forms[0].a"转换为一个对象?
- 请教用javascript实现一些琐碎的问题,都很简单!
- ExtJs中Grid初始化时的问题
- Jquery中如何仅仅显示最终要展示的网页?
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>选择和上传图片</title>
<script language=vbscript>
function reg_Onsubmit()
if document.reg.file.value="" then
msgbox "请选择要上传的附件!"
reg_onsubmit=false
exit function
else
document.reg.action="imgs.asp"
end if
end function
</script><script type="text/javascript">
function preview4()
{
var x = document.getElementById("file");
var y = document.getElementById("pic4");
if(!x || !x.value || !y) return;
var patn = /\.jpg$|\.jpeg$|\.gif$/i;
if(patn.test(x.value))
{ y.src = "file://local/" + x.value; }
else
{ alert("您选择的似乎不是图像文件。");
}
}
</script></head><body leftmargin="1" topmargin="1">
<table width="100%" border="1" cellpadding="2" cellspacing="2">
<tr>
<td height="149" valign="top">
<table width="100%" border="0">
<form method="post" enctype="multipart/form-data" name="reg">
<tr bgcolor="#B5F0FF">
<td height="25" colspan="2"> <img src="../images/dots.GIF" width="13" height="11">
选择和上传商品图片(标准大小:110*80)</td>
</tr>
<tr>
<td width="32%" rowspan="5" valign="middle">
<div align="right">
<table width="110" height="80" border="1" align="center" cellpadding="2" cellspacing="2" bgcolor="#E4E4E4">
<tr>
<td width="490" background="../images/bclass1.gif"> </td>
</tr>
</table>
</div></td>
<td width="68%"> </td>
</tr>
<tr>
<td><div align="center">
<input type="file" name="file" id="file" onchange="preview4()">
</div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="确认上传">
</div></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
function reg_Onsubmit()
if (document.reg.file.value="") {
alert("请选择要上传的附件!");
reg_onsubmit=false ;}
else
document.reg.action="imgs.asp"
</script>
<script>
function reg_Onsubmit(){
if(document.reg.file.value==""){
alert("请选择要上传的附件!" );
return false
}
else document.reg.action="imgs.asp";
return true;
}
</script>
<form name="reg" onsubmit="reg_Onsubmit()" method="post" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" >
</form>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>选择和上传图片</title>
<script type="text/javascript">
function reg_Onsubmit(){
if(document.reg.file.value==""){
alert("请选择要上传的附件!" );
return false
}
else document.reg.action="imgs.asp";
return true;
} function preview4()
{
var x = document.getElementById("file");
var y = document.getElementById("pic4");
if(!x || !x.value || !y) return;
var patn = /\.jpg$|\.jpeg$|\.gif$/i;
if(patn.test(x.value))
{ y.src = "file://local/" + x.value; }
else
{ alert("您选择的似乎不是图像文件。");
}
}
</script></head><body leftmargin="1" topmargin="1">
<table width="100%" border="1" cellpadding="2" cellspacing="2">
<tr>
<td height="149" valign="top">
<table width="100%" border="0">
<form method="post" enctype="multipart/form-data" name="reg" onsubmit="return reg_Onsubmit();">
<tr bgcolor="#B5F0FF">
<td height="25" colspan="2"> <img src="../images/dots.GIF" width="13" height="11">
选择和上传商品图片(标准大小:110*80)</td>
</tr>
<tr>
<td width="32%" rowspan="5" valign="middle">
<div align="right">
<table width="110" height="80" border="1" align="center" cellpadding="2" cellspacing="2" bgcolor="#E4E4E4">
<tr>
<td width="490" background="../images/bclass1.gif"> </td>
</tr>
</table>
</div></td>
<td width="68%"> </td>
</tr>
<tr>
<td><div align="center">
<input type="file" name="file" id="file" onchange="preview4()">
</div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><div align="center">
<input type="submit" name="Submit" value="确认上传">
</div></td>
</tr>
<tr>
<td height="20"> </td>
</tr>
</form>
</table>
</td>
</tr>
</table>
</body>
</html>
不过是否发现,当按”上传“按钮时,无法转向imgs.asp,请帮忙解决此问题。