...

View Full Version : plz test this script



fatrat
01-15-2007, 04:09 PM
http://digitalpatriots.org

next to each main header is '+' for collapsing and uncollapsing the div beneath it.
It uses cookies to remember the state.

Some ppl have told me it doesnt work for them. But, I have not had any problems in the latest versions of:

firefox
netscape
opera
ie7
ie6

A friend didnt get it to work in firefox (reformatted pc, fresh install)
Somebody else said they only got it to work in IE, waiting for a response on what browsers they actaully tested it on.

Arty Effem
01-15-2007, 05:49 PM
http://digitalpatriots.org

next to each main header is '+' for collapsing and uncollapsing the div beneath it.
It uses cookies to remember the state.

Some ppl have told me it doesnt work for them. But, I have not had any problems in the latest versions of:

firefox
netscape
opera
ie7
ie6

A friend didnt get it to work in firefox (reformatted pc, fresh install)
Somebody else said they only got it to work in IE, waiting for a response on what browsers they actaully tested it on.

It fails in Opera 8.54 due to failure to test for document.styleSheets (supported in Opera 9)

It fails in Netscape and FireFox as indicated in the console, again failure to test a returned value.

fatrat
01-15-2007, 06:30 PM
i have totally rewrote the code



function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}


function hideme(id, type)
{
var id=id;
/*alert(id);*/
document.getElementById(id).className ='hideme';
/*setStyleById(id, 'display', 'none');*/
code='<span class="showmebutton" title="Show" onClick="showme(\'navigation\')">+</span>';
document.getElementById('cm_'+id).innerHTML= (code);
createCookie(id, 'none', 30);
}
function showme(id, type)
{
var id=id;
var state='block';
if(type=='table'){state='table';}
document.getElementById(id).className ='showme';
/*setStyleById(id, 'display', state);*/
code='<span class="hidemebutton" title="Hide" onClick="hideme(\'navigation\')">-</span>';
document.getElementById('cm_'+id).innerHTML= (code);
createCookie(id, state, 30);
}



html:

<div class="standardheader">
<h1> <span class="standardheader-mid"><span class="standardheader-left"></span> <span class="standardheader-right" id="cm_navigation"><span class="hidemebutton" title="Hide" onClick="hideme('navigation')">-</span></span> &nbsp;Navigation</span></h1>
<div class="showme" id="navigation">
<ul class="row1list">
<li><a href="{U_CREATEACLAN}">Create a Clan</a></li>
<li><a href="{U_ADDSCRIM}">Add a Scrim</a></li>
</ul>
</div>
</div>


this seems to work in all browsers ;)

the problem is the onload, to get them hidden:



<script language="Javascript" type="text/javascript">
<!--
function checkcookies()
{
var cookielist= new Array(16);
cookielist[0]="quickreg";
cookielist[1]="twl4";
cookielist[2]="mostrecent";
cookielist[3]="randompic";
cookielist[4]="clansbygame";
cookielist[5]="navigation";
cookielist[6]="services";
cookielist[7]="newspost63";
cookielist[8]="twlladderinfo0";
cookielist[9]="twlladderinfo1";
cookielist[10]="highrated";
cookielist[11]="mostviewed";
cookielist[12]="newspost20";
cookielist[13]="xfire";
cookielist[14]="scrimlist";
cookielist[15]="aatracker";
var xa=0;
for(xa=0; xa<16; xa++)
{
hideme(cookielist[xa]);
}
}
-->
</script>


in opera it gives this error:


message: Statement on line 16: Could not convert undefined or null to object
Backtrace:
Line 16 of linked script http://digitalpatriots.org/templates/digitalpatriots/digitalpatriots_collapse.js
document.getElementById(id).className = "hideme";
Line 13 of inline#2 script in http://digitalpatriots.org/index.php?sid=9de8ddd68ca32215cae3721a78c3ec55&clan=0
hideme(cookielist[xa]);
Line 1 of script
checkcookies();
At unknown location
[statement source code not available]

fatrat
01-16-2007, 09:57 AM
this is giving me such a headache i might give up



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum