alctel alctel
关注数: 118 粉丝数: 107 发帖数: 280 关注贴吧数: 44
请教JS 循环显示数据库 示例,我想循环显示数据库中的每个字段 请教JS 循环显示数据库 示例,我想循环显示数据库中的每个字段如何修改? <%@ Language=VBScript codepage=936 %> <% Option Explicit %> <% Dim Conn, rs Set Conn = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source="& Server.MapPath("./") &"\tree.mdb;" rs.open "Select ID, parentId, name, formatte, symbolSize, x, y, category, color, fontSize, method1, ID3, parentId3, source3, target3, name3, des3 From treeview, treeview2 order by ID,ID3", Conn %> <!DOCTYPE html> <html> <head> <title>ECharts 关系图</title> <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0"/> <script src="./echarts.min.js"></script> <script src="./dist/echarts.min.js"></script> <script type="text/javascript" src="dist/echarts.js"></script> </head> <body> <div id="main" style="width: 1000px; height: 800px"></div> <script type="text/javascript"> var myChart = echarts.init(document.getElementById('main')) var categories = [] for (var i = 0; i < 9; i++) { categories[i] = { name: '类目' + i } } option = { // 图的标题 title: { text: '杨氏祖谱 关系图' }, // 提示框的配置 tooltip: { formatter: function (x) { return x.data.des } }, // 工具箱 toolbox: { // 显示工具箱 show: true, feature: { mark: { show: true }, // 还原 restore: { show: true }, // 保存为图片 saveAsImage: { show: true } } }, legend: [ { // selectedMode: 'single', data: categories.map(function (a) { return a.name }) } ], series: [ { type: 'graph', // 类型:关系图 layout: 'force', //图的布局,类型为力导图 symbolSize: 40, // 调整节点的大小 roam: true, // 是否开启鼠标缩放和平移漫游。默认不开启。如果只想要开启缩放或者平移,可以设置成 'scale' 或者 'move'。设置成 true 为都开启 edgeSymbol: ['circle', 'arrow'], edgeSymbolSize: [2, 10], edgeLabel: { normal: { textStyle: { fontSize: 20 } } }, force: { repulsion: 2500, edgeLength: [10, 50] }, draggable: true, lineStyle: { normal: { width: 2, color: '#4b565b' } }, edgeLabel: { normal: { show: true, formatter: function (x) { return x.data.name } } }, label: { normal: { show: true, textStyle: {} } }, <% Do While Not RS.EOF %> // 数据 data: [ { name: "<%=rs("name")%>", tooltip: { formatter: "{b}: <%=rs("formatte")%><br />" }, symbolSize: <%=rs("symbolSize")%>, value: [5, 750], x: <%=rs("x")%>, y: <%=rs("y")%>, fixed: true, // draggable: false, category: <%=rs("category")%>, label: { color: "<%=rs("color")%>", position: 'bottom', fontSize: <%=rs("fontSize")%>, fontWeight: 1000 }, itemStyle: { normal: { color: new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ offset: 0, color: "#157eff" }, { offset: 1, color: "#35c2ff" } ]) } } }, ] , links: [ { source3: '<%=rs("source3")%>', target3: '<%=rs("target3")%>', name3: '<%=rs("name3")%>', des3: '<%=rs("des3")%>' }, ], <% rs.movenext loop rs.close set rs=nothing %> categories: categories } ] } myChart.setOption(option) </script> </body> </html>
1 下一页