473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Dynamic html question

Posted this here as it's more (I think?) javascript related than html.

I have a page that when a user clicks on a button a row is dynamivcally
added using js to an html table i.e something like -

var tab = getElement('tabCosts');
var row = tab.insertRow(tab.rows.length);

However when I move off this page & click the "back" button the new row is
not shown.

The user's shouldn't use the "back" button & I have other measures in place
to stop resubmitting the pages data etc... but just wondered if this is
normal behaviour or my fault?

Only way I can think of to possibly resolve this would be to store the
entire table in an array & redraw it during the page load() event - am I
right or am I talking complete rubbish?

thanks

harry
Jul 23 '05 #1
3 1374


harry wrote:
Posted this here as it's more (I think?) javascript related than html.

I have a page that when a user clicks on a button a row is dynamivcally
added using js to an html table i.e something like -

var tab = getElement('tabCosts');
var row = tab.insertRow(tab.rows.length);

However when I move off this page & click the "back" button the new row is
not shown.

The user's shouldn't use the "back" button & I have other measures in place
to stop resubmitting the pages data etc... but just wondered if this is
normal behaviour or my fault?


It probably depends on the browser, Opera 7 for instance is known to
store a snapshot of the page and go back to that snapshot so with Opera
7 the row added with script should be visible when the user goes back.
On the other hand Opera 7 doesn't run any scripts like body onload again
which causes a headache to some scripters.

With MSIE I think when the user goes back the content of form controls
is preserved but otherwise the page is loaded as if requested from the
server so your dynamically added element are gone.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
harry wrote:
Posted this here as it's more (I think?) javascript related than html.

I have a page that when a user clicks on a button a row is dynamivcally
added using js to an html table i.e something like -

var tab = getElement('tabCosts');
var row = tab.insertRow(tab.rows.length);

However when I move off this page & click the "back" button the new row is
not shown.
Thats because its not in the HTML of the page.
The user's shouldn't use the "back" button & I have other measures in place
to stop resubmitting the pages data etc... but just wondered if this is
normal behaviour or my fault?
Normal correct behavior.
Only way I can think of to possibly resolve this would be to store the
entire table in an array & redraw it during the page load() event - am I
right or am I talking complete rubbish?


The solution to that depends on how your navigation is set up.
If your navigation is via form buttons, you can save the data on the
server, track a session, and let the server give back what was in the page.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
thanks for the replies!

I am using IE 5.5 (sp2) & am now confident it's not my fault which is what I
needed clarification of.

I could go to the expense of saving the entire state of the page & restoring
if "back" button pressed but it hardly seems worth it. The users are bound
to point this out as a bug but at least I can counter that now!

cheers

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:41***********************@newsread4.arcor-online.net...


harry wrote:
Posted this here as it's more (I think?) javascript related than html.

I have a page that when a user clicks on a button a row is dynamivcally
added using js to an html table i.e something like -

var tab = getElement('tabCosts');
var row = tab.insertRow(tab.rows.length);

However when I move off this page & click the "back" button the new row is not shown.

The user's shouldn't use the "back" button & I have other measures in place to stop resubmitting the pages data etc... but just wondered if this is
normal behaviour or my fault?


It probably depends on the browser, Opera 7 for instance is known to
store a snapshot of the page and go back to that snapshot so with Opera
7 the row added with script should be visible when the user goes back.
On the other hand Opera 7 doesn't run any scripts like body onload again
which causes a headache to some scripters.

With MSIE I think when the user goes back the content of form controls
is preserved but otherwise the page is loaded as if requested from the
server so your dynamically added element are gone.

--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: MikeY | last post by:
Hi Everyone, Does anyone know where I can get my hands on a sample with source code of a simple dynamic button control in C# Windows form. I am looking for a sample that uses a class library...
4
by: Venus | last post by:
Hello, Thanks for your reply. I understand that a control can be created dynamically in several ways: 1) using StringBuilder 2) using Controls.Add 3) using ASP PlaceHolder But this is just...
3
by: Leo J. Hart IV | last post by:
OK, here's another question for the experts: I am building a multi-step (3 steps actually) form using a panel for each step and hiding/displaying the appropriate panel/panels depending on which...
7
by: serge | last post by:
How can I run a single SP by asking multiple sales question either by using the logical operator AND for all the questions; or using the logical operator OR for all the questions. So it's always...
8
by: Sandy Pittendrigh | last post by:
I have a how-to-do-it manual like site, related to fishing. I want to add a new interactive question/comment feature to each instructional page on the site. I want (registered) users to be able...
1
by: Satish.Talyan | last post by:
hi, i want to create a dynamic tree hierarchy in javascript.there are two parts in tree, group & user.when we click on group then users come under that's tree category will be opened.problem is...
6
by: mcgrew.michael | last post by:
I hope this is the right group. I am very new to ASP so this is probably a stupid question. I have some vbscript that query's AD and populates a recordset. I know the recorset contains the...
7
by: Jo | last post by:
Hi, How can i differentiate between static and dynamic allocated objects? For example: void SomeFunction1() { CObject *objectp = new CObject; CObject object;
9
by: pbd22 | last post by:
Hi. This is just a disaster management question. I am using XMLHTTP for the dynamic loading of content in a very crucial area of my web site. Same as an IFrame, but using XMLHTTP and a DIV. I...
13
by: tommymo | last post by:
Hi everyone I'm new to this site and the world of ASP.Net C# programming. I have been learning controls and integrating them with a SQL database. So far I have been able to move along and understand...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.