Help ! Javascript is creating unwanted sessions
Help ! Javascript is creating unwanted sessions
- Subject: Help ! Javascript is creating unwanted sessions
- From: Owen McKerrow <email@hidden>
- Date: Thu, 9 Jun 2005 23:15:30 +1000
(Sorry for the double post if this comes through on the Omni list )
Hi All,
I have a page which uses CSS and Javascript to show/hide areas. The
first time the script runs I have it searching the documents
style-sheets for the specific style I need and check its current value.
Once its done it once, Javascript has it it "memory" and so I don't
need to do it again.
However when I clicked the link that called this script I noticed a new
session is created. In fact its being created by
handleSessionRestorationErrorInContext(WOContext aContext ). It only
happens the first time I click the link.
I narrowed it down to the stuff that parses my style sheets. I figured
cause I was using the style sheets as resources in my project it may
have been asking for them again (??). So I removed them from the
project and got it to grab them from localhost instead.
No luck the mysterious session is still being made.
Anyone have any ideas what is going on here ? Why would javascript even
be going back to WO ? And what for ?
The only style sheets I ask for are :
<link rel="stylesheet" href="http://localhost/ccc/cccstyle.css"
type="text/css">
<link rel="stylesheet"
href="http://www.library.uow.edu.au/server/default.css"
type="text/css">
<link rel="stylesheet"
href="http://www.library.uow.edu.au/server/colour.css" type="text/css">
Here is the hyper link :
<A HREF="javascript:showHideChildren(1);">Link</A>
And here is the Javascript :
function showHideChildren(theItem)
{
var obj;
var obj2;
obj=MM_findObj('feedback' + theItem);
obj2=MM_findObj('wrapper' + theItem);
if(obj.style.display != "" ) {
if(obj.style.display == "none" ) {
obj2.style.background='url(openArrow.gif) no-repeat top left
#FFFFFF';
obj.style.display = "block";
} else {
obj2.style.background='url(closedArrow.gif) no-repeat top left
#FFFFFF';
obj.style.display = "none";
}
} else {
changecss(('.' + obj.className),'display','none',obj,obj2);
}
}
/* Return a style sheet object based upon the name passed in
Credit goes to to Shawn Olson & http://www.shawnolson.net for the base
function
(function changecss(theClass,element,value)
//changecss('.exampleA','color','red'))
I hacked this from */
function changecss(theClass,element,value,objTochange,changeImage) {
//documentation for this script at http://www.shawnolson.net/a/503/
var cssRules;
var found = false;
if (document.all) {
cssRules = 'rules';
} else if (document.getElementById) {
cssRules = 'cssRules';
}
for (var S = 0; S < document.styleSheets.length; S++){
for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
//alert(document.styleSheets[S][cssRules][R].selectorText);
if (document.styleSheets[S][cssRules][R].selectorText == theClass) {
//document.styleSheets[S][cssRules][R].style[element] = value;
if (document.styleSheets[S][cssRules][R].style[element] == "block") {
changeImage.style.background='url(closedArrow.gif) no-repeat top
left #FFFFFF';
objTochange.style.display = "none";
} else {
changeImage.style.background='url(openArrow.gif) no-repeat top left
#FFFFFF';
objTochange.style.display = "block";
}
found = true;
break;
}
}
if (found ) {
break;
}
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden