if (evt.stopPropagation) { evt.stopPropagation() } if (evt.preventDefault) { evt.preventDefault() } try { evt.cancelBubble = true } catch (e) { } try { evt.returnValue = false } catch (e) { }
// 經由bike提示,發現這範例不好 jQuery 可以直接 return false; $("#gc-exp-month-select a").click(function (evt) { $("#gc-exp-month").val($(this).text()); $("#span-gc-exp-month").text($(this).text()); $(this).parent().hide(); if (evt.stopPropagation) { evt.stopPropagation() } if (evt.preventDefault) { evt.preventDefault() } try { evt.cancelBubble = true } catch (e) { } try { evt.returnValue = false } catch (e) { } // 在 jQuery 裡上面四行 可以用一行 return false; 就可 });
document.getElementById("form1").reset();
<input type='hidden' name='txtId' value='xxx' />
.mobile-share_fb{ display:block; background:url("http://www.shopunt.com/css/mobile/images/mobile-s9398562778.png") no-repeat; background-position: 0 -1648px; height: 80px; width: 80px;}
.shrink-attr{ background-size: 152px 2104px; width: 40px; height: 40px; background-position: 0 -824px;}
.fb-test{ display:block; background:url("http://www.shopunt.com/images/logo_welcome.jpg") no-repeat; background-size:50% 50%; width: 105px; height: 105px;}
//避免 console.log 發生錯誤. if (typeof console == "undefined") var console = { log: function () { } }; else if (typeof console.log == "undefined") console.log = function () { };
<div id="menuContainer"> <div id="menu"> <ul> <li>menu1</li> <li>menu2</li> </ul> </div> <div> ...長內容.... </div> </div>
var __ContainerHeight = 5000; var __ContainerTop = 160; var __MenuHeight = 550; var __FixedTop = 20; $(window).load(function () { __ContainerHeight = $("#menuContainer").height(); __ContainerTop = $("#menuContainer").offset().top; __MenuHeight = $("#menu").height(); $("#menu").css({ "top": __FixedTop + "px", "position": "absolute" }); $(window).scroll(function () { var scrolls = $(this).scrollTop(); //console.log(scrolls); if (scrolls < __ContainerTop) { $("#menu").css({ "top": __FixedTop + "px", "position": "absolute" }); } else if ((scrolls + __MenuHeight + __FixedTop) > (__ContainerHeight + __ContainerTop)) { $("#menu").css({ "top": (__ContainerHeight - __MenuHeight) + "px", "position": "absolute" }); } else { $("#menu").css({ "top": __FixedTop + "px", "position": "fixed" }); } }); });
<body> <!--BodyTop--> {DebugMessage} <a id="anchorGoTop" href="#gotop" class="gotop" style="display: none;"><span><em></em></span></a>
'購物button區塊置於 <body> 正下方 Me.strBodyTop = Me.otContent.SubTemplate("BuyButtonArea").Result就可以了