I am very new to javascript, and written a program that will open a querystring as link.
I used window.open() , but the link is opening in new tab,
I want to open this link in the same tab.
The code is below.
var strquerystring;
if(fromvalue==""||tovalue==""){
alert('kindly fill all the details');
}else{
window.open(strquerystring);
}
Use
Instead of window.open. It will then change the current URL.
Use either of these:
Instead of asking the browser to open a new window. Try asking the browser to open a new location.
So in your else clause:
window.location = (window.location + strquerystring);
This will tell the browser to navigate to the location given. Instead of opening a new window. Thus keeping you in the same "tab"
Hope that helps.
You need to use the name attribute:
If you want to change the current URL: