 |
| Javascript How-To Ask your "How do I do this with Javascript?" questions here. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 2nd, 2006, 11:46 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
remember dynamically built innerHTML on browser <-
When i click on a radio button on picco1.asp i call this JavaScript function (fillTxt) to dynamically build two text boxes.
Then when i click 'Submit' on the page it takes me to picco2.asp.
My problem is when i click BACK <- on the browser it clears the two new textboxes - they are not shown. Is there a way to make them more permanent?
One note is that i have three radio buttons, onclick of two of the button will hide the textboxes, but on click of the third one builds them....
Code:
function fillTxt(desc, state, oneWay)
{
switch (desc)
{
case "via" :
if (state == "on")
{
via.innerHTML = '<b>Via</b> <input type="text" tabindex="3" name="via" size="10" value="" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" /> ';
}
else if (state == "off")
{
via.innerHTML = '';
}
break;
case "OJ" :
if (state == "on")
{
ojHlpDep = "Type country or city to obtain stadium city code."
ojHlpArr = "Type country or city to obtain stadium city code."
ojHlpClr = ""
oJ1.innerHTML = ' From ';
oJ2.innerHTML = '<input type="text" tabindex="4" name="dep2" size="10" value="" onChange="javascript:this.value=this.value.toUpperCase();departure_name();" onmouseover="javascript: message_help(ojHlpDep);" onmouseout="javascript: message_help(ojHlpClr);" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" onDblClick="javascript:destination();">'
openJaw3.innerHTML = ' To ';
openJaw4.innerHTML = '<input type="text" tabindex="5" name="ariapt2" size="10" value="" onChange="javascript:this.value=this.value.toUpperCase();destination_name();" onmouseover="javascript: message_help(ojHlpArr);" onmouseout="javascript: message_help(ojHlpClr);" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" onDblClick="javascript:destination();" />'
}
else if (state == "off")
{
oJ1.innerHTML = '';
oJ2.innerHTML = '';
oJ3.innerHTML = '';
oJ4.innerHTML = '';
oJ5.innerHTML = '';
oJ6.innerHTML = '';
via.innerHTML = '';
}
break;
}
}
Help appreciated.

Picco
www.crmpicco.co.uk
|
|

February 9th, 2006, 09:51 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have been advised that using a cookie would solve this problem, but is there any way of solving this without the use of setting, detecting and deleting a cookie?
are there any parameters that i could be setting/using when building the innerHTML above.
thanks.
(this looks like one for you vinod!)
picco
www.crmpicco.co.uk
|
|

February 9th, 2006, 09:52 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

February 13th, 2006, 07:53 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
i have also been advised elsewhere that using window.name would be a good help, but with no explanation??? any ideas? input???
www.crmpicco.co.uk
|
|

February 13th, 2006, 07:55 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
my problem with cookies is that the user could turn them off, which (i think) would mean either an error would occur or the page would not cache my innerHTML. either way not ideal.....
www.crmpicco.co.uk
|
|

February 13th, 2006, 09:27 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Can't you write a textfile to store the data you want to store clientside like on their root C? (Not sure what you're writing for, commercial Internet, or network?) Obviously requires ActiveX use, which isn't really applicable if we're talking about an internet site.
Joe
|
|

February 13th, 2006, 10:02 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
no, this isnt really viable either. is there no way to do it purely with SS-code?
www.crmpicco.co.uk
|
|

February 13th, 2006, 10:03 AM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
(or CS-code) without writing files to the users PC. It is a intenet site BTW
www.crmpicco.co.uk
|
|

February 14th, 2006, 12:33 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
with regard to the Cookie solution, if the user had cookies disabled within their browser settings....would my code not work? i.e. would it not remember the innerHTML?
www.crmpicco.co.uk
|
|

February 14th, 2006, 12:56 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Quite correct Picco.
If this is not an option, one possible solution might be to use a frameset with one frame zero height, another containing your page.
You could store your changes using scripts in the hidden frame and check that frame on page load for any updates.
HTH,
Chris
|
|
 |