在使用a標籤的時候,onclick想調用search()方法,可是卻報了Uncaught TypeError: search is not a function 的錯。
<a href="javascript:void(0)" οnclick="search('lastPage')">[最後一頁]</a>
經檢查,search(pageType)方法是存在的,而且也沒有其它叫做search的標籤。
後來參考其它博文和下方的問題解答,
https://stackoverflow.com/questions/43882788/why-does-this-anchor-say-search-is-not-a-function
將search方法改了名字,就可以了!
<a href="javascript:void(0)" οnclick="searchInfo('lastPage')">[最後一頁]</a>
附:a標籤裏onclick的幾種寫法: