-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript-append-post.php
More file actions
84 lines (66 loc) · 2.73 KB
/
javascript-append-post.php
File metadata and controls
84 lines (66 loc) · 2.73 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
73
74
75
76
77
78
79
80
81
82
83
84
<script type="text/javascript">
function appendPost()
{
<?php
$prepostrow = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE id='$uid'"));
$prepostname=htmlentities($prepostrow["fname"]).' '.htmlentities($prepostrow["lname"]);
$prepostppimgurl = $prepostrow["ppimgurl"];
?>
var newCommentHeader=document.createElement("div");
var commenthead=document.createAttribute("class");
commenthead.value="containerhead";
newCommentHeader.setAttributeNode(commenthead);
var pimga=document.createElement("a");
var pimgaatt1=document.createAttribute("href");
pimgaatt1.value="profile.php?id=<?php echo($uid); ?>";
pimga.setAttributeNode(pimgaatt1);
var pimg=document.createElement("img");
var pimgatt1=document.createAttribute("style");
pimgatt1.value="height:40px;float:left;";
pimg.setAttributeNode(pimgatt1);
var pimgatt2=document.createAttribute("src");
pimgatt2.value="images/upload/users/p/<?php echo($ppimgurl); ?>";
pimg.setAttributeNode(pimgatt2);
var hfour=document.createElement("h4");
var hfouratt1=document.createAttribute("class");
hfouratt1.value="ttl";
hfour.setAttributeNode(hfouratt1);
var namea=document.createElement("a");
var nameaatt1=document.createAttribute("href");
nameaatt1.value="profile.php?id=<?php echo($uid); ?>";
namea.setAttributeNode(nameaatt1);
var namediv=document.createElement("div");
var namedivatt1=document.createAttribute("class");
namedivatt1.value="pcheader";
namediv.setAttributeNode(namedivatt1);
var name=document.createTextNode("<?php echo($prepostname); ?>");
pimga.appendChild(pimg);
newCommentHeader.appendChild(pimga);
namediv.appendChild(name);
namea.appendChild(namediv);
hfour.appendChild(namea);
newCommentHeader.appendChild(hfour);
var newContainer=document.createElement("div");
var container=document.createAttribute("class");
container.value="container";
newContainer.setAttributeNode(container);
var cdiv=document.createElement("div");
var cdivatt1=document.createAttribute("class");
cdivatt1.value="ctextcontainer";
cdiv.setAttributeNode(cdivatt1);
var c=document.createTextNode(document.getElementById('posttext').value);
cdiv.appendChild(c);
newContainer.appendChild(newCommentHeader);
newContainer.appendChild(cdiv);
var br=document.createElement("br");
var list=document.getElementById("userposts")
var n = 0;//list.children.length - 2;
list.insertBefore(br,list.childNodes[n]);
var list=document.getElementById("userposts")
var n = 0;//list.children.length - 2;
list.insertBefore(newContainer,list.childNodes[n]);
//var list=document.getElementById("posts")
//var n = list.children.length - 2;
//list.insertBefore(cdiv,list.childNodes[n]);
}
</script>