I am writing html code inside php tags. Already for anchor tag styling is written and if i change some parts will affect. so i am trying to write my code inside span onclick event. Here is my code\[code\] <div> <span style='cursorointer;' onclick='window.location.href='http://stackoverflow.com/questions/13775330/www.google.com'> ".$array1[$i] ['name']." </span> </div>\[/code\]If that array[name] is clicked it should goto google.com. The problem is the single quotes i used for mentioning my URL. How to escape strings in this event.Hope my question was clear. Thanks in Advance.