2010-10-24 84 views
0

我想讓我的JavaScript在IE7中工作,在所有其他瀏覽器中都能順暢地運行。IE7中的JavaScript小書籤

document.write('<li><a class="bookmarklet" href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL('bookmarks', $GLOBALS['user']); ?>?action=add&amp;popup=1&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d,\'<?php echo jsEscTitle($GLOBALS['sitename']); ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=790,height=465,left=\'+(screen.width-790)/2+\',top=\'+(screen.height-425)/2);void 0;"><?php echo jsEscTitle(sprintf(T_('Share with %s '), $GLOBALS['sitename'])); ?><\/a><\/li>'); 

感謝您的幫助。

謝謝。

+1

究竟是什麼問題?你會得到什麼錯誤?此外,你的代碼包含PHP,這在上下文中是沒有意義的。請顯示最終的呈現代碼 – 2010-10-24 10:00:51

+0

謝謝Pekka。我所得到的是一個非常普遍的錯誤,無效的論點。 – SKD 2010-10-24 10:03:26

回答

0
document.write('<li><a class="bookmarklet" href="javascript:x=document;a=encodeURIComponent(x.location.href);t=encodeURIComponent(x.title);d=encodeURIComponent('+selection+');open(\'<?php echo createURL(\'bookmarks\', $GLOBALS[\'user\']); ?>?action=add&amp;popup=1&amp;address=\'+a+\'&amp;title=\'+t+\'&amp;description=\'+d,\'<?php echo jsEscTitle($GLOBALS[\'sitename\']); ?>\',\'modal=1,status=0,scrollbars=1,toolbar=0,resizable=1,width=790,height=465,left=\'+(screen.width-790)/2+\',top=\'+(screen.height-425)/2);void 0;"><?php echo jsEscTitle(sprintf(T_(\'Share with %s \'), $GLOBALS[\'sitename\'])); ?><\/a><\/li>'); 
+0

感謝RamRam,但這不起作用,它給了我一個HTTP 500錯誤,這意味着\添加到代碼中的這些錯誤不起作用! – SKD 2010-10-24 10:24:33