How to make href will work on button in IE8

不羁的心 提交于 2019-12-05 09:03:12

onclick="window.location=this.parentNode.href;"/>

this.parentNode can refer to a tag so... it should work or test getAttribute even

why not use

<form action="submit.php" method="get">
<input type="button" value="Submit" class="button" />
</form>

?

I used to be all happy that IE8 was not IE6. But seriously.

I'm using jQuery to patch up any button tag within an <a> link tag, inside conditional tags so it's just for old IEs.

<!--[if lt IE 9]>

<script type="text/javascript">
// IE8 is the new IE6. Patch up http://stackoverflow.com/questions/2949910/how-to-make-href-will-work-on-button-in-ie8
$('button').click(function(){
    document.location = $(this).parents('a').first().prop('href');
});
</script>

<![endif]-->
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!