Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var post = [
- {
- type: "plain",
- content: {
- title: "Main",
- description: "Maybe this is work?"
- }
- }
- ];
- function newpost(id) {
- var type = post[id].type;
- var content = post[id].content;
- if (type == "plain") {
- var new_post = document.createElement("DIV");
- new_post.setAttribute("class","post type-plain");
- document.getElementsByClassName("workspace")[0].appendChild(new_post);
- var pcontent1 = document.createElement("H3");
- pcontent1.innerHTML = content.title;
- new_post.appendChild(pcontent1);
- var pcontent2 = document.createElement("P");
- pcontent2.innerHTML = content.description;
- new_post.appendChild(pcontent2);
- }
- }
- newpost(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement