Simple Machines Community Forum

General Community => Scripting Help => Aiheen aloitti: edi67 - kesäkuu 08, 2008, 06:46:53 AP

Otsikko: Bookmarksite Script error
Kirjoitti: edi67 - kesäkuu 08, 2008, 06:46:53 AP
I have one problem i want add script for bookmarksite so i insert this before code HEAD:

<script type="text/javascript">

function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

</script>


and after i add the comand everywhere i want in template :

<a href="javascript:bookmarksite('CrazyZone', 'http://ediboardlatervista.org')">Add to Favorites</a>

Problem is the caratter ' show me error in my template:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /membri/ediboard/Themes/default/index.template.php on line 517


i dont understand in many site work but in my site not work the CARATTER '

some solution ?
Otsikko: Re: Bookmarksite Script error
Kirjoitti: vbgamer45 - kesäkuu 09, 2008, 10:57:19 IP
You need to escape the '

Find

<a href="javascript:bookmarksite('CrazyZone', 'http://ediboardlatervista.org')">Add to Favorites</a>

Change to

<a href="javascript:bookmarksite(\'CrazyZone\', \'http://ediboardlatervista.org\')">Add to Favorites</a>
Otsikko: Re: Bookmarksite Script error
Kirjoitti: edi67 - kesäkuu 10, 2008, 07:29:06 AP
excellent, work like a chamr now thx ;)