|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Dynamically added rows not visible when i press back button
I have created some rows dynamically. When i submit the form, it goes to next screen. Then, when i press back button dynamically generated rows are not present. I want these rows to be avaialble , so that user can modify his entries.
My Code: First Screen: Test.html <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <HTML><HEAD><TITLE></TITLE> <SCRIPT> <!-- Hide script from HTML-compliant browsers function addRowToTable() { var tbl = document.getElementById('tblSample'); var lastRow = tbl.rows.length; // if there's no header row in the table, then iteration = lastRow + 1 var iteration = lastRow; var row = tbl.insertRow(lastRow); // left cell var cellLeft = row.insertCell(0); var textNode = document.createTextNode(iteration); cellLeft.appendChild(textNode); // right cell var cellRight = row.insertCell(1); var el = document.createElement('input'); el.setAttribute('type', 'text'); el.setAttribute('name', 'txtRow' + iteration); el.setAttribute('size', '40'); cellRight.appendChild(el); } // End script hiding. --> </SCRIPT> </HEAD><BODY bgcolor=#ffffff > <form action="Test1.html" method="get"> <input type="button" value="Add" onclick="addRowToTable();" /> <input type="submit" value="Submit" /> <table border="1" id="tblSample"> <tr> <th colspan="2">Sample table</th> </tr> <tr> <td>1</td> <td><input type="text" name="txtRow1" size="40" /></td> </tr> </table> </form> </body> Second Screen Test1.html <HTML> <HEAD> </HEAD> <BODY bgcolor=#ffffff > <form action="tableaddrow_nw.html" method="get"> <INPUT TYPE="button" NAME=".back" VALUE=" Back " ONCLICK="history.back();"> </form> </body> </HTML> |
|
#2
|
||||
|
||||
|
My guess is that going back one displays your cached page, which hasn't been altered by the js. You'll have to do this server-side if you want it to behave correctly.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
Quote:
Is there any way we can modify the browser history with the dynamic generated content. |
|
#4
|
||||
|
||||
|
Nope. By design, browser history is read-only, and even read-access is limited (you can send somebody backward in history, but there's no way to retrieve a link list from the history in js). It's a privacy issue.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Dynamically added rows not visible when i press back button |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|