jquery 怎么获取所有页面上所以的 <a href>之类的标签,
如: <a href="a.html">点击一</a>
<a href="b.html">点击一</a>然后将所有获得的这样的超链接的disabled设为true,即灰掉,不能点???
如: <a href="a.html">点击一</a>
<a href="b.html">点击一</a>然后将所有获得的这样的超链接的disabled设为true,即灰掉,不能点???
解决方案 »
- 悲剧了。。。只能调用前面两个js
- js创建img并添加点击事件
- ●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●●哪些对象有item属性啊????这句话啥意思啊????
- 关于jsp struts的如何生成.do
- Ext.grid.GridPanel中Ext.data.Store的json过长,不显示
- 求小数位四舍五入的函数!!!????????!!!!!!!!!!!
- 求一正则表达式,狂急
- 怎么会有个child属性的<A href="#" child="login">??不明啊
- 什么地方能够下载%【资料较全】%的javascript的书籍???
- 主页中的滚动条是粗细和颜色是否可调节???
- js 的内存泄漏问题如何检测?
- javascript 数组问题
$("a").each(function(){$(this).attr("href","javascript:void(0)").css("color","#ccc")})
</script>
var aElements = document.getElementsByTagName("a")
for(var i=0;i<aElemenets.length;i++){
aElements[i].disabled = true;
}
$(this).attr("disabled",true);
})//获得所有的a标签
$("a").each(function(){
$(this).attr("href","javascript:void(0)").css("color","#ccc").attr("text-decoration","none");
})//这样应该符合你的要求了
$("a").each(function(){
$(this).attr("href","javascript:void(0)").css("color","#ccc").css("text-decoration","none");
})//获得所有的a标签这样,刚才的不算好
var a = document.getElementsByTagName('a');
var len=a.length;
for(var i=0;i<len;i++){
a.href = javascript:void(0);
}
这个就行了 href没有disable这个属性 用void(0) 也行 虽然能点 但点了没起作用 也能实现你的效果啊
{
$("a").each(function(){
$(this).removeAttr("href");
$(this).attr("style","color:#CCC;");
})}
//调用ff()如果变灰之后还要变回来就这样function ff(type)
{
$("a").each(function(){
if(type==1)
{
$(this).attr("onclick","return false");
$(this).attr("style","color:#CCC;");
}
else
{
$(this).removeAttr("onclick","return false");
$(this).attr("style","color:#00f;");
}
})}
//调用ff(1)变灰不能点 调用ff(0)恢复能点状态
$(this).removeAttr("onclick");
多了个参数