
javascript的传值问题!!--在线等待!
如何将表中不同行的数据让javascript函数处理呢?就是如何获取我输入的title和我上传的文件,并把它传给javascript函数处理。test.html<html...
如何将表中不同行的数据让javascript函数处理呢?
就是如何获取我输入的title和我上传的文件,并把它传给javascript函数处理。
test.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function up_imgTest(title,filePath){
if (window.showModalDialog){
alert("test");
alert(title);
alert(filePath);
//showModalDialog("popUpImg.html","new","dialogHeight:460px;dialogWidth:820px;edge:Raised;scroll:no;resizable:no;status:no;");
}else{
win=window.open('popUpImg.html','','scrollbars=no,top=400px,left=200px, ,resizable=no,height=450,width=810');
}
}
</script>
</head>
<body id="top">
<table class="basic" width="120%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td >Title</td>
<td ><input type="text" name="Title1" style="width:150px;" id="title"></td>
<td >Title:</td>
<td ><input type="text" name="Title2" style="width:150px;" ></td>
<td >Title</td>
<td><input type="text" name="Title3" style="width:150px;" ></td>
</tr>
<tr>
<td >File</td>
<td ><input type="file" name="img" id="filePath"> <input type="button" value="登录" onclick="up_imgTest(title,filePath.value)"/></td>
<td >File</td>
<td ><input type="file" name="img"> <input type="button" value="登录" onclick="up_img()"/></td>
<td >File</td>
<td ><input type="file" name="img"> <input type="button" value="登录" onclick="up_img()"/></td>
</tr>
</table>
</body>
</html>
我之前也是那么做的,可是alert里面是空值啊!
能否给一个参考代码阿 展开
就是如何获取我输入的title和我上传的文件,并把它传给javascript函数处理。
test.html
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
function up_imgTest(title,filePath){
if (window.showModalDialog){
alert("test");
alert(title);
alert(filePath);
//showModalDialog("popUpImg.html","new","dialogHeight:460px;dialogWidth:820px;edge:Raised;scroll:no;resizable:no;status:no;");
}else{
win=window.open('popUpImg.html','','scrollbars=no,top=400px,left=200px, ,resizable=no,height=450,width=810');
}
}
</script>
</head>
<body id="top">
<table class="basic" width="120%" border="1" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
<tr>
<td >Title</td>
<td ><input type="text" name="Title1" style="width:150px;" id="title"></td>
<td >Title:</td>
<td ><input type="text" name="Title2" style="width:150px;" ></td>
<td >Title</td>
<td><input type="text" name="Title3" style="width:150px;" ></td>
</tr>
<tr>
<td >File</td>
<td ><input type="file" name="img" id="filePath"> <input type="button" value="登录" onclick="up_imgTest(title,filePath.value)"/></td>
<td >File</td>
<td ><input type="file" name="img"> <input type="button" value="登录" onclick="up_img()"/></td>
<td >File</td>
<td ><input type="file" name="img"> <input type="button" value="登录" onclick="up_img()"/></td>
</tr>
</table>
</body>
</html>
我之前也是那么做的,可是alert里面是空值啊!
能否给一个参考代码阿 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询