绑定到显示第三方网站的框架中的 ID
a) 我有一个如下所示的 html 页面:
<html>
<head>
<title>Page Title</title>
</head>
<script type="text/javascript">
document.write('<FRAMESET cols="*, 300" border="0">');
document.write('<FRAME src="http://www.my-website.com" id="inner" name="inner" />');
document.write('<FRAME src="http://www.third-party-website" id="chatframe" name="chatframe" />');
document.write('<NOFRAMES><P>You must have a frames compatible browser to use Activa Live Chat</P></NOFRAMES>');
document.write('</FRAMESET>');
</script>
</html>
其中 my-website.com 框架是我可以完全访问的网站,而third-party-website.com 是我无法访问的网站(它是聊天软件)。
b) 通常聊天会在弹出窗口中打开,但我们这样做是为了让它在页面右侧的框架中打开。
c) 聊天框架有一个“关闭”链接,用于结束聊天会话。它周围有一个 div:
<div class="close" id="close-chat">
d)当单击“关闭”链接时,我还希望关闭聊天框,即重定向回“my-website.com”。
我尝试使用 jQuery .bind() 将单击功能添加到 #close div,但没有成功。
感谢任何有兴趣的人的帮助!
a) I have an html page that looks like this:
<html>
<head>
<title>Page Title</title>
</head>
<script type="text/javascript">
document.write('<FRAMESET cols="*, 300" border="0">');
document.write('<FRAME src="http://www.my-website.com" id="inner" name="inner" />');
document.write('<FRAME src="http://www.third-party-website" id="chatframe" name="chatframe" />');
document.write('<NOFRAMES><P>You must have a frames compatible browser to use Activa Live Chat</P></NOFRAMES>');
document.write('</FRAMESET>');
</script>
</html>
where the my-website.com frame is my website that I have full access to and where third-party-website.com is a website that I have no access to (it's a chat software).
b) Normally the chat would open in a popup, but we've done this so that it opens in a frame on the right side of the page.
c) The chat frame has a "close" link, which ends the chat session. It has a div around it:
<div class="close" id="close-chat">
d) What I'd like to additionally happen when the "close" link is clicked is for the chat frame to close, i.e. redirect back to "my-website.com."
I've tried using jQuery .bind() to add a click function to the #close div with no success.
Thanks for the help to anyone who is interested!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您没有提供任何 jQuery,但提到了
#close
div。您的 div 是#close-chat
或.close
,而不是#close
。如果没有更多代码,我无法告诉您这是否是真正的问题。
如果您尝试访问的 div 位于另一个域中,则这将不起作用,因为它会破坏跨浏览器脚本安全性。
You didn't provide any of your jQuery, but you mention a
#close
div. Your div is#close-chat
or.close
, not#close
.Without more code, I can't tell you if this is the real issue.
If the div you are trying to access is on another domain, this will not work as it breaks cross-browser scripting security.