Tutorial :redirect to another page



Question:

< type="button" value="PRINT" onClick="window.open('print.php?id=&sec=&subj=&type=viewrec2&Year=&faci= ','mywindow','width=800,height=800,left=0,top=100,screenX=0,screenY=100')">

when i click this button im being redirected into a new window. the problem is that on the main page where this button is located i want it also to redirect it to the previous page on that the same window how can i do that im using php and javascript?


Solution:1

<input type="button" value="PRINT" onClick="window.open('print.php?id=&sec=&subj=&type=viewrec2&Year=&faci= ','mywindow','width=800,height=800,left=0,top=100,screenX=0,screenY=100');history.back()">   


Solution:2

Just add

history.go(-1);  

changing the code to:

<input type="button" value="PRINT" onClick="window.open('print.php?id=&sec=&subj=&type=viewrec2&Year=&faci= ','mywindow','width=800,height=800,left=0,top=100,screenX=0,screenY=100');history.go(-1)">   

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »