如何在定义了 class 和 rel 的 href 中模拟单击?
在提出这个问题之前,我尝试了在这里看到的各种例子。因此,在尝试了几个小时的解决方案后,我退出了。可能有更多 javascript、html 知识的人可以帮助我。我真的希望如此。
这就是我的代码:
<table class="tab_login">
<tr>
<td class="azul_escuro" align="right">You need to accept this document to proceed</td>
</tr>
<tr>
<td align="right"><a href="termos_uso.php" class="modal" rel="modal"><img src="images/btn_enter.jpg" border="none" /></a></td>
</tr>
</table>
纯粹而简单。没有表单标签等。但我的客户不想要这个。她决定模态窗口必须直接显示,而无需单击链接。我不知道该怎么做,因为当我模拟点击时,它似乎不考虑与 class="modal" 和 rel="modal" 相关的问题。
我正在使用 jquery-1.2.6.pack.js 和 jquery-modal-1.0.js
并在 css 中:
/* MODAL */
.load { position: absolute; top: 50%; left: 50%; width: 88px; height: 78px; margin: -39px 0 0 -44px; z-index: 99999;}
.bg_modal { position: absolute; top: 0; left: 0; z-index: 99998; }
.view_modal { position: absolute; left: 50%; top: 50%; text-align: left; z-index: 99998; }
/*modal { visibility: hidden; cursor:pointer; }*/
.box_modal{width:429px; height:auto;}
我能做什么?
提前致谢。
I tried every kind of examples that I looked here before I made this question. Só after hours trying solutions, I quit. May be someone with more javascript, html knowledge could help me. I really hope so.
That is my code:
<table class="tab_login">
<tr>
<td class="azul_escuro" align="right">You need to accept this document to proceed</td>
</tr>
<tr>
<td align="right"><a href="termos_uso.php" class="modal" rel="modal"><img src="images/btn_enter.jpg" border="none" /></a></td>
</tr>
</table>
Pure and simple. Without form tag and all. But my client don´t want this. She decided that the modal window have to appear directly without click on the link. I don´t know what to do because when I simulate a click it seems to desconsider the class="modal" and rel="modal" related.
I´m using jquery-1.2.6.pack.js and jquery-modal-1.0.js
and in css:
/* MODAL */
.load { position: absolute; top: 50%; left: 50%; width: 88px; height: 78px; margin: -39px 0 0 -44px; z-index: 99999;}
.bg_modal { position: absolute; top: 0; left: 0; z-index: 99998; }
.view_modal { position: absolute; left: 50%; top: 50%; text-align: left; z-index: 99998; }
/*modal { visibility: hidden; cursor:pointer; }*/
.box_modal{width:429px; height:auto;}
What I can do?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果用户不单击,则无法打开弹出窗口。此行为已被删除以杀死弹出窗口添加。
所以 window.open() 仅在真正的鼠标单击事件时才起作用。
当您尝试执行此操作时,现代浏览器将显示一条警告,提示网站尝试打开新窗口。
您或许可以使用 div 覆盖来代替。
It's not possible to open a pop-up windows without a click of the user. This behavior have been remove to kill pop-up adds.
So window.open() only work when an real mouse click event.
When you try to do it, modern browser will show a warning that the web site try to open a new window.
You could probably use an div overlay instead.