Skip to content

Instantly share code, notes, and snippets.

@JavaScript-Packer
Created July 31, 2015 06:01
Show Gist options
  • Select an option

  • Save JavaScript-Packer/b4a82a754be113f8e8f5 to your computer and use it in GitHub Desktop.

Select an option

Save JavaScript-Packer/b4a82a754be113f8e8f5 to your computer and use it in GitHub Desktop.
Eval for a JavaScript snippet or source codes in a new window (my way to sandbox away from any page). This is the function used for TEST JS button on http://www.whak.ca/packer/JavaScript.htm
function testJS(n, r) {
r = window.open("about:blank", "", "width=999,height=666");
r.document.write('\
<title>WHAK.com</title>\
<body>\
<i>\
<font size="2" color="blue">\
<u title="Click here to demonstrate the code (blue text) used to change this textarea/text box. Might come in handy for replacing a alert or document.write when you want to see results from your script." onclick="test.value=&quot;Hello World&quot;;">\
test.value="Hello World";\
</u>\
</font>\
</i>\
<br>\
<textarea id="test" rows="10" cols="50" onfocus="this.select();">' + n +
'</textarea>\
<br>\
<input value="Test Again" type="button" onclick="ev' + 'al(test.value);">\
<scr' + "ipt>" + n + "</s" + 'cript>\
<hr>\
<a title="WHAK.com" href="http://www.whak.com">WHAK.com</a>\
</body>\
</html>');
}
testJS('alert("www.WHAK.com");')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment