国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

修改file按鈕的默認樣式實現代碼

2019-11-20 22:47:06
字體:
來源:轉載
供稿:網友
復制代碼 代碼如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<title>添加附件</title>
</head>
<script type="text/javascript" src="jquery-1.8.0.js"></script>
<script type="text/javascript">
function fclick(obj){
style.posTop=event.srcElement.offsetTop
style.posLeft=event.x-offsetWidth/2
}
$(function(){
$("#addFile").click(function(){
var br = $("<br>");
var input1 = $("<input id='inputrecievedocument' type='text'/>");
var input2 = $("<input type='button' style='margin-left:5px;background-color:blue' id='btnrecievedocument' onmouseover='fclick(t_file)' value='瀏覽'/>");
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/>");
var button = $("<input type='button' value='刪除' style='margin-left:5px;background-color:blue'/>");
$("#file").append(br).append(input1).append(input3).append(input2).append(button);
button.click(function() {
br.remove();
input1.remove();
input2.remove();
input3.remove();
button.remove();
});

});

});
</script>
<body class="body">
<form method="post" action="" enctype="multipart/form-data">
<input type="button" value="添加附件" class="btn_fujian" id="addFile" style="margin-left:20px;margin-top:2px;"/>
<div id="file"></div>
</form>
</body>
</html>

IE9中運行如下:
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 株洲市| 玉门市| 阿巴嘎旗| 清流县| 太仓市| 东辽县| 万载县| 灌云县| 永春县| 乐陵市| 孝昌县| 六枝特区| 湖州市| 姜堰市| 洛扎县| 马山县| 博兴县| 江川县| 莱州市| 鄂托克旗| 烟台市| 江油市| 南汇区| 永德县| 巴彦县| 南漳县| 兰州市| 天气| 营口市| 太仓市| 鄂托克前旗| 额尔古纳市| 宜黄县| 白河县| 榆中县| 苏尼特右旗| 呼和浩特市| 威信县| 河池市| 平武县| 玉山县|