第一种:view-source法
view-source是一种协议,早期基本上每个浏览器都支持这个协议。但是不知道什么原因,从ie6 beta2以后ie就不再支持此协议了。这个方法现在只能用在firefox浏览器上使用了!
使用方法:在浏览器地址栏中输入
view-source:
回车即可看到网页的源代码了。
第二种:javascript法
这种方法似乎也不是通用的,在ie6和opere浏览器上试验成功,但是在firefox浏览器上就没成功!
使用方法:在浏览器地址栏中输入
复制代码 代码如下:
javascript: s=document.documentelement.outerhtml;document.write();document.body.innertext=s;
回车即可看到网页的源代码了。
第三种方法:通过vbscript方法
复制代码 代码如下:
ilocal=get.htm.txt
iremote=inputbox(请输入你要获取源码的地址,脚本之家,http://www.jb51.net)
if iremote= then iremote=http://www.baidu.com
set xpost=createobject(microsoft.xmlhttp)
xpost.open get,iremote,0
xpost.send()
set sget=createobject(adodb.stream)
sget.mode=3
sget.type=1
sget.open()
sget.write xpost.responsebody
sget.savetofile ilocal,2
第四种方法:通过后台语言asp,php等
用到这类方法的一些都是一些站长级别的了,所以大家可以用原创获取代码的方法,呵呵,这里就不给具体的代码了,具体的代码,脚本之家里面有很多。