Moved the javascript to a separate file.
Signed-off-by: retep998 <retep998@verizon.net>
This commit is contained in:
parent
bf8cebf6ce
commit
3e62e81982
15
test.html
15
test.html
@ -2,25 +2,14 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>What is this I don't even.</title>
|
<title>What is this I don't even.</title>
|
||||||
|
<script type="text/javascript" src="test.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1 id="poke">Sup?</h1>
|
<h1 id="poke">Sup?</h1>
|
||||||
<a href="http://www.google.com/">This is a link to google</a>
|
<a href="javascript:analyze();">Click me to analyze the page.</a>
|
||||||
<form class="blah">
|
<form class="blah">
|
||||||
<input id="foo" name="lel" type="text" />
|
<input id="foo" name="lel" type="text" />
|
||||||
<input id="bar" type="submit" />
|
<input id="bar" type="submit" />
|
||||||
</form>
|
</form>
|
||||||
</body>
|
</body>
|
||||||
<script type="text/javascript">
|
|
||||||
var all = document.getElementsByTagName("*");
|
|
||||||
for (var i = 0; i < all.length; ++i) {
|
|
||||||
var info = new Array();
|
|
||||||
info[0] = all[i].tagName;
|
|
||||||
info[1] = all[i].getAttribute("id");
|
|
||||||
info[2] = all[i].getAttribute("name");
|
|
||||||
info[3] = all[i].getAttribute("class");
|
|
||||||
info[4] = all[i].getAttribute("type");
|
|
||||||
alert(JSON.stringify(info));
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</html>
|
</html>
|
17
test.js
Normal file
17
test.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
function analyze() {
|
||||||
|
var all = document.getElementsByTagName("*");
|
||||||
|
for (var i = 0; i < all.length; ++i) {
|
||||||
|
var info = new Array();
|
||||||
|
var validtags = ["A", "BUTTON", "FORM", "IMG", "INPUT", "LINK", "OPTION", "SELECT", "TABLE", "TEXTAREA"];
|
||||||
|
if (validtags.indexOf(all[i].tagName) < 0) continue;
|
||||||
|
info[0] = all[i].tagName;
|
||||||
|
info[1] = all[i].getAttribute("id");
|
||||||
|
info[2] = all[i].getAttribute("name");
|
||||||
|
info[3] = all[i].getAttribute("class");
|
||||||
|
info[4] = all[i].getAttribute("type");
|
||||||
|
dostuff(info);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function dostuff(info) {
|
||||||
|
alert(JSON.stringify(info));
|
||||||
|
}
|
Reference in New Issue
Block a user