Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
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
 
Old February 2nd, 2006, 11:46 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default 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>&nbsp;<input type="text" tabindex="3" name="via" size="10"  value="" STYLE="color: black; font: 7pt Verdana, Arial, Helvetica, sans-serif;" />&nbsp;';
        }
        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 = '&nbsp;&nbsp;&nbsp;From&nbsp;';
    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 = '&nbsp;To&nbsp;';
    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
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old February 9th, 2006, 09:51 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

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
 
Old February 9th, 2006, 09:52 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

http://support.microsoft.com/default...b;en-us;319546

www.crmpicco.co.uk
 
Old February 13th, 2006, 07:53 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

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
 
Old February 13th, 2006, 07:55 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

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
 
Old February 13th, 2006, 09:27 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 212
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old February 13th, 2006, 10:02 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

no, this isnt really viable either. is there no way to do it purely with SS-code?

www.crmpicco.co.uk
 
Old February 13th, 2006, 10:03 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

(or CS-code) without writing files to the users PC. It is a intenet site BTW

www.crmpicco.co.uk
 
Old February 14th, 2006, 12:33 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

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
 
Old February 14th, 2006, 12:56 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

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






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying < and > in browser csummers XSLT 1 January 24th, 2008 08:49 PM
Problem with IE's innerHTML and <form> tags??!?! nebulus Javascript 1 February 15th, 2006 05:08 PM
Sort By when table dynamically built using FSO nancy Classic ASP Databases 6 September 11th, 2004 04:17 AM
How to dynamically insert <META> tag in .HTML? Abdul Hameed Javascript 1 August 11th, 2004 10:03 AM
how to dynamically insert <META> tag in .html Abdul Hameed XSLT 1 August 10th, 2004 03:58 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.