此代碼在Firefox,Chrome和Safari,但失敗對我來說上(Windows)中IE 8:爲什麼包裝在<a>標記中的<input type ='button'>在IE中不起作用?
<a href='http://google.com'>
<input type="button" name='go' value='go'>
</a>
爲什麼?我應該只使用一個(笨拙的)onClick事件來解決它嗎?
Grrrrr ....
此代碼在Firefox,Chrome和Safari,但失敗對我來說上(Windows)中IE 8:爲什麼包裝在<a>標記中的<input type ='button'>在IE中不起作用?
<a href='http://google.com'>
<input type="button" name='go' value='go'>
</a>
爲什麼?我應該只使用一個(笨拙的)onClick事件來解決它嗎?
Grrrrr ....
你不能有一個<button>
的<a>
元素中。
但是,您可以將一些CSS添加到<a>
看起來像一個按鈕。
或者繞過它想:
<input type="button" value="Google" onClick="javascript:location.href = 'http://google.com';" />
你嘗試''? – paislee 2012-03-16 01:02:39
剛剛嘗試過 - 同樣的事情:在Chrome中工作,在IE 8中不起作用:-( – Eric 2012-03-16 01:05:55
您在「a」中使用'button'有什麼動機? – Jacob 2012-03-16 01:08:55