我最近买了一个 Ning 账号。您根本无法编辑任何 html。
您唯一能做的就是使用 css 为原始 div 设置样式。有一个自定义代码功能,您可以在其中添加 javascript。
我有一个div
叫xn_bar_menu_branding
. 这可以链接到一个网址说:google.com
使用javascript吗?
我最近买了一个 Ning 账号。您根本无法编辑任何 html。
您唯一能做的就是使用 css 为原始 div 设置样式。有一个自定义代码功能,您可以在其中添加 javascript。
我有一个div
叫xn_bar_menu_branding
. 这可以链接到一个网址说:google.com
使用javascript吗?
如果命名你的意思是它有一个id="xn_bar_menu_branding"
那么你可以做
$('#xn_bar_menu_branding').click(function(){
window.location.href = 'http://google.com';
});
但这仅适用于启用了 javascript 的浏览器,也不适用于 SEO 目的。
如果您希望鼠标悬停在 div 上时变成一只手,您可以使用 CSS 和这条规则来做到这一点
#xn_bar_menu_branding{ cursor: pointer; }
$('#xn_bar_menu_branding').html('<a href="http://google.com>Google.com</a>"');
这将使用该 id 替换该 div 中的任何内容,并带有指向 google 的链接