![](/img/trans.png)
[英]How do I open the sidebar in a AMP page with javascript directly? Is there a function?
[英]How do I open a page in ibox with javascript?
我正在使用从网站http://www.enthropia.com/labs/ibox/download.php提取的ibox.js。
我想用JavaScript打开到ibox的页面。
$j(".refresh").click(function() {
$j('#case_01').attr('rel': 'ibox', 'href': 'case_01.html);
});
谢谢您的帮助。
如果您使用jquery .attr() ,请尝试
$(".refresh").click(function() {
//$j('#case_01').attr('rel': 'ibox', 'href': 'case_01.html);
$('#case_01').attr('rel','ibox').attr('href','case_01.html');
});
您可以使用对象文字语法设置多个属性。 当前设置不正确,您有错字。
这应该工作:
$j(".refresh").click(function() {
$j('#case_01').attr({rel: 'ibox', href: 'case_01.html'});
});
注意:
在设置多个属性时,属性名称周围的引号是可选的。
警告:设置“ class”属性时,必须始终使用引号!
jQuery禁止更改or元素上的type属性,并且将在所有浏览器中引发错误。 这是因为无法在Internet Explorer中更改type属性。 ”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.