最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - window.history.back();return false;" not working in IE11 - Stack Overflow

programmeradmin1浏览0评论
<select id='orginCountryID' onChange='FillSubDropdownlist(this.value)'>
    <option>-- select country --</option>
    <option>Malaysia</option>
    <option>Philippines</option>
</select>

<select id='orginCityID'>
    <option>-- select city/town --</option>
    <option>Kuala Lumpur</option>
    <option>Manila</option>
</select>

<a href="#"  onclick="window.history.back();return false;" class="btngrey"><span>back</span></>

It is not working IE11, the city option is missing. When I select a county the city automatically loads. When I click the back button the country option shows up fine, but the city option is missing only in IE, other browsers are working fine.

<select id='orginCountryID' onChange='FillSubDropdownlist(this.value)'>
    <option>-- select country --</option>
    <option>Malaysia</option>
    <option>Philippines</option>
</select>

<select id='orginCityID'>
    <option>-- select city/town --</option>
    <option>Kuala Lumpur</option>
    <option>Manila</option>
</select>

<a href="#"  onclick="window.history.back();return false;" class="btngrey"><span>back</span></>

It is not working IE11, the city option is missing. When I select a county the city automatically loads. When I click the back button the country option shows up fine, but the city option is missing only in IE, other browsers are working fine.

Share Improve this question edited Aug 18, 2014 at 7:42 Ravinder Reddy asked Aug 18, 2014 at 4:03 Ravinder ReddyRavinder Reddy 211 silver badge3 bronze badges 7
  • 1 Where is that FillSubDropdownlist() function you are referring to defined? If the code is set up properly, that part should make the city dropdown box display once you have selected a valid country fom the country dropdown box. – IQAndreas Commented Aug 18, 2014 at 4:08
  • Also, I think some of the code was cut off (only the first part of the <a href was in your code) – IQAndreas Commented Aug 18, 2014 at 4:08
  • 3 don't use a <a> if you're not going to link to another resource. href="#" actually means something in HTML5, namely "navigate to the top of this document" so if you need what is effectively a button, not a link to the top of the document, use a <button> element and then add CSS to make it look exactly how you need it to look (the only reason it looks like a button is browser default styling, all of which is overrulable) – Mike 'Pomax' Kamermans Commented Aug 18, 2014 at 4:13
  • Did you try window.history.go(-1) instead of back(). I think I had similar problem before. – Shinigamae Commented Aug 18, 2014 at 7:47
  • yes if i change like this window.history.go(-1) ....its working in IE but fails in chrome – Ravinder Reddy Commented Aug 18, 2014 at 7:48
 |  Show 2 more ments

1 Answer 1

Reset to default 3

Try

<a href="#" onclick="window.history.go(-1); return false;" class="btngrey"><span>back</span></a>

Or

<a href="#" onclick="history.go(-1); return false;" class="btngrey"><span>back</span></a>

Hope this works.And remember to close your tag properly

发布评论

评论列表(0)

  1. 暂无评论