mherger wrote: 
> 
> 
> I _think_ there's a limitation in loading JavaScript in partial updates.
> 
> Eg. the Settings pages wouldn't do full reloads, but only load the 
> content. And in this case loaded JS might not be initialized for 
> security reasons. I must admit I didn't find any source proving my 
> claim, so I might be wrong. What if you added a simple "alert('hello 
> world');" line to the JS section in your template? Would you get a
> popup?

I added the alert to the JS section and, surprisingly (to me), it
displayed on the initial page load with the Classic skin even though the
JS functions before it were apparently not initialized and the
"window.onload" function was not performed. After the page is saved and
reloaded, the alert is again displayed and the JS functions are now
initialized and executed as expected, including the "onload". Using the
Default skin, the alert message is also displayed on the initial and
subsequent page loads but, unlike with the Classic (and Light) skins,
the JS functions are also initialized and available on the initial page
load, including the "window.onload" function being executed. I don't
know what to make of this behavior. Does it make sense to you? Here is
the JS section I am testing with. The only change is the addition of the
alert() call at the end:

                                
Code:
--------------------
    
  <script type="text/javascript">
                                        function checkSelect(val) {
                                                var 
element=document.getElementById('inputSource');
                                                if(val=='0')
                                                        
element.style.display='inline';
                                                else  
                                                        
element.style.display='none';
                                        }
                                        window.onload = function () {
                                                var 
val=document.getElementsByName("quickSelect")[0].value;
                                                checkSelect(val);
                                        }       
                                        alert('hello world');
                                </script>       
  
--------------------



Sam
------------------------------------------------------------------------
SamY's Profile: http://forums.slimdevices.com/member.php?userid=63495
View this thread: http://forums.slimdevices.com/showthread.php?t=109624

_______________________________________________
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to