JS很神奇的问题。。加个alert显示结果就没问题了。。

先看我的JS代码。
[b]页面进入的时候初始化方法:[/b]
[code="html"]


[/code]
[code="js"]
function initFunction(enterpriseType,rs1)
{
ajaxViewServiceType(enterpriseType);
//alert("ffff")只要这里加上这个alert,无论其中alert的什么,后面的两句代码都可以正常起作用。

$("#divServiceType a").css({'font-weight':'100'});
$("#aServiceType"+rs1).css({'font-weight':'bold'});
}
[/code]
[size=medium]
事先已经被ajaxViewServiceType(enterpriseType);初始化了,这里没什么问题。。
后面的两句话我是想先把divServiceType 下的A标记的字体改细,然后将其中一个加粗。。现在的问题是,如果我不写alert,它就不给我加粗。。我实在搞不懂为什么,有点摸不着头脑了。[/size]

这种问题肯定是,div元素还不存在引起的

检查你的ajaxViewServiceType方法