Solved

Keeping added table rows on page return.

Posted on 2011-03-02
1
241 Views
Last Modified: 2012-05-11
I’m using this little Jscript I found to add rows to a form table. I’m using classic asp on this page and when I have a return on the page (error or whatever), it resets back to default with only one row. Is there a way using this code to keep the number rows on a page return? Thanks for your help///
<script type="text/JavaScript">
	function addRow(r){
		var root = r.parentNode;//the root
		var allRows = root.getElementsByTagName('tr');//the rows' collection
		if(allRows.length<10) {
			var cRow = allRows[0].cloneNode(true)//the clone of the 1st row
			var cInp = cRow.getElementsByTagName('input');//the inputs' collection of the 1st row
			
			for(var i=0;i<cInp.length;i++){//changes the inputs' names (indexes the names)
				cInp[i].setAttribute('name',cInp[i].getAttribute('name')+'_'+(allRows.length+1))
			}
			root.appendChild(cRow);//appends the cloned row as a new row
		}
		else {
			alert("Only 5 rows allowed");
		}
	}
</script>

Open in new window

0
Comment
Question by:inrworx
1 Comment
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 500 total points
ID: 35024260
either you have to save the table row to cookie or save it on the server, so that at next page load, you can fetch that new row
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Redirection in Javacsript 10 383
Dropdown list 4 204
Trying to format phone number on keyin. 5 99
CGI Generic Cross-Site Scripting (comprehensive test) 443 / tcp / www 7 191
This article was originally published on Monitis Blog, you can check it  here . If you have responsibility for software in production, I bet you’d like to know more about it. I don’t mean that you’d like an extra peek into the bowels of the sour…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question