pz7gc3 / embeddedjavascript

Automatically exported from code.google.com/p/embeddedjavascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: Cannot read property '0' of undefined

GoogleCodeExporter opened this issue · comments

In the template I use external variables. For this particular error, I use 
"swk_menu":

var swk_menu = [{"section_link":["Support 
Technique","module","function"],"links":[["name","module","function"],["name","m
odule","function"]]},{"logo_url":"img\/error_FileNotFound.png","logo_name":"test
","logo_module":"","links":[["name","module","function"],["name","module","funct
ion"]]}];

template:
<!-- Build menus -->
<% 
for(m in swk_menu) { 
    var menu = swk_menu[m];
    %>
    <div class="swk_menu">
        <div class="swk_menu_logo">
            <span class="swk_menu_link" onclick="swk.openTab();"><%= menu.section_link[0] %></span><br />
        </div>
        <%
        for(sm in menu.links) {
            var submenu = menu.links[sm];
            %>
            <span class="swk_menu_link" onclick="swk.openTab('<%= submenu[1] %>', '<%= submenu[2] %>');"><%= submenu[0] %></span><br />
            <%      
        }
        %>
    </div>
<% } %>

********************
"menu.section_link[0]" trigger the error. but in the same template I can alert 
it just fine. The same kind of code works well in the "submenu" area.

I don't get it...

Original issue reported on code.google.com by s1r...@gmail.com on 24 Sep 2011 at 3:55

damn I suck lol. it was the second menu with bad infos.
please delete this... 

Original comment by s1r...@gmail.com on 24 Sep 2011 at 3:58