兼容问题 ie9,ff可用,但在低版本的ie中无效,高手快看过来丫 本帖最后由 newchilam 于 2012-05-16 22:25:31 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script src="http://code.jquery.com/jquery-latest.js"></script><table> <tr> <td id="buttonRT2" button="RT2"> <input class='btnAdd' width='42px' type='button' value='Add' onclick="changeCssForAdd('RT2')" /> </td> </tr> </table><script>$("td[button]").each(function () {var strhtml="<input width='42px' type='button' value='Add' onclick='changeCssForAdd('"+ $(this).parent().attr('id') +"')' /> ";$(this).html(strhtml+'123');});</script>没问题啊,加123 是为了看效果。楼主 把你的问题,整理下 贴出来看看 表格代码不完整造成的。还有这里:... + $(this).parent().attr('id') //td的父元素tr并没有id属性值 谢谢楼上的两位,问题找到了。把'改成使用\'就好了。有高手说说这事怎么一回事吗? ' 是xml符号不是标准合法的html符号,所以有些浏览器不支持,如果用的话可以用'代替 请问在IE上显示正常,在火狐上怎么不显示,该如何修改 视频地址解析 在js里设置背景图片的定位 一个JS控制CSS样式的问题? window.open跳转的问题 javascript 的radio验证问题 动态生成表格时如何设置某个列为隐藏? 搜索引擎的制作 请问在javascript中如何访问一个局部变量?谢谢。。! 快来帮帮我!(在线等) 求1个正册表达式 关于对opener使用appendChild的问题
<script src="http://code.jquery.com/jquery-latest.js"></script>
<table>
<tr>
<td id="buttonRT2" button="RT2">
<input class='btnAdd' width='42px' type='button' value='Add' onclick="changeCssForAdd('RT2')" />
</td>
</tr>
</table><script>
$("td[button]").each(function () {
var strhtml="<input width='42px' type='button' value='Add' onclick='changeCssForAdd('"+ $(this).parent().attr('id') +"')' /> ";
$(this).html(strhtml+'123');
});</script>
没问题啊,加123 是为了看效果。楼主 把你的问题,整理下 贴出来看看
... + $(this).parent().attr('id') //td的父元素tr并没有id属性值