Reputation: 433
I am having a hard time deciphering this javascript that I want to hopefully change to meet my needs. Can someone help me read it? I understand that the URL, including and after the hash tag, (location.hash) will be stored in the sMovie variable but I don't understand what the slice(1).replace(/\"g,"");
is doing
Thanks
<script type="text/javascript">
var sMovie=location.hash.slice(1).replace(/\"/g,"");
if (sMovie) document.write('<embed style="width:100%;height:100%" wmode="transparent" type="application/x-shockwave-flash" src="'+sMovie+'.swf">');
</script>
Upvotes: -1
Views: 73
Reputation: 1547
The slashes are the regular expression. So basically if this is your url //test.com#hello"world"
location.hash.slice(1).replace(/\"/g,"");
It will return helloworld
Upvotes: 1