<!Doctype> <html> <head> <metacharset="utf-8"></meta> <title>js test</title> <script> functionchange(id,is){ var js=document.getElementById(id); var ls=document.getElementById(is); ls.appendChild(js) } functionappend(){ var list=document.getElementById("list"); var haskell=document.createElement('p'); haskell.id='haskell'; haskell.innerText='Haskell'; list.appendChild(haskell) } functioninsert(){ var list=document.getElementById("list"); var py=document.getElementById("python"); var haskell=document.createElement('p'); haskell.id='haskell'; haskell.innerText='Haskell'; list.insertBefore(haskell,py) } functionstylle(){ var d = document.createElement('style'); d.setAttribute('type', 'text/css'); d.innerHTML = 'p { color: red }'; document.getElementsByTagName('head')[0].appendChild(d); } functionsortt(){ var i, c, j, z list = document.getElementById('list') for (i = 0; i < list.children.length-1; i++) { c=list.children[i]; for (j = i+1; j <list.children.length; j++) { z=list.children[j]; if(c.innerHTML > z.innerHTML){ [c.innerHTML,z.innerHTML]=[z.innerHTML,c.innerHTML]; } } } } </script>