Implementation code: Copy code The code is as follows: <br>function addFav(){<br> if(document.all){<br> window.external.addFavorite('http://jb51.net','FREE Web Directory');<br> }else if(window .sidebar){<br> window.sidebar.addPanel('FREE Web Directory', 'http://jb51.net','');<br> }<br>}<br><br></ script><br><a href="http://jb51.net" title="FREE Web Directory" rel="sidebar" onclick="addFav();">Add to favorites</a>< /div><br> </div> <p>When adding JavaScript to favorites, you need to pay attention to one detail. If "rel=sidebar" is not added above <a>, an error will be reported: window.sidebar.addPanel is not a function. </p>