我正在尝试让输入更改特定文本的样式并将其提交给filemaker服务器。在IE上工作得很好,但在野生动物园上却没有...
<select name="NameStyleFontName" id="'.$recordID2.'" style="width:105px;"
fontatt="font-family" classid="stagename" onchange="fontupdate(this.id, this.name,
this.value, this.fontatt, this.classid)">
function fontupdate(id, name, value, att, cls)
{
$('#loadres').html('<img src="loading.gif" />');
$.post('fontupdate.php', {id: id, name: name, value: value})
$('.'+cls).css(att, value); //this is where it fails.
$('#loadres').html('<col />');
};
答案 0 :(得分:1)
除了IE之外,它可能不起作用。
大多数浏览器不支持向DOM添加任意属性。既然你正在使用jQuery,你应该能够使用:$(this).attr('fontattr')
而不是this.fontattr
来使用它们,但是你应该首先重新思考你这样做的方式。
或者尝试使用属于HTML5功能的data-*
属性,并打算用于这些目的。见http://html5doctor.com/html5-custom-data-attributes/