Here is a nice tool for encoding JavaScript into eval(String.fromCharCode(x,x,x)) format. A full HTML page is listed here, or you can try it out live at the bottom of this post.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Javascript Eval Encoder</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
	<script type="text/javascript">
		function encode_to_javascript() {
			var input = document.getElementById('inputtext').value;

			var output = 'eval(String.fromCharCode(';

			for(pos = 0; pos < input.length; pos++) {
				output += input.charCodeAt(pos);
	
				if(pos != (input.length - 1)) {
					output += ",";
				}
			}

			output += '))';

			document.getElementById('result').innerHTML = output;
			return 0;
		}
	</script>
	</head>
	<body>
		<textarea id="inputtext" rows="10" cols="50"></textarea><br/>
		<input type="submit" value="Encode" onclick="javascript:encode_to_javascript()"/>
		<br/><span id="result"></span>
	</body>
</html>

Encode


References

This reference list has been generated, in many cases, through an automated process and may therefore contain errors or incomplete metadata. It is provided purely as assistance for finding the items mentioned within this post.

  1. W3C XHTML 1.0 Transitional DTD <http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>