Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to open a page in same browser in javascript

 
Priya Lavti
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to open a page in the same browser depending on the selected value of a combo box. The page should be opened only after submit button is closed. Presently I am using window.open(url) method, but it opens the page in new browser. And I tries using window.open(url, _self) but it also didn't help me. here is the script which I am using::

function categorySearch() {
if (form2.catselect[1].selected) {
window.open("catPage1.jsp",_self);
}
if (form2.catselect[2].selected) {
window.open("catPage2.jsp",_self);
}
}

Looking forward for a sloution
Thanks in advance
 
vidhyasagar reddy
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
function categorySearch() {
if (form2.catselect[1].selected) {
document.form2.action="catPage1.jsp";
}
if (form2.catselect[2].selected) {
document.form2.action="catPage1.jsp";
}
document.form2.submit();
}
 
Priya Lavti
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It solved my problem
Thanks again!!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic