Data w JavaScript
1 2 3 4 5 |
var d = new Date(); var year = d.getFullYear(); var month= d.getMonth()+1; var day = d.getDate(); document.write('dziś jest ' + year + '/' + month + '/' + day); |
1 2 3 4 5 |
var d = new Date(); var year = d.getFullYear(); var month= d.getMonth()+1; var day = d.getDate(); document.write('dziś jest ' + year + '/' + month + '/' + day); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
const songs= [ "1.mp3", "2.mp3", "3.mp3" ] const createSongList = () => { const list = document.createElement('ol') for(let i=0; i<songs.length; i++) { const item = document.createElement('li') item.appendChild(document.createTextNode(songs[i])) list.appendChild(item) } return list; } document.getElementById('songList').appendChild(createSongList()) |
1 2 3 4 |
const item = document.createElement('h1') item.appendChild(document.createTextNode('ok')) document.getElementById('myId').appendChild(item) |