using document.getElementBy().innerHTML

<a class="myClass" href="myURL">whatever</a>

<script type="text/javascript">
function hello()
{
  var foo = mydocumentgetElementsByClassName("myClass")[0];
  if (foo) alert(foo.innerHTML);
}

function mydocumentgetElementsByClassName(what)
{
  var all=document.getElementsByTagName('*')
  var expression=new RegExp('\\b'+what+'\\b','i')
  var result=[]
  for (var i=0,l=all.length;i<l;i++) if (expression.test(all[i].className)) result.push(all[i])
  return result
}
</script>


http://www.tek-tips.com/viewthread.cfm?qid=1534478&page=10

你可能感兴趣的:(innerHTML)