0

I want to place all opening tags in an array.

In the example below, the following array should be created:

var tagsOpen=new Array();
tagsOpen[]='<h1 class="h">';
tagsOpen[]='<p>';
tagsOpen[]='<strong class="w">';
tagsOpen[]='<p>';
tagsOpen[]='<span style="color: red">';
tagsOpen[]='<span style="color: blue">';
tagsOpen[]='<span style="color: green">';

That array should be dynamically created from this:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Title</title>
</head>
<body>

<div id="content">
<h1 class="h">Heading</h1>
<p>Hello <strong class="w">World</strong>.</p>
<p><span style="color: red">red</span> <span style="color: blue">blue</span>  <span style="color: green">green</span></p>
</div>

<script type="text/javascript">
/*<![CDATA[*/

var obj=document.getElementById('content');
if(obj) alert(obj.innerHTML);

/*]]>*/
</script>

</body>
</html>
2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by hknight
0

I want to place all opening tags in an array.

document.getElementsByTagName('*')

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.