Home >Web Front-end >JS Tutorial >js json uses tables to implement simple website left navigation_json

js json uses tables to implement simple website left navigation_json

WBOY
WBOYOriginal
2016-05-16 18:30:251405browse

The call is very simple, just organize the data into json format: The format is as follows:

Copy code The code is as follows:

window.onload = function()
{
var tf="if1";
var data=[{m:"Sports Website",s:[{sn:"Baidu Sports ",st:"http://news.baidu.com/n?cmd=1&class=sportnews"},
{sn:"Sohu Sports",st:"http://sports.sohu.com/" },
{sn:"Sina Sports",st:"http://sports.sina.com.cn/"}]},
{m:"News Website",s:[{sn: "Baidu",st:"http://news.baidu.com/"},
{sn:"Sohu",st:"http://news.sohu.com/"},
{ sn:"Sina",st:"http://news.sina.com.cn/"}]},
{m:"Video website",s:[{sn:"Baidu Video",st: "http://vedio.baidu.com/"},
{sn:"Sohu Video",st:"http://tv.sohu.com/"},
{sn:"Sina Video ",st:"http://vedio.sina.com.cn/"}]}
];
var nav=new tableNav("table1",data,tf);
var bautoClose= false; //Whether other navigation bars are closed when the current navigation bar is opened
nav.generateNav(bautoClose);
}

The entire example code is as follows: for beginners to learn!
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn