View Full Version : Searching within code...

12-04-2009, 03:57 AM
I'm looking to find a way to search through javascript in the current document and save certain lines into an array. If the code had been in a div, I could easily use something like document.getElementById("Something".value but in this case, the code is in the header and I'm not positive how to read the information.

Any suggestions would be a great help.

Philip M
12-04-2009, 09:05 AM
Could you please give a clearer explanation of what you are trying to achieve, and why you want to do this?

You can capture the entire HTML page source thus:-

<script type="text/javascript" >

var str = document.getElementsByTagName('html')[0].innerHTML;
alert (str);


"Success is the ability to go from one failure to another with no loss of enthusiasm."
Sir Winston Churchill, British politician (1874 - 1965)