Javascript using window.location seems to lose state
Posted on
16th Feb 2014 07:03 pm by
admin
Not sure what forum so let me know if I'm in the wrong place.
I have a main window with a ajax grid that has a column of links that uses javascript and window.location to go to another page to show check stub information. When I use the backbutton on the browser everything persists on main window. Ok so far.
If I navigate to the window with the show check stub information, there is a 'Print' button that again thru javascripts prints the grid with the check info on it. (Code I got of the internet with some minor changes I made).view plaincopy to clipboardprint?function Print() { var curVisible = true; var grid_obj = document.getElementById('<%= grdVoucherDetail.ClientID %>'); for (var i = 1; i < grid_obj.rows.length-1; i++) { grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline"; grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline"; } if (grid_obj != null) { var new_window = window.open('print.html'); //print.html is just a dummy page with no content in it. new_window.document.write(grid_obj.outerHTML); new_window.document.close(); new_window.focus(); new_window.print(); new_window.close(); } curVisible = false; for (var i = 1; i < grid_obj.rows.length-1; i++) { grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline"; grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline"; } } function Print() {
var curVisible = true;
var grid_obj = document.getElementById('<%= grdVoucherDetail.ClientID %>');
for (var i = 1; i < grid_obj.rows.length-1; i++) {
grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline";
grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline";
}
if (grid_obj != null)
{
var new_window = window.open('print.html'); //print.html is just a dummy page with no content in it.
new_window.document.write(grid_obj.outerHTML);
new_window.document.close();
new_window.focus();
new_window.print();
new_window.close();
}
curVisible = false;
for (var i = 1; i < grid_obj.rows.length-1; i++) {
grid_obj.rows[i].cells[8].style.display = curVisible ? "none" : "inline";
grid_obj.rows[i].cells[9].style.display = curVisible ? "none" : "inline";
}
}
Now after the print and closing that popup I click the backbutton again and things don't seem to persist.
I did notice that the pageload of the main window (one I'm going back to) gets triggered after the printing of the grid where if I don't click the print button and go back the pageload does not get triggered.
Any ideas would be appreciated. I have searched and searched for an answer and am getting nowhere. When this happens I usually feel that I've done something stupid. Oh well
Thanks for any help that you can give me
No comments posted yet
Your Answer:
Login to answer
87 21
Other forums
Forum tutorial
Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For no
EXplanation help
Hey all,
I am still fairly new to PHP programming and I am trying to put together a page wher
couldn't connect to your database
Hello I am new to php mysql
Actually i have read A tutorial on nettuts
"http://net.tu
natcasesort works on one server but not on another
Hi
I have a problem that I was hoping that someone can help me with.
I'm trying to use
whats wrong with my code please help!!!
this is the error
Warning: mysql_close(): supplied argument is not a valid MySQL-Link res
Undefined variable: adHTML
Hello:
While checking my site error logs, I've noticed one repetitive error that fills the lo
Passing Variables
What I'm wanting to do is when the user clicks on Arenas it will know the name of the country it's w
Floating Point Precision Loss
I'm writing a program to draw a three-dimensional cube (with a corner cut off) without using any 3D
Allowing ' and "
Hello everyone,
I am creating a form where users submit information to go into a database. I
mysql timestamp manipulation
How could I use a timestamp (e.g 2009-10-30 13:20:35 ), and with php find out if it is:
from