【求助】问一个关于Form的submit()方法的问题,可能比较难 你是指enctype="multipart/form-data"?这个肯定是写了的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 刚才在整理代码,现在贴出来,大家帮我看看吧---------------------------------------------------------------------------<script language='javascript'>function upload(){ var fileObj = document.getElementById('fileuploader'); if (fileObj == null) { var filetag = "<input type='file' style='visibility:hidden' name='fileuploader' id='fileuploader' onchange='showattach();'>"; fileObj = document.createElement(filetag); uploaderDiv.appendChild(fileObj); } fileObj.click(); return;}function showattach(){ var fobj = document.getElementById('fileuploader'); if(fobj != null) { var fullpath = fobj.value; var ind = fullpath.lastIndexOf("\\"); var filename = fullpath.substring(ind+1, fullpath.length); var fileNameTag = "<span id='filenamelink'>"; var fileOpTag = "<span id='fileoplink' onclick='deleteAttach()' style='color:#68a5ea;cursor:hand'>"; var fileNameObj = document.createElement(fileNameTag); var fileOpObj = document.createElement(fileOpTag); var attachArea = document.getElementById('attachinfo'); attachArea.appendChild(fileNameObj); attachArea.appendChild(fileOpObj); fileOpObj.innerText = " 删除"; fileNameObj.innerText = filename; return; }}function deleteAttach(){ // delete file uploader var oChild = uploaderDiv.children(0); uploaderDiv.removeChild(oChild); // delete upload file info oChild = attachinfo.children(0); attachinfo.removeChild(oChild); oChild = attachinfo.children(0); attachinfo.removeChild(oChild);}function submitform(){ document.forms[0].submit();}</script><form name='form1' id='form1' action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">...<div id="uploaderDiv" style="display:none"></div> // 用来append fileuploader...<div id='attachinfo' name='attachinfo'></div> // 用来append已添加附件名...<span onclick='upload()' style='text-decoration:underline;cursor:hand'>附件</span> // 添加附件的按钮...<input id='btnok' type='button' value='确定' onclick='submitform();'> // 提交按钮...</form>--------------------------------------------------------------------------- swfupload 后台php文件获取参数 现在csdn发表评论后没有马上显示 这些手册是我asp和php成功的关键,现在共享给家共同学习参考! php的页面静态化感觉有点局限。 帮我看看这段代码 如何读出文件夹下的所有文件名 哪位高手能说说在php5,默认配置下session到底如何使用? 一个关于select的问题 ?小问题:关于php得到复选框的状态? SOS,新手求救 紧急查询:分组,求各组最大值! 关于copy()的问题
---------------------------------------------------------------------------
<script language='javascript'>
function upload()
{
var fileObj = document.getElementById('fileuploader');
if (fileObj == null)
{
var filetag = "<input type='file' style='visibility:hidden' name='fileuploader' id='fileuploader' onchange='showattach();'>";
fileObj = document.createElement(filetag);
uploaderDiv.appendChild(fileObj);
}
fileObj.click();
return;
}function showattach()
{
var fobj = document.getElementById('fileuploader');
if(fobj != null)
{
var fullpath = fobj.value;
var ind = fullpath.lastIndexOf("\\");
var filename = fullpath.substring(ind+1, fullpath.length); var fileNameTag = "<span id='filenamelink'>";
var fileOpTag = "<span id='fileoplink' onclick='deleteAttach()' style='color:#68a5ea;cursor:hand'>"; var fileNameObj = document.createElement(fileNameTag);
var fileOpObj = document.createElement(fileOpTag);
var attachArea = document.getElementById('attachinfo');
attachArea.appendChild(fileNameObj);
attachArea.appendChild(fileOpObj); fileOpObj.innerText = " 删除";
fileNameObj.innerText = filename;
return;
}
}
function deleteAttach()
{
// delete file uploader
var oChild = uploaderDiv.children(0);
uploaderDiv.removeChild(oChild); // delete upload file info
oChild = attachinfo.children(0);
attachinfo.removeChild(oChild);
oChild = attachinfo.children(0);
attachinfo.removeChild(oChild);}
function submitform()
{
document.forms[0].submit();}
</script><form name='form1' id='form1' action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data">
...
<div id="uploaderDiv" style="display:none"></div> // 用来append fileuploader
...
<div id='attachinfo' name='attachinfo'></div> // 用来append已添加附件名
...
<span onclick='upload()' style='text-decoration:underline;cursor:hand'>附件</span> // 添加附件的按钮
...
<input id='btnok' type='button' value='确定' onclick='submitform();'> // 提交按钮
...
</form>
---------------------------------------------------------------------------