tags:

views:

145

answers:

2

< 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?

+4  A: 
<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()">
Diodeus
thank u, it works
+1  A: 

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)">
Andrew