2009-11-13 70 views
0

我有一個書籤它獲取當前網站標題和尋找它在我的網站:搜索當前網站的標題和主機書籤

javascript:q=(document.location.host);void(open('http://example.com/search.php?search='+document.title,'_self','resizable,location,menubar,toolbar,scrollbars,status')); 

但現在我想這樣它會搜索當前改變這個書籤網站標題像現在一樣,如果沒有找到標題,它應該搜索網站主機。所以我想我應該使用其他選項或東西?有沒有辦法做到這一點?我不知道小書籤應該是什麼...

謝謝你的幫助!

回答

0

在你的代碼替換document.title有:

((document.title) ? document.title : document.location.host)