我使用purecss作爲簡單項目的基礎。我目前遇到的問題是我有一個提交按鈕,我將從這些字段中提取一些信息,點擊時我想運行一些JavaScript,並將用戶轉到另一頁。這是我正在嘗試沒有運氣:onClick和操作html
<div class="pure-controls">
<button type="submit" class="pure-button pure-button-primary" onClick="saveInfo(this.form)" action="confirm.html">Submit</button>
<button type="submit" class="pure-button pure-button-primary">Search</button>
</div>
只有''
好,我怎麼能得到按鈕來執行js和更改頁面呢? – erp 2014-09-02 19:19:13
在saveInfo中,可以設置document.forms [0] .action =「confirm.html」(假設它是頁面上的第一個表單)。 真的,你應該創建一個監聽按鈕的事件監聽器,並刪除整個內聯的東西。 – briansol 2014-09-02 19:20:35