1
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.9.1.js"></script>
<script type="text/javascript">
var ucnet = {
date:"",
data:{
titlesrc:"",
searchhref:"",//此处先不写
gatenet:[],
gatenet2:[],
news:{
n1:[],
n2:[],
},
lifehelp:{
h1:[],
h2:[],
h3:[],
},
go:{//initD
go1:[],
go2:[]
},
movie:{
m1:[],
m2:[],
},
novel:{
n1:[],
n2:[],
},
funny:{
f1:[],
f2:[],
},
broadbanner:[],
},
init:function(){
ucnet.initA();
ucnet.initB();
ucnet.initC();//生活住手
ucnet.initD();
ucnet.initE();//movie
ucnet.initF();//novel
ucnet.initG();//funny
ucnet.submit();
},
initA:function(){
ucnet.data.titlesrc = $(".pageTitle img").attr("src") ;
$(".portal.row li a").each(function(i,n){
var t = {
src:"",//图片src
title:"",//网站名称
href:"",// 跳转链接
};
t.src= $(this).find("img").attr("src");
t.title= $(this).find(".portal-txt").text();
t.href = $(this).attr("href");
ucnet.data.gatenet[i]=t;
});
$(".portalParent .row li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.gatenet2[i]=t;
});
},
initB:function(){//新闻资讯
$(".row.blockList").each(function(i,n){
if(i==0){
$(this).find("li a").each(function(j,m){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.news.n1[j]=t;
});
}
});
$("#tagList li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.news.n2[i]=t;
});
},
initC:function(){
$(".title-life").parent().next("section").each(function(){
$(this).find("li a").each(function(i,n){
var t = {
title:"",
href:"",
src:"",
};
t.title=$(this).attr("title");
t.href = $(this).attr("href");
t.src = $(this).find("img").attr("src");
ucnet.data.lifehelp.h1[i]=t;
});
});
$(".title-life").parent().next("section").next("ul").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.lifehelp.h2[i]=t;
});
$(".title-life").parent().next("section").next("ul").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.lifehelp.h3[i]=t;
});
},
initD:function(){
$("#shopping").next("ul").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.go.go1[i]=t;
});
$("#shopping").next("ul").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.go.go2[i]=t;
});
},
initE:function(){
$("#video").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.movie.m1[i]=t;
});
$("#video").next("section").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.movie.m2[i]=t;
});
},
initF:function(){//novel
$("#novel").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.novel.n1[i]=t;
});
$("#novel").next("section").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.novel.n2[i]=t;
});
},
initG:function(){
$("#funny").next("section").next("ul").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.funny.f1[i]=t;
});
$("#funny").next("section").next("ul").next("section").find("li a").each(function(i,n){
var t = {
title:"",
href:"",
};
t.title=$(this).text();
t.href = $(this).attr("href");
ucnet.data.funny.f2[i]=t;
});
},
submit:function(){
},
};
function test(){
alert("dd");
ucnet.init();
}
</script>
</head>
<body>
<input type="button" οnclick="ucnet.init()" value="提交">
<input type="button" οnclick="test()" value="提交">
</body>
</html>
2 uccode.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/jquery-1.9.1.js"></script>
<style type="text/css">
.head{
background:#0496f2;
height:120px;
}
hr{
height:3px;
}
ul,li{
list-style: none;
}
a{
text-decoration: none;
}
</style>
</head>
<body>
<div>
<div class="head">
</div>
</div>
</body>
</html>
3 java
3.1 pojo
package com.wj.service.news.pojo;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UC {
private int id;
private String titlesrc;
public List<UCM> getUcms() {
return ucms;
}
public List<UCM> getUcms2() {
return ucms2;
}
public Map<String, List<UCM>> getNews() {
return news;
}
public Map<String, List<UCM>> getLifehelper() {
return lifehelper;
}
public Map<String, List<UCM>> getGo() {
return go;
}
public Map<String, List<UCM>> getMovie() {
return movie;
}
public Map<String, List<UCM>> getNovel() {
return novel;
}
public Map<String, List<UCM>> getFunny() {
return funny;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitlesrc() {
return titlesrc;
}
public void setTitlesrc(String titlesrc) {
this.titlesrc = titlesrc;
}
private List<UCM> ucms = new ArrayList<UCM>();
private List<UCM> ucms2 = new ArrayList<UCM>();
private Map<String, List<UCM>> news = new HashMap<String, List<UCM>>();
private Map<String, List<UCM>> lifehelper = new HashMap<String, List<UCM>>();
private Map<String, List<UCM>> go = new HashMap<String, List<UCM>>();
private Map<String, List<UCM>> movie = new HashMap<String, List<UCM>>();
private Map<String, List<UCM>> novel = new HashMap<String, List<UCM>>();
private Map<String, List<UCM>> funny = new HashMap<String, List<UCM>>();
}
class UCM{//uc message
private String title;
private String href;
}
class UCMI extends UCM{//uc message 带图片src的
private String src;
}
4 mysql db