jijopaulose / embeddedjavascript

Automatically exported from code.google.com/p/embeddedjavascript
Other
1 stars 0 forks source link

Uncaught TypeError: Cannot read property '0' of undefined #17

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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