J'aurais voulu savoir s'il était possible de faire ceci :
Code : Tout sélectionner
<div id="test1-header" class="accordion_headings" onClick="window.location.href='#top';">Code : Tout sélectionner
<div id="test1-header" class="accordion_headings" onClick="window.location.href='#top';">
<div onClick="window.location.href='#top';">xxx</div>
Maintenant, si cela ne fonctionne pas chez toi, il y a manifestement un soucis. Celui-ci est peut être du à ton script d'accordéon qui doit déjà capturer l'événement du click pour (dé)plier le div. C'est donc peut être au niveau de ses fonctions qu'il te faut regarder et peut être ajouter ton #top
<div onClick="window.location.href='#;">xxx</div>
Si aucune ancre n'est spécifiée, on retourne en haut de page.Code : Tout sélectionner
//Accordian Initializer
function Accordian(d,s,tc){
// get all the elements that have id as content
l=$(d).getElementsByTagName('div');
c=[];
for(i=0;i<l.length;i++){
h=l[i].id;
if(h.substr(h.indexOf('-')+1,h.length)=='content'){c.push(h);}
}
sel=null;
//then search through headers
for(i=0;i<l.length;i++){
h=l[i].id;
if(h.substr(h.indexOf('-')+1,h.length)=='header'){
d=$(h.substr(0,h.indexOf('-'))+'-content');
d.style.display='none';
d.style.overflow='hidden';
d.maxh =sh(d);
d.s=(s==undefined)? 7 : s;
h=$(h);
h.tc=tc;
h.c=c;
// set the onclick function for each header.
h.onclick = function(){
for(i=0;i<this.c.length;i++){
window.location.href='#top'; <-<-<-<-<-<-
cn=this.c[i];
n=cn.substr(0,cn.indexOf('-'));
if((n+'-header')==this.id){
ex($(n+'-content'));
n=$(n+'-header');
cc(n,'__');
n.className=n.className+' '+n.tc;
}else{
cl($(n+'-content'));
cc($(n+'-header'),'');
}
}
}
if(h.className.match(/selected+/)!=undefined){ sel=h;}
}
}
if(sel!=undefined){sel.onclick();}
}Code : Tout sélectionner
document.location.href='#top'
qui s'affiche en haut à gauche de ce sujet