This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Help - Table generated by javascript and reset by history.go(-1) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Help - Table generated by javascript and reset by history.go(-1)" Watch "Help - Table generated by javascript and reset by history.go(-1)" New topic
Author

Help - Table generated by javascript and reset by history.go(-1)

Alice Wong
Greenhorn

Joined: Oct 12, 2004
Posts: 22
Hi, I'm new here!

I have a page which has a table. Whenever a link is clicked, a new row will be inserted by the following script:

function insRow()
{
var x=document.getElementById('Revenue').insertRow(-1)
var y=x.insertCell(0)
var z=x.insertCell(1)
var a=x.insertCell(2)
var b=x.insertCell(3)
var c=x.insertCell(4)
var d=x.insertCell(5)
y.insertAdjacentHTML("afterBegin", '<input type="text" name="textfield">')
z.insertAdjacentHTML("afterBegin", '<input name="code" type="text" id="code" size="5">')
a.insertAdjacentHTML("afterBegin", '<input name="fees" type="text" id="fees" size="15" >')
b.insertAdjacentHTML("afterBegin", '<input name="qty" type="text" id="qty" value="1" size="10" >')
c.insertAdjacentHTML("afterBegin", '<input name="amt" type="hidden" id="amt" value="0">')
d.insertAdjacentHTML("afterBegin", '<input type="checkbox">')
y.children(0).focus();
}


I have another link on this page which goes to another page and then return back to the original page by history.go(-1). However, after that the original page will be reset without the rows added. Is there anything I can do to prevent the reset? Thx!
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Unless you find some way to save the data (server side or cookie), there is nothing you can do.


(cookies are very limited to length so not a good idea)


Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help - Table generated by javascript and reset by history.go(-1)
 
Similar Threads
pass a variable in the URl
How to add form fields dynamically
Firefox problem when showing/hiding table rows
javascript error: object expected
Need Help With Dynamic text box in JSP