Created
April 20, 2014 20:10
-
-
Save xxl007/11123988 to your computer and use it in GitHub Desktop.
Breaking a Keyword String into Separate Keywords
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// embedded into html tags <script type="text/javascript"></script> | |
window.onload = function() { | |
// get keyword list | |
var keywordList = prompt("Enter keywords, separated by commas",""); | |
// use split to create array of keywords | |
var arrayList = keywordList.split(","); | |
// build result HTML | |
var resultString = ""; | |
for (var i = 0; i< arrayList.length ; i++) { | |
resultString+= "keyword: " + arrayList[i] + "<br />"; | |
} | |
// print out to page <div id="result"></div> | |
var blk = document.getElementById("result"); | |
blk.innerHTML = resultString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment