1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| function textToTweets(txt) { var num = Math.ceil(txt.length/140); var tweets = []; for (i=0; i<num; i++) { var tweet = txt.substr(i*140, 140); tweets.push(tweet); } return tweets; }
function bulletPoint(array) { var result = document.getElementById('result'); for (i = 0; i < array.length; i++) { var ul = document.createElement('ul'); ul.textContent = array[i]; result.appendChild(ul); } }
function submit() { var txt = document.getElementById('txt').value; var tweets = textToTweets(txt); bulletPoint(tweets); }
|