JS点击照片打开上传框

JS部分:

function addFile(){
        document.getElementById("file").click();
    }

 

BODY部分:

<table width="100%" height="120">
                                    <tr>
                                        <td width="17%">
                                    
                                            <img src="images/tx.jpg" id="imghead" width="127" height="167" οnclick="addFile()"/><br/>
                                     
                                        
                                        </c:if>
                            
                                        <input type="file" id="file" name="file" value="123" οnchange="addIMG(this)" UNSELECTABLE="on"/>
                                        </td>
                                        
                                    </tr>
                                </table>


版权声明:本文为cxws110原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。