Try this.. I think you misplaced the quotes in the function
<body onload="myFunction()">
</body>
<script type="text/javascript">
function myFunction()
{
var str="entire string";
var n=str.match(str); // var n=str.match('entire string');
alert(n)
}
</script>