|
JavaScript获取网页源代码 |
来源:转载 人气:1113 录入时间:2007-11-8 |
<html>
<head>
<title>JavaScript获取网页源代码 </title>
<SCRIPT LANGUAGE="JavaScript">
function viewSource() {
window.location.href= "view-source:" + document.getSource.url.value;
return false;
}
</script>
</head>
<body>
<form name=getSource onSubmit="return viewSource();">
<input type=text name=url value="http://" size="45">
<br>
<br>
<input type=submit name=view value="查看源代码">
</form></td></tr>
</body>
</html>
网人源代码:http://www.webren.cn/tool/viewsource.html
<SCRIPT LANGUAGE="JavaScript">
function viewSource() {
document.getSource.view.value="请稍等...";
//在找寻源代码时按钮view上出现的文字
setTimeout("document.getSource.view.value='查看源代码'",6000);
//查看源代码的等待时间为6秒
window.location.href= "view-source:" + document.getSource.url.value;
//查找名称为getSource的form的子元:文本框url中的值对应的网址
return false;
}
</script>
|
|
|