<div class="codetitle"> <span><a style="CURSOR: pointer" data="6895" class="copybut" id="copybut6895" onclick="doCopy('code6895')"><u>复制代</u></a></span> 代码如下:</div> <div class="codebody" id="code6895"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 移行//EN" "http://www.w3.org/TR/html4/loose.dtd"> <BR><html xmlns="http://www.w3.org/1999/xhtml"> <br> <br> <br><title>追加付属品</title> <br></head> <br><script type="text/javascript" src="jquery-1.8.0.js"></script> <br><script type="text/javascript"> <br>function fclick(obj){ <br>style.posTop=event.srcElement.offsetTop <br>style.posLeft=event.x-offsetWidth/2 <br>} <br>$(function(){ <br>$("#addFile").click(function(){ <br>var br = $("<br>"); <BR>var input1 = $("<input id='inputrecievedocument' type= 'text'/>"); <br>var input2 = $("<input type='button' style='margin-left:5px;background-color:blue' id='btnrecievedocument' onmouseover='fclick (t_file)' value='浏览'/>"); <BR>var input3 = $("<input name='upfile' type='file' style='position:absolute;filter:alpha(opacity= 0);width:70px;' id='t_file' onchange='inputrecievedocument.value=this.value' hidefocus/>"); <br>var button = $("<input type='button' value= '删除' style='margin-left:5px;background-color:blue'/>"); <br>$("#file").append(br).append(input1).append(input3)。 append(input2).append(button); <br>button.click(function() { <br>br.remove(); <br>input1.remove(); <br>input2.remove(); <br>input3.remove(); <br><br>}); <br></script> <br><body class="body"> <br><form method="post" action="" enctype="multipart/form-data"> <br><input type="button" value="追加付属品" class="btn_Fujian" id="addFile" style="margin-left:20px;margin-top:2px;"/> <br><div id="ファイル"></div> <br></form> <br></body> <br></html> <br><br> <br>IE9 での実行例: <br><br> </div>