好吧,所以我有一個腳本,當你點擊一個鏈接它動態地添加一個表單字段是有可能的,所以當它被提交時,它會去「example.com?7」(7由於7檔) 我的意思是,如果我點擊5次,有5個文件字段和我選擇5個文件,我可以讓操作鏈接mysite.php 5使用javascript來改變提交鏈接
這裏是腳本:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="application/javascript">
function add(){
var field = document.createElement('input');
field.setAttribute("type", "file");
field.setAttribute("name", "yo");
document.getElementById('myform').appendChild(field);
}
</script>
</head>
<body>
<form id="myform" name="form1" enctype="multipart/form-data" method="post" action="">
<p>File:
<input type="file" name="hello" id="hello" />
</p>
<p>
<input name="submit" type="submit" value="Submit" />
</p>
</form>
<a href="#" onclick="add()">Click Here</a>
</body>
</html>
非常感謝!
工作就像一個魅力。非常感謝。 – DonJuma 2010-10-20 16:09:01