阅读背景:

js触发单击事件(不是调用某组件定义的单击函数,而是触发,相当于你点击)

来源:互联网 
<html xmlns="https://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标</title>

</head>
<body>
    <form id="form1" runat="server">

    <input id="fff" type="file" size="0" onclick="javascript:onFileUpload()"/><br>
<input  id="bbb" type="button" value="按钮" onclick="javascript:getonFileUpload()"/><br>
<input  id="ttt" type="text" value=""/><br>

</br>
  </form>
</body>
</html>
<script type="text/javascript">
function onFileUpload(){
  alert("uuupp");
}
function getonFileUpload(){
//触发fff的单击事件,这和直接调用fff定义的单击函数是有很大区别的
//单击时会有文件选择框,若只是单单调用定义的单击函数,没有文件选择框弹出
  document.getElementById("fff").click();
  document.getElementById("ttt").value=document.getElementById("fff").value;
}
</script><html xmlns="https://www.w3.org/1999/xhtml">
<h



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: