How to call a script to a print format

i have this script bellow i wanted to use it on a print format
so it can convert number to words in Portuguese,

	<form id="form" action="">
		Número <input type="text" name="numero" /><br /><br />
		<input type="submit" value="converter" />
	</form>
	
	<script type="text/javascript">
function converter(){
		alert("2000".extenso());
	}

	String.prototype.extenso = function(){
		var ex = [
					["zero", "um", "dois", "três", "quatro", "cinco", "seis", "sete", "oito", "nove", "dez", "onze", "doze", "treze", "quatorze", "quinze", "dezesseis", "dezessete", "dezoito", "dezenove"],
					["dez", "vinte", "trinta", "quarenta", "cinqüenta", "sessenta", "setenta", "oitenta", "noventa"],
					["cem", "cento", "duzentos", "trezentos", "quatrocentos", "quinhentos", "seiscentos", "setecentos", "oitocentos", "novecentos"],
					["mil", "milhão", "bilhão", "trilhão", "quadrilhão", "quintilhão", "sextilhão", "setilhão", "octilhão", "nonilhão", "decilhão", "undecilhão", "dodecilhão", "tredecilhão", "quatrodecilhão", "quindecilhão", "sedecilhão", "septendecilhão", "octencilhão", "nonencilhão"]
				];
		var a;
		var v;
		var i;
		var valor = this.replace(/[^,\d]/g, "").split(",");
		var	e = " e ";
		var moeda = "MZ";
		var decimal = "centavo"; 
		var sl;
		for(var f = valor.length - 1, l, j = -1, r = [], s = [], t = ""; ++j <= f; s = [])
		{
			j && (valor[j] = (("." + valor[j]) * 1).toFixed(2).slice(2));
			if(!(a = (v = valor[j]).slice((l = v.length) % 3).match(/\d{3}/g), v = l % 3 ? [v.slice(0, l % 3)] : [], v = a ? v.concat(a) : v).length) 
			{
				continue;
			}
			for(a = -1, l = v.length; ++a < l; t = "")
			{
				if(!(i = v[a] * 1))
				{
					continue;
				}
				i % 100 < 20 && (t += ex[0][i % 100]) ||
				i % 100 + 1 && (t += ex[1][(i % 100 / 10 >> 0) - 1] + (i % 10 ? e + ex[0][i % 10] : ""));
				s.push((i < 100 ? t : !(i % 100) ? ex[2][i == 100 ? 0 : i / 100 >> 0] : (ex[2][i / 100 >> 0] + e + t)) +
				((t = l - a - 2) > -1 ? " " + (i > 1 && t > 0 ? ex[3][t].replace("ão", "ões") : ex[3][t]) : ""));
			}
			a = ((sl = s.length) > 1 ? (a = s.pop(), s.join(" ") + e + a) : s.join("") || ((!j && (valor[j + 1] * 1 > 0) || r.length) ? "" : ex[0][0]));
			a && r.push(a + (" " + (v.join("") * 1 > 1 ? j ? decimal + "s" : (/0{6,}	$/.test(valor[0]) ? "de " : "") + moeda.replace("l", "is") : j ? decimal : moeda)));
			}
		return r.join(e);
		}

	</script>
</body>