單擊元素,觸發事件時,如何將觸發的元素傳到對象的構造函數中;$('.newProduct a').click(function(){ commn.productclick();})var commn={???? productclick:function(){???????? var url=this.href;???????? url=decodeURI(url);???????? var uname=$('#login').html();???????? var ugwc=$('#gwc').html();???????? url=url.replace('請登錄',uname);???????? url=url.replace('我的購物車',ugwc);???????? console.log(url); //undefind???????? $(this).attr('href',url);???????? alert(this.href);alert(uname); ????}}
對象的問題?
jsj2283308644
2017-04-26 10:11:25