<?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[Javascript non funzionante solo con IE e Safari]]></title><description><![CDATA[<p dir="auto">Salve,<br />
utilizzo un javascript che riconosce la risoluzione video dell'utente ed in base a questa carica un foglio di stile differente.</p>
<p dir="auto">Ovviamente questo trick poteva funzionare con IE?</p>
<p dir="auto">Caso strano non funziona nemmeno con Safari.</p>
<p dir="auto">Vi copio il codice nella speranza che mi sapiiate dare una mano.</p>
<pre><code>var s_width =''; 
var s_height =''; 
s_width=screen.width 
s_height=screen.height 




// dynamicLayout by Kevin Hale
function dynamicLayout(){
    var browserWidth = s_width;
    
    //LOAD 1024 THEME
    if ((browserWidth &gt; "960") &amp;&amp; (browserWidth &lt;= "1280")){
        changeLayout("mid");
    }
    
    //Load Wider CSS Rules
    if (browserWidth &gt;= "1280"){
        changeLayout("wide");
    }
    
}

// changeLayout is based on setActiveStyleSheet function by Paul Sowdon 
// http://www.alistapart.com/articles/alternate/
function changeLayout(description){
   var i, a;
   for(i=0; (a = document.getElementsByTagName("link")[i]); i++){
       if(a.getAttribute("title") == description){a.disabled = false;}
       else if(a.getAttribute("title") != "default"){a.disabled = true;}
   }
}

    //addEvent() by John Resig
    function addEvent( obj, type, fn ){ 
       if (obj.addEventListener){ 
          obj.addEventListener( type, fn, false );
       }
       else if (obj.attachEvent){ 
          obj["e"+type+fn] = fn; 
          obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
          obj.attachEvent( "on"+type, obj[type+fn] ); 
       } 
    } 
    
    //Run dynamicLayout function when page loads and when it resizes.
    addEvent(window, 'load', dynamicLayout);
    addEvent(window, 'resize', dynamicLayout);
</code></pre>
<p dir="auto">Ammetto di essere un novellino in materia e di aver preso lo script già fatto, io gli ho solo apportato qualche lieve modifica.</p>
]]></description><link>https://dev.connect.gt/topic/76763/javascript-non-funzionante-solo-con-ie-e-safari</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Dec 2026 13:59:27 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/76763.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 06 Jul 2008 09:03:12 GMT</pubDate><ttl>60</ttl></channel></rss>