phpaddict
phpaddict

Reputation:

redirect to another page

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

Upvotes: 1

Views: 719

Answers (2)

Andrew Ensley
Andrew Ensley

Reputation: 11697

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

Upvotes: 1

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114417

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

Upvotes: 4

Related Questions