The following small series will bring you a js definition object array (combined with) multi-dimensional array method. I think this is quite good. Now I will share it with you and give you a reference. Let's take a look at the small Editor. It's very easy to define arrays in php. However, if the character is written as a subscript in js, an error will occur, so we can combine it with the object.
Var top _ = {'index': 'homepage', 'user': 'user', 'tree': 'module tree'}; var all_list = [{"index ": [{'name': 'website topic management', 'url': '1.html '}, {'name': 'website topic management2', 'url ': '2.html '}]}, {"user": [{'name': 'user management', 'url': 'user.html'}, {'name': 'user add ', 'url': 'add.html '}]}, {"tree": [{'name': 'module tree management', 'url': 'manager.html'}, {'name ': 'module tree add', 'url': 'add_new.html '}, {'name': 'module tree add 333 add', 'url': 'add_ne3320.html'}];
A module tree array is defined above ....
In addition, it is good to retrieve data.
// Obtain the function return_left_menu_by_index (index) {var left _ = ''; for (var I in all_list) {for (var j in all_list [I]) of the left menu based on the subscript at the top. {if (j = index) {// default menu displayed // console. dir (all_list [I] [j]); for (var k in all_list [I] [index]) {// console. dir (k); var new_onclick = 'onclick = change_right_url ("'+ all_list [I] [index] [k]. url + '")'; left _ + =''+ All_list [I] [index] [k]. name +'
';}}} Return left _;}
The above js definition object array (combined) multi-dimensional array method is all the content shared by xiaobian. I hope to give you a reference and support for PHP.
For more articles on js definition object array (combined) multi-dimensional array method, refer to PHP!