2014-01-23 59 views
0

我在我的JSP頁面中使用下面的按鈕,但它給我錯誤並拒絕打開href中的頁面,有人可以告訴我我在這裏失蹤了什麼嗎?HTML按鈕onclick鏈接不工作

<button type="button" class="btn" onclick="location.href='<%=request.getContextPath()%>/inventory/edit-product/?productid='${productinfo.id};">Edit Product</button> 

感謝您的時間

回答

1

你遺失了一個單引號。它應該是

<button type="button" class="btn" onclick="location.href='<%=request.getContextPath()%>/inventory/edit-product/?productid=${productinfo.id}';">Edit Product</button> 
+0

沒有工作,因爲它不解析$ {} productinfo.id所以 – MChan

+0

是無效的產品ID或按鈕的JavaScript錯誤的問題點擊? –

+0

產品ID確實存在,甚至可以在HTML代碼中看到它,但JS不會將其添加到網址 – MChan