Jquery 怎么实现加载完页面后自动将img和a中的地址替换 jquery 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $(function(){ $('img,a').each(function(){ if(this.tagName=="A")this.href=this.href.replace(/^http:\/\/www.gravatar.com/i,'') else this.src=this.src.replace(/^http:\/\/www.gravatar.com/i,'') }) }) $(function(){ $('img,a').each(function(){ if(this.tagName=="A")this.href='' else this.src='' }) }) 大致意思就是获取src或者href的属性值,然后像处理字符串一样,用replace方法将"http://www.gravatar.com"内容替换为空,基本实现方法1 楼已经给出。 用script可以重写body 内容吗? Javascript代码运行异常 求一个简单的正则表达式(输入不能大于23的数字) 求大神指教 关于jq 不懂 奇怪的URL链接,高手进来看看 如何屏蔽掉按住shift键的新打开窗口,马上给分! 如何判断一个文本当前是否获得焦点??? 关于注册页面--高手赐教 --再线等 如何用window.open()在同一页内找开??? js 时间增加指定月份 ++++++++++++++遍历+++++++++ JQ样式选择怎么改成JS的
$(function(){
$('img,a').each(function(){
if(this.tagName=="A")this.href=this.href.replace(/^http:\/\/www.gravatar.com/i,'')
else this.src=this.src.replace(/^http:\/\/www.gravatar.com/i,'')
})
})
$('img,a').each(function(){
if(this.tagName=="A")this.href=''
else this.src=''
})
})