$(document).ready(function(){ $(".nav .nav_li").mouseover(function(){ $(this).find("ul").show(); }); $(".nav .nav_li").mouseleave(function(){ $(this).find("ul").hide(); }); $(".header_login").click(function(){ $(".shade_div").show(); $(".login_content").show(); }); $(".login_close").click(function(){ $(".shade_div").hide(); $(".login_content").hide(); }); })(jquery); function autoresizeimage(obj, width, height){ var img = new image(); img.src = obj.src; var scale = math.max(width / img.width, height / img.height); var newwidth = img.width * scale; var newheight = img.height * scale; var div = obj.parentnode; obj.width = newwidth; obj.height = newheight; div.style.width = width + "px"; div.style.height = height + "px"; div.style.overflow = "hidden"; obj.style.marginleft = (width - newwidth) / 2 + "px"; obj.style.margintop = (height - newheight) / 2 + "px"; } function addfavorite(surl, stitle){ try{ window.external.addfavorite(surl, stitle); } catch (e){ try{ window.sidebar.addpanel(stitle, surl, ""); } catch (e){ alert("加入收藏失败,请使用ctrl+d进行添加"); } } }