手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >jquery trigger伪造a标签的click事件取代window.open方法
jquery trigger伪造a标签的click事件取代window.open方法
摘要:varohtml=''+'您已经成功发送好友申请。'+'上传真实头像,好友申请更容易被通过哦,赶紧上传头像吧!'+''+'';$.dialo...

var ohtml='<div>'+ '<div>您已经成功发送好友申请。</div>'+ ' <p>上传真实头像,好友申请更容易被通过哦,赶紧上传头像吧!</p> '+ '<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+ ' </div>'; $.dialog({ lock:true, title: '温馨提示', button: [ {value: '点击上传图像',callback: function () { $("#awindowopen").trigger("click"); },focus: true } ], content:ohtml }); var ohtml='<div>'+ '<div>您已经成功发送好友申请。</div>'+ ' <p>上传真实头像,好友申请更容易被通过哦,赶紧上传头像吧!</p> '+ '<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a>'+ ' </div>'; $.dialog({ lock:true, title: '温馨提示', button: [ {value: '点击上传图像',callback: function () { $("#awindowopen").trigger("click"); },focus: true } ], content:ohtml });

需要注意的是:

在这个地方:

<a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a> <a href="<%=path%>/teacher/editUserAvatar.action" target="_blank"><span id="awindowopen" ></span></a> <a>标签内一定要有内容,并且要模拟里面的内容被点击而不是<a></a>被点击

【jquery trigger伪造a标签的click事件取代window.open方法】相关文章:

javascript清空table表格的方法

JavaScript中的blink()方法的使用

Jquery动态添加输入框的方法

jquery判断至少有一个checkbox被选中的方法

jQuery实现限制textarea文本框输入字符数量的方法

jQuery实现延迟跳转的方法

解析javascript中鼠标滚轮事件

jQuery获得字体颜色16位码的方法

jQuery切换所有复选框选中状态的方法

jQuery预加载图片常用方法

精品推荐
分类导航