...

View Full Version : Link List and Jumpmark Checker



Basscyst
03-13-2004, 01:14 AM
Hello,

This script seems to work pretty well, it is IE only. View Source on a web page and save it as a .txt to your desktop. This script will take the file and list all links on the page. It will also check to ensure that all jumpmarks are properly defined.



<html>
<head>
<script language="javascript">
function go(path)
{
var sfo=new ActiveXObject('scripting.FileSystemObject');
var fileLoc=sfo.OpenTextFile(path);
str=fileLoc.readall();
str=str.toLowerCase();
var cut=str.split('<a href=')
var str2=""

for(i=0;i<cut.length;i++)
{
var stop=cut[i].indexOf('</a>');
var url=cut[i].substring('0',stop);
var url='<a href='+url+'</a><input type="checkbox">'
str2+=url+'<br>';
}

info.innerHTML=str2;
}

function getBookMarks()
{
list1=new Array();
var cut=str.split('<a name=');

for(i=0;i<cut.length;i++)
{
var stop=cut[i].indexOf('>');
var aname=cut[i].substring('0',stop);
list1[i]=aname;
}
getHref();
}

function getHref()
{
var strg="";
var cut=str.split('<a href="#');
yep=0;
for(i=1;i<cut.length;i++)
{
var stop=cut[i].indexOf('">');

var aname=cut[i].substring('0',stop);
var check=0;
for(j=0;j<list1.length;j++)
{
if(aname==list1[j])
{
check=1;
}
}
if(check==0)
{
info2.innerHTML+='The bookmark '+aname+' seems to be missing.<br>';
yep=1;
}

}
if(yep==0)
{
info2.innerHTML="Every hyperlink points to a defined jumpmark,"+
" this does not mean they necessarily point to the right jumpmark."
}
}
</script>
</head>
<body onload="go()">
<table border="0" style="text-align:center;">
<tr>
<th>File Name</th>
</tr>
<td>
<input type="text" id="filen"></td><td>
<input type="button" value="Get Links" onclick="go(document.getElementById('filen').value);">
<input type="button" value="Check Jumpmarks" onclick="getBookMarks()"></td></tr></table>
<div id="info2">
</div>
<div id="info">
</div>
</body>
</html>


Basscyst



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum