Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save xxl007/11123988 to your computer and use it in GitHub Desktop.
Save xxl007/11123988 to your computer and use it in GitHub Desktop.
Breaking a Keyword String into Separate Keywords
// 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