You want to do something like:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function parseAttys(el){
var v = document.getElementById(el).value,
m = v.match(/<[^ \/]+ [^\/]+>/g);
for(var i = 0; i < m.length; ++i)
m[i] = (i? '\n' : '') + m[i].match(/<([^ ]+)/)[1] + '_' + i + ' attributes:\n' + m[i].replace(/"/g, '').match(/ ([^ ]+=[^ >]+)/g).join('\n');
return m.join('\n');
}
</script>
</head>
<body>
<textarea id="ta" cols="50" rows="5"><span id="bob">Hey!</span><p align="center" width=100>Yo</p></textarea><br>
<input type="button" value="Go" onclick="alert(parseAttys('ta'));">
</body>
</html>
Right? I mean this isn't a solution, but it should be a step along the the way to one. What do you think?
Bookmarks