js解析json的html页面 实现简单js特效
2013-06-25 17:57
1026 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var tide_photos ={"items":['2.jpg','3.jpg','4.jpg','5.jpg']};
</script>
</head>
<body>
<div class="tide_photo"><img id="tide_photo_img" src=""></div>
<ul id="tide_photo_page"></ul>
</body>
<script>
if(tide_photos.items.length>1)
{
$("#tide_photo_img").attr("src",tide_photos.items[0]);
var page = "";
for(var i=0; i<tide_photos.items.length; i++){
page+='<li> '+(i+1)+'</li>';
}
$("#tide_photo_page").html(page);
$("#tide_photo_page li").click( function () {
var num = $(this).html()-1;
$("#tide_photo_img").attr("src",tide_photos.items[num]);
});
}
</script>
</html>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
var tide_photos ={"items":['2.jpg','3.jpg','4.jpg','5.jpg']};
</script>
</head>
<body>
<div class="tide_photo"><img id="tide_photo_img" src=""></div>
<ul id="tide_photo_page"></ul>
</body>
<script>
if(tide_photos.items.length>1)
{
$("#tide_photo_img").attr("src",tide_photos.items[0]);
var page = "";
for(var i=0; i<tide_photos.items.length; i++){
page+='<li> '+(i+1)+'</li>';
}
$("#tide_photo_page").html(page);
$("#tide_photo_page li").click( function () {
var num = $(this).html()-1;
$("#tide_photo_img").attr("src",tide_photos.items[num]);
});
}
</script>
</html>
相关文章推荐
- window.location.href妙用 标签里用js 利用这个简单的转换思路 实现 一直也无法实现的在 页面的html标签使
- 使用js实现读取csv文件内容解析到html页面中
- 纯HTML和js:简单实现页面单个输入框自动切为双输入框
- 简单的HTML中TAB分页实现,js控制页面tr行新增、删除、修改
- js技术实现html页面解析xml文档的级联下拉列表操作
- js解析json并生成html页面
- js+html+css实现简单页面交互功能(2015知乎前端笔试题)http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html?from=y1.7-1.2
- Html+css+js+jquery实现简单页面登录
- 用HTML/JS/PHP方式实现页面延时跳转的简单实例
- 用js实现终止浏览器对页面HTML的继续解析即停止解析 兼容firefox
- 用js实现终止浏览器对页面HTML的继续解析即停止解析 兼容firefox
- 用HTML/JS/PHP方式实现页面延时跳转的简单实例
- 用html+css+js实现的一个简单的图片切换特效
- JS 实现创建HTML标签及解析Json
- 用js实现终止浏览器对页面HTML的继续解析即停止解析 兼容firefox
- C# 对JS解析AJX请求JSON并绑定到html页面的一些心得
- 用html+css+js实现的一个简单的图片切换特效
- 用HTML/JS/PHP方式实现页面延时跳转
- js+json用表格实现简单网站左侧导航
- js+html+css简单的互动功能页面(2015知道几乎尖笔试题)http://v.youku.com/v_show/id_XMTI0ODQ5NTAyOA==.html?from=y1.7-1.2