这样动态的JS文件怎么生成?
像元贝驾考网上用到的题库js文件怎么生成?
html 页面上的代码:
<script src="/exam/km1_kst_C1.js?r=1460486079&km=km1&cx=C1"></script>
其js内容每次进入页面内容不一样,如下:
var dataSource = "";
var dataSource = "数据库";
var ExamCount = 100;
var Exams = new Array(100);
var ExamID = new Array(ExamCount);
var ExamTm = new Array(ExamCount);
var ExamTp = new Array(ExamCount);
var ExamTx = new Array(ExamCount);
var ExamDa = new Array(ExamCount);
var SortID = new Array(ExamCount);
var ExamDaSel = new Array(ExamCount);
var ExamsCnt = '[["数据库xc2016-04-11 17:12:56",200,"km1_kst_c1.js","","","5956"],["4fac5",1,"在这个路口可以掉头。","images/tp_067.jpg","错","1501"],["17d76",1,"遇到这种情况的路段,可以进入网状线区域内停车等候。","images/tp_059.jpg","错","1501"],["d120a",1,"这个标志的含义是告示前方道路有障碍物,车辆左侧绕行。","images/tp_164.jpg","对","1502"],["0f847",1,"在这种急弯道路上行车应交替使用远近光灯。","images/tp_024.jpg","对","1501"],["4e901",1,"驾驶机动车在这种信号灯亮的路口,可以右转弯。","images/tp_097.jpg","对","1502"],["b9c0f",2,"这个标志是何含义?<br/>A、转弯诱导标志<br/>B、线形诱导标志<br/>C、合流诱导标志<br/>D、分流诱导标志","images/tp_260.jpg","B","1502"],["f2097",2,"这个标志是何含义?<br/>A、禁止小型车行驶<br/>B、机动车行驶<br/>C、只准小型车行驶<br/>D、不准小型车通行","images/tp_229.jpg","B","1502"],["ea07d",2,"这个标志是何含义?<br/>A、施工路段<br/>B、事故易发路段<br/>C、减速慢行路段<br/>D、拥堵路段","images/tp_161.jpg","B","1502"],["f5a1d",2,"这个标志预告什么?<br/>A、高速公路服务区预告<br/>B、高速公路避险处预告<br/>C、高速公路客车站预告<br/>D、高速公路停车场预告","images/tp_284.jpg","D","1502"],["6a1bd",2,"这个仪表是何含义?<br/>A、发动机转速表<br/>B、行驶速度表<br/>C、区间里程表<br/>D、百公里油耗表","images/tp_357.jpg","A","1504"]]';
Exams = eval(ExamsCnt);
for (ExmC in Exams) {
ExamID[ExmC] = Exams[ExmC][0];
ExamTm[ExmC] = Exams[ExmC][2];
ExamTp[ExmC] = Exams[ExmC][3];
ExamTx[ExmC] = Exams[ExmC][1];
ExamDa[ExmC] = Exams[ExmC][4];
SortID[ExmC] = Exams[ExmC][5];
ExamDaSel[ExmC] = "";
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
類似jsonp
後台動態生成js