I've been using this type of code in loads of files / websites and it works perfectly, e.g. below from another of my files works fine.
About the backslashes, I need to put those in for the quotes. Otherwise I get and error. If I remember correctly, it's PHP requirement or is it Java? Don't know but it works with backslash and it doesn't work without backslash.
function mycontacts()
{location.href=\"FT_Contacts.php\"; return false;
window.open(location.href); return false;}
<input type=\"button\" value=\"Contacts\" onclick=\"mycontacts()\">