ICE Key Generator: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (br removal)
m (categorized (page needs content!))
Line 1: Line 1:
{{TODO|Add description of what this is, what it does, where it can be used, ...}}
==Source code==
==Source code==
<pre><script language="JavaScript" type="text/javascript">
<pre><script language="JavaScript" type="text/javascript">
Line 27: Line 29:
document.write('</span>');
document.write('</span>');
</script></pre>
</script></pre>
[[Category:Programming]]

Revision as of 16:37, 30 January 2008

Todo: Add description of what this is, what it does, where it can be used, ...

Source code

<script language="JavaScript" type="text/javascript">
var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+-=[]{};/., ~`:<>?';
var l = chars.length-1;
document.write('<span style="font-size:5em;">');
for(var x=0;x<=7;x++)
{
	var chr = chars.charAt(Math.round(Math.random(new Date().getSeconds())*l));
	var out;
	switch(chr)
	{
		case '<':
			out = '&lt;';
			break;
		case '>':
			out = '&gt;';
			break;
		case '&':
			out = '&amp;';
			break;
		default:
			out = chr;
			break;
	}
	document.write(out);
}
document.write('</span>');
</script>