<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[problema scriptaculous con interazione altra funzione]]></title><description><![CDATA[<p dir="auto">salve a tutti,<br />
ho un problema con una funzione javascript e l'interazione con scriptaculous.<br />
questa è la funzione:</p>
<pre><code>function crea(elemento,sito,area,contesto,illlustrazionec,notec,classe,tipo,materiale,dimensioni,numeroscavo,luogo,numeromuseo,illustraazionep,biblio,noteg){
    var nome_elemento ="cat"+elemento;     
       
    var collapse2 = new animatedcollapse(""+nome_elemento+"", 500, true);
    
    if(!$('obj'+elemento)){
        
        newitem=Builder.node( 'li', {className:'item',id:'obj'+elemento}, [Builder.node( 'div', {className:'handle'},'obj'+elemento)] );
        newchiudi=Builder.node( 'div', {className:'chiudi'});
        newlink=Builder.node( 'a', {href:'javascript:rimuovi('+elemento+')', className:'chiudilink'},'x');
        newespandi=Builder.node( 'a', {href:'javascript:collapse2.slideit()', className:'espandi_finestra'},'espandi/ritira');
        
        newitem.appendChild(newchiudi);
        newchiudi.appendChild(newlink);
        $('firstlist').appendChild(newitem);
        newitem.appendChild(newespandi);
        
        $('obj'+elemento).innerHTML=$('obj'+elemento).innerHTML+'sito'+sito+'&amp;nbsp;&amp;nbsp;area&lt;br&gt;'+area+'contesto'+contesto+'&lt;a href="javascript:collapse2.slideit()"&gt;espandi/ritira&lt;/a&gt; ';
        $('obj'+elemento).innerHTML+='&lt;div id=\"'+nome_elemento+'\"&gt;&amp;nbsp;&amp;nbsp;illlustrazionec&lt;br&gt;'+illlustrazionec+'notec&amp;nbsp;&amp;nbsp;'+notec+'classe&lt;br&gt;'+classe+'tipo&amp;nbsp;&amp;nbsp;'+tipo+'materiale&lt;br&gt;'+materiale+'dimensioni&amp;nbsp;&amp;nbsp;'+dimensioni+'numeroscavo&lt;br&gt;'+numeroscavo+'luogo&amp;nbsp;&amp;nbsp;'+luogo+'numeromuseo&lt;br&gt;'+numeromuseo+'illustraazionep&amp;nbsp;&amp;nbsp;'+illustraazionep+'biblio&lt;br&gt;'+biblio+'noteg&lt;br&gt;'+noteg+'&lt;/div&gt;';
        document.getElementById('id_generico').innerHTML+=' &lt;script type="text/javascript"&gt;var collapse2=new animatedcollapse("'+nome_elemento+'", 500, true); &lt;/script&gt;';
        rendisortable();
    }
}
</code></pre>
<p dir="auto">questa mi permette di creare un oggetto con scriptacolous. Il mio problema sta nel fatto che l'oggetto che viene creato, graficamente, è troppo grosso, infatti se mi trovo ad avere più oggetti, finisco di riempire troppo lo schermo.<br />
Così ho pensato di aggiungerci un effetto che mi nascondesse i div e che al click di un link me lo mostrasse.<br />
Ho trovato sulla rete questo effetto:<br />
<a href="http://www.juliuswebdesign.com/div_anime/animated_div.htm" rel="nofollow ugc">http://www.juliuswebdesign.com/div_anime/animated_div.htm</a></p>
<p dir="auto">ed ho detto facile, prendo la classe, la creo</p>
<pre><code>    var collapse2 = new animatedcollapse(""+nome_elemento+"", 500, true);
</code></pre>
<p dir="auto">creo anche il div</p>
<pre><code>$('obj'+elemento).innerHTML+='&lt;div id=\"'+nome_elemento+'\"&gt;&amp;nbsp;&amp;nbsp;illlustrazionec&lt;br&gt;'+illlustrazionec+'notec&amp;nbsp;&amp;nbsp;'+notec+'classe&lt;br&gt;'+classe+'tipo&amp;nbsp;&amp;nbsp;'+tipo+'materiale&lt;br&gt;'+materiale+'dimensioni&amp;nbsp;&amp;nbsp;'+dimensioni+'numeroscavo&lt;br&gt;'+numeroscavo+'luogo&amp;nbsp;&amp;nbsp;'+luogo+'numeromuseo&lt;br&gt;'+numeromuseo+'illustraazionep&amp;nbsp;&amp;nbsp;'+illustraazionep+'biblio&lt;br&gt;'+biblio+'noteg&lt;br&gt;'+noteg+'&lt;/div&gt;';
</code></pre>
<p dir="auto">la classe è questa (ovviamente non sto a postare tutto il codice</p>
<pre><code>var uniquepageid=window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""); //get current page path and name, used to uniquely identify this page for persistence feature

function animatedcollapse(divId, animatetime, persistexpand, initstate){
    this.divId=divId;
    this.divObj=document.getElementById(divId);
    this.divObj.style.overflow="hidden";
    this.timelength=animatetime;
    this.initstate=(typeof initstate!="undefined" &amp;&amp; initstate=="block")? "block" : "contract";
    this.isExpanded=animatedcollapse.getCookie(uniquepageid+"-"+divId); //"yes" or "no", based on cookie value
    this.contentheight=parseInt(this.divObj.style.height);
    var thisobj=this;
    if (isNaN(this.contentheight)){ //if no CSS "height" attribute explicitly defined, get DIV's height on window.load
        animatedcollapse.dotask(window, function(){thisobj._getheight(persistexpand)}, "load");
        if (!persistexpand &amp;&amp; this.initstate=="contract" || persistexpand &amp;&amp; this.isExpanded!="yes"); //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
            this.divObj.style.visibility="hidden"; //hide content (versus collapse) until we can get its height
    }
    else if (!persistexpand &amp;&amp; this.initstate=="contract" || persistexpand &amp;&amp; this.isExpanded!="yes") //Hide DIV (unless div should be expanded by default, OR persistence is enabled and this DIV should be expanded)
        this.divObj.style.height=0; //just collapse content if CSS "height" attribute available
    if (persistexpand)
        animatedcollapse.dotask(window, function(){animatedcollapse.setCookie(uniquepageid+"-"+thisobj.divId, thisobj.isExpanded)}, "unload");
}

animatedcollapse.prototype._getheight=function(persistexpand){
    this.contentheight=this.divObj.offsetHeight
.....
...
..
</code></pre>
<p dir="auto">e il gioco è fatto, ma ovviamente, per la legge di murphy, non ha funzionato.<br />
firebug mi da questo errore:</p>
<p dir="auto">this.divObj has no properties<br />
animatedcollapse("cat22", 500, true, undefined)scriptacolous.js (line 15)<br />
crea("22", "mari", "AREA", "LIVELLO", "CONTESTO", "", "NOTE CONTESTO", "CLASSE", "TIPO", "MATERIALE", "DIMENSIONI", "NUMERO SCAVO", "LUOGO CONSERVAZIONE", "NUMERO MUSEO", "", "BIBLIOGRAFIA")scriptacolous.js (line 128)<br />
onclick(click clientX=0, clientY=0)form (line 1)</p>
<p dir="auto">chrome://firebug/content/blank.gif    this.divObj.style.overflow="hidden";</p>
<p dir="auto">sapreste aiutarmi?<br />
grazie in anticipo!</p>
<p dir="auto">Nep</p>
]]></description><link>https://dev.connect.gt/topic/41679/problema-scriptaculous-con-interazione-altra-funzione</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 00:41:41 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/41679.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 25 Jul 2007 09:59:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to problema scriptaculous con interazione altra funzione on Wed, 25 Jul 2007 14:49:11 GMT]]></title><description><![CDATA[<p dir="auto">nessun aiuto??:bho:</p>
]]></description><link>https://dev.connect.gt/post/572039</link><guid isPermaLink="true">https://dev.connect.gt/post/572039</guid><dc:creator><![CDATA[nephilimdie]]></dc:creator><pubDate>Wed, 25 Jul 2007 14:49:11 GMT</pubDate></item></channel></rss>