jquery 加载 带 javascript 的html ,脚本未正确执行

ruoge2007 ruoge2007 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
var checked = $(this).attr["checked"];
checked 总为undefined
$(this).attr["name"] 总为undefined


<div id="idPostPanel">
<div style=" clear:both">
<input type="checkbox" id="idSelAllA" name="aaabbb" />全选  <a id="idDelAll" href="javascript::funcDelAllPost( 'idAllPost')" >删除</a>
</div>
<div style=" clear:both">
<div style=" clear:both;" ><input type="checkbox" value="pID1" name="name_postItem" /><a>测试1</a></div>
<div style=" clear:both;" ><input type="checkbox" value="pID2" name="name_postItem" /><a>测试1</a></div>
<div style=" clear:both;" ><input type="checkbox" value="pID3" name="name_postItem"/><a>测试1</a></div>
<div style=" clear:both;" ><input type="checkbox" value="pID4" name="name_postItem"/><a>测试1</a></div>
</div>
<div style=" clear:both">
<input type="checkbox" id="idSelAllB" />全选   <a id="A1" href="javascript::funcDelAllPost( 'idAllPost')">删除</a>
</div>
<!--javascript--->
<script type="text/javascript">
$( function()
{
function funcSelAll()
{
var checked = $(this).attr["checked"];
///checked 总为undefined
alert( $(this).attr["name"]);
///$(this).attr["name"] 总为undefined
if( checked == true)
{
$("input[name='name_postItem']").each
(
function ()
{
alert( "a" +$(this).attr["value"]);
$(this).attr["checked", true];
}
);
}
else
{
$("input[name='name_postItem']").each
(
function ()
{
alert( "b" + $(this).attr["value"]);;
$(this).attr["checked", false];
}
);
}
};
$("#idSelAllA").click( funcSelAll);
$("#idSelAllB").click( funcSelAll);
}
)
</script>
</div>



$("#idPostHis").click
( function()
{
function funcSuccess( result)
{
$("#idCont").html( result["d"]);
};
function funcError( xhr, ts)
{
alert(ts);
};
$.ajaxWebService( "/WebAjaxHelp.asmx/user_postInfo", "{}","json", funcSuccess,funcError );
///改为html 时 $("#idCont").html( result["d"]),啥也没显示;$("#idCont").html( result);是形如 ["d":"..."]样的数据。
}
);
...全文

相关推荐

评论 2
收藏 已收藏
分享
返回顶部
ruoge2007
Ajax 52,778 成员 25,334 内容