拷贝编码
编码以下:var button1 = document.getElementById("button1");
var button2 = document.getElementById("button2");
button1.onclick = function(){alert("button1");trigger(button2,"onclick");}
button2.onclick = function(){alert("button2");}
function trigger(ele,event)
{ele[event]();}
还可以应用更为简易的方法,便是将input遮盖住关键点击的照片或超链或其它div,随后将input设定成彻底全透明,这样点一下照片时实际上点一下的是input,以下:
拷贝编码
编码以下:<div class="ps-image" style="width:300px;height:300px;border:0px sold red; background:url('/images/ps.png')">
<input type="file" id="file" style="filter:alpha(opacity=0);opacity:0;width:100%;height:100%;"/>
</div>