var lastname = jQuery('[name="dc_contributor_author_first_'+i+'"]');
if (lastname==null)
exit;
var orderbox = "<td nowrap='nowrap'><input type='text' size=1 id='author_order_"+i+"' value="+i+" onchange=updateBoxes(this.value,"+i+")></td>";
jQuery(orderbox).insertAfter(lastname.parent());
结果为
<input type="text" )="" 1="" onchange="updateBoxes(this.value," value="1" id="author_order_1" size="1">
但是当我从 updateBoxes 中删除空间作为"onchange=updateBoxes(this.value,"+i+")"
函数时,它工作得很好,结果如下。为什么?
<input type="text" onchange="updateBoxes(this.value,1)" value="1" id="author_order_1" size="1">