How do I open a link in the same window and tab using the onclick event? How do I open a link in the same window and tab using the onclick event? ajax ajax

How do I open a link in the same window and tab using the onclick event?


I used this and it worked

<a href="#" class="home_btn" onclick="location.reload();location.href='index.jsp'">منوی اصلی</a> 


change your :

onclick="window.open('index.jsp#home')" >home</a>

to

onclick="parent.location='index.jsp#home'">home</a>

no need to reload.


like this?

<input id="but1" type="button" value="click"></div>function loadIndex() {    window.location.href = "http://jsfiddle.net/Xotic750/u5nmt/";}document.getElementById("but1").addEventListener("click", loadIndex, false);

on jsfiddle

remember jsfiddle is in frames