-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathad.html
More file actions
72 lines (64 loc) · 2.21 KB
/
ad.html
File metadata and controls
72 lines (64 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
var json = {
"material_type": "word", //物料类型为文字
"material_name": "", //物料名称
"content": "我就是个广告", //物料类型为文字的文字描述
"link": "http://www.baidu.com", //点击链接
"hover": "悬停文字" //悬停文字
};
var json2 = {
"material_type": "image", //物料类型为图片
"material_name": "", //物料名称
"height": "200", //图片的高度
"width": "200", //图片的宽度
"url": "img/1.jpg", //图片的地址
"link": "http://baidu.com", //点击图片的连接
"description": "百度百度"
}
var id = "_" + Math.random().toString(36).slice(2);
var c = "<div id=" + id + "></div>";
document.write(c);
var postData = {
"id": 1111,
"width": 300,
"height": 300,
"browser": "",
"domain": ""
}
function getAd(postData) {
$.ajax({
type: "POST",
url: "some.php",
data: postData,
success: function(msg) {
alert("Data Saved: " + msg);
},
error: function(){
}
})
}
function rendHtml(json) {
if (json.material_type == "word") {
var html = "<a href='" + json.link + "' title='" + json.hover + "'>" + json.content + "</a>";
} else if (json.material_type == "image") {
var html = "<a href='" + json.link + "' title='" + json.description + "'>" +
"<img src='" + json.url + "' width='" + json.width + "' height='" + json.height + "'/>" +
"<p>" + json.description + "</p>" +
"</a>";
}
$("#" + id).append(html);
}
rendHtml(json);
</script>
</div>
</body>
</html>