Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Netscape works! Explorer Doesn't!

Status
Not open for further replies.

chassid

MIS
Aug 27, 2000
58
US
To all,

I have a page written on JavaScript that populates values into two listboxes. After you choose a value and click on it you go to a certain page. Now, if you want to search a different value and hit back the values in the second listbox are not displayed correctly when Explorer is used. What happens is that there is a number of default values that will be populated when the page gets loaded. Explorer always displays the default values while netscape acutally remembers what were the values you chose last and displays those. I would like to know if anyone could help me in fixing this problem when a user uses explorer. I know this is hard to explain so please visit the website below and see what I am talking about and take a look at the code.

I would greatly appreciate any help given!
Daniel

Here is the code:<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--
v=false;
//-->
</SCRIPT>

<SCRIPT LANGUAGE=&quot;JavaScript1.1&quot;>
<!--
if (typeof(Option)+&quot;&quot; != &quot;undefined&quot;) v=true;
//-->
</SCRIPT>
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!--


if(v){a=new Array(22);}

function getFormNum (formName) {
var formNum =-1;
for (i=0;i<document.forms.length;i++){
tempForm = document.forms;
if (formName == tempForm) {
formNum = i;
break;
}
}
return formNum;
}

function jmp(form, elt)
// The first parameter is a reference to the form.
{
if (form != null) {
with (form.elements[elt]) {
if (0 <= selectedIndex)
location = options[selectedIndex].value;
}
}
}

var catsIndex = -1;
var itemsIndex;

if (v) { // ns 2 fix
function newCat(){
catsIndex++;
a[catsIndex] = new Array();
itemsIndex = 0;
}

function O(txt,url) {
a[catsIndex][itemsIndex]=new myOptions(txt,url);
itemsIndex++;
}

function myOptions(text,value){
this.text = text;
this.value = value;
}

// fill array

newCat();
O(&quot;South East&quot;,&quot;O(&quot;Mid-Atlantic&quot;,&quot;O(&quot;NC Inland&quot;,&quot;O(&quot;Chesapeake&quot;,&quot;O(&quot;New Jersey&quot;,&quot;O(&quot;New York&quot;,&quot;O(&quot;Michigan&quot;,&quot;O(&quot;Lake Michigan&quot;,&quot;O(&quot;Connecticut&quot;,&quot;O(&quot;Patriot&quot;,&quot;O(&quot;Lone Star&quot;,&quot;O(&quot;Rocky Mountain&quot;,&quot;O(&quot;Valley of the Sun&quot;,&quot;O(&quot;Cascades&quot;,&quot;O(&quot;So. California&quot;,&quot;O(&quot;No. California&quot;,&quot;O(&quot;International&quot;,&quot;O(&quot;None&quot;,&quot;

newCat();
O(&quot;Membership&quot;,&quot;O(&quot;Awards&quot;,&quot;O(&quot;Marketing&quot;,&quot;O(&quot;Program&quot;,&quot;O(&quot;Professional Development&quot;,&quot;O(&quot;Telecommuting&quot;,&quot;O(&quot;Inernational&quot;,&quot;O(&quot;Elections&quot;,&quot;
newCat();
O(&quot;Public Policy&quot;,&quot;O(&quot;TMA&quot;,&quot;O(&quot;Consultants&quot;,&quot;O(&quot;Non-Urban&quot;,&quot;O(&quot;Welfare to Work&quot;,&quot;O(&quot;Employer&quot;,&quot;O(&quot;Vanpool&quot;,&quot;O(&quot;Access to Jobs&quot;,&quot;
newCat();
O(&quot;Clean Air Chair&quot;,&quot;O(&quot;Director&quot;,&quot;O(&quot;Membership&quot;,&quot;O(&quot;Treasurer&quot;,&quot;O(&quot;Vice President&quot;,&quot;O(&quot;Secretary&quot;,&quot;O(&quot;Public Policy&quot;,&quot;O(&quot;Programs&quot;,&quot;O(&quot;Newsletter&quot;,&quot;O(&quot;Past President&quot;,&quot;
newCat();
O(&quot;Board Members&quot;,&quot;} // if (v)

function relate(formName,elementNum,j) {
if(v){
var formNum = getFormNum(formName);
if (formNum>=0) {
formNum++; // reference next form, assume it follows in HTML
with (document.forms[formNum].elements[elementNum]) {
for(i=options.length-1;i>0;i--) options = null; // null out in reverse order (bug workarnd)
for(i=0;i<a[j].length;i++){
options = new Option(a[j].text,a[j].value);
}
options[0].selected = true;
}
}
} else {
jmp(formName,elementNum);
}
}


function IEsetup(){
if(!document.all) return;
IE5 = navigator.appVersion.indexOf(&quot;5.&quot;)!=-1;
if(!IE5) {
for (i=0;i<document.forms.length;i++) {
document.forms.reset();
}
}
}

window.onload = IEsetup;

//-->
</SCRIPT>


<CENTER>
<TABLE BGCOLOR=&quot;#99FFFF&quot; BORDER=&quot;0&quot; CELLPADDING=&quot;8&quot; CELLSPACING=&quot;0&quot;>
<TR VALIGN=&quot;TOP&quot;><TD>Choose a Category:<BR><FORM NAME=&quot;f1&quot; METHOD=&quot;POST&quot; ACTION=&quot;/cgi-bin/redirect.cgi&quot; onSubmit=&quot;return false;&quot;>
<SELECT NAME=&quot;m1&quot; ID=&quot;m1&quot; CLASS=saveHistory onChange=&quot;relate(this.form,0,this.selectedIndex)&quot;><OPTION VALUE=&quot;/Chapter/&quot;>Chapter<OPTION VALUE=&quot;/Committee/&quot;>Committee<OPTION VALUE=&quot;/Council/&quot;>Council<OPTION VALUE=&quot;/Directors&quot;>Directors<OPTION VALUE=&quot;/Board/&quot;>Board</SELECT><INPUT TYPE=SUBMIT VALUE=&quot;Go&quot; onClick=&quot;jmp(this.form,0);&quot;>
</FORM></TD>
<TD BGCOLOR=&quot;#FFFFFF&quot; VALIGN=MIDDLE><B>---></B></TD>

<TD>Choose a Criteria:<BR><FORM NAME=&quot;f2&quot; METHOD=&quot;POST&quot; ACTION=&quot;/cgi-bin/redirect.cgi&quot; onSubmit=&quot;return false;&quot;>
<SELECT NAME=&quot;m2&quot; ID=&quot;m2&quot; CLASS=saveHistory onChange=&quot;jmp(this.form,0)&quot;>
<OPTION VALUE=&quot; East
<OPTION VALUE=&quot;<OPTION VALUE=&quot; Inland
<OPTION VALUE=&quot;<OPTION VALUE=&quot; Jersey
<OPTION VALUE=&quot; York
<OPTION VALUE=&quot;<OPTION VALUE=&quot; Michigan
<OPTION VALUE=&quot;<OPTION VALUE=&quot;<OPTION VALUE=&quot; Star
<OPTION VALUE=&quot; Mountain
<OPTION VALUE=&quot; of the Sun
<OPTION VALUE=&quot;<OPTION VALUE=&quot; California
<OPTION VALUE=&quot; California
<OPTION VALUE=&quot;<OPTION VALUE=&quot;<INPUT TYPE=SUBMIT VALUE=&quot;Go&quot; onClick=&quot;jmp(this.form,0);&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;baseurl&quot; VALUE=&quot;</FORM></TD>
</TR>
</TABLE></CENTER>
[sig][/sig]
 
I don't know that much except what the other fine people here have written in their posts, but I think there is a difference in the way the two browsers cache pages. Someone told me that Netscape will always cache pages no matter what but that you can set things up so that Explorer will not cache pages (although I have had limited sucess with consistant page expiry).

I don't know if this is any help, maybe it will give you a starting point. [sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]
 
Crystal,

What you are talking about is really interesting. I didn't know Netscape and Explorer would cache that pages differently. The one thing I have to fiqure out is what is Netscape doing that Explorer isn't. An easier way to solve this problem is whenever someone would hit the back button the page would automatically load again from its source. If I could add this to the code, then the problem would be solved. Do you or anyone have an idea on how to have a page automatically refresh, (re-load from its source) whenever a person would hit the back button?

Thank you for your help,
Daniel [sig][/sig]
 
Again I am not certain of this but my understanding is that you can force Explorer to not cache the pages but you can't with Netscape. Your other post has a link in response to an article called cachenomore and that is where I picked up most of what I know on the topic. So take a look at that and hopefully it will help you out. [sig]<p>Crystal<br><a href=mailto:crystals@genesis.sk.ca>crystals@genesis.sk.ca</a><br><a href= > </a><br>--------------------------------------------------<br>
Experience is one thing you can't get for nothing.<br>
-Oscar Wilde<br>
[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top