Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Dominik on Jan 02, 2008 15:42
open dhtmlx forum
Tabbar: javascript content not available outside script section.

I came across the following problem with dhtmlxtabbar (used in ajax-html mode):

When the following example page is loaded into a tab, the say_hello function defined within the <script>...</script> section cannot be referenced outside, i.e. say_hello is not executed when the corresponding link is clicked. This is very strange, because it does work without problems if the page is loaded separately (i.e. not as content of a tab).

Why is this the case? The example page is just to illustrate the problem; I need to solve this problem for a much more complicated application...

Thanks a lot in advance!


<script>
    function say_hello()
    {
        alert("hello world");
    }
</script>

<a onclick="alert('hello world');">inline: no problem</a><br />

<a onclick="say_hello();">outside: why does this not work???</a>
Answer posted by Stanislav on Jan 04, 2008 14:45
Please provide info , which version of dhtmlxtabbar you are using and in which browser problem occurs.
Until dhtmlxtabbar 1.2 such problem may occurs , it caused by the way how code executed in loaded content ( in older version it executed without accessing global context, while it more safe way, in result global objects , such as functions, was not accessible from outside )