...

View Full Version : ISO 8859-1 Character set



beetle
08-22-2002, 04:49 PM
This may be less of a useful script than just a sort of practice thingie of mine It displays all the characters of the ISO 8859-1 character set, and shows off my parseGetVars() function posted earlier :D It's not by any means perfect, but I just added it to my favorites for a quick reference...save it as "iso.htm" or change the action on the form to match the filename you choose
<html>
<head>
<title>ISO 8859-1 character set</title>

<style>
body, td { font: 12px Verdana; }
th {
font: bold 14px Verdana;
background-color: #999;
color: #FFF;
}
.col1 {
background-color:#CCC;
font-weight:bold;
padding: 3px;
}
.col2 {
background-color: #FFF;
padding: 3px 10px;
}
</style>
<script>
function parseGetVars() {
var getVars = new Array();
var qString = unescape(top.location.search.substring(1));
var pairs = qString.split(/\&/);
for (var i in pairs) {
var nameVal = pairs[i].split(/\=/);
getVars[nameVal[0]] = nameVal[1];
}
return getVars;
}
</script>
</head>

<body>
<form action="iso.htm" method="get">
Columns <input type="text" size="4" id="cols" name="cols" />
Lower Bound <input type="text" size="4" id="lb" name="lb" />
Upper Bound <input type="text" size="4" id="ub" name="ub" />
<input type="submit" value="Update" />
</form>

<script>
var g = parseGetVars();
var numCols = 8;
var lb = 33;
var ub = 255;

if (g['cols']) numCols = parseInt(g['cols']);
if (g['lb']) lb = parseInt(g['lb']);
if (g['ub']) ub = parseInt(g['ub']);

document.write('<table border="0" cellspacing="1" style="background-color: #000; width:200px">');
document.write('<tr><th colspan="'+numCols*2+'">ISO 8859-1 character set</th></tr>');
for (var i=0; i<numCols; i++) {
document.write('<col class="col1"/>');
document.write('<col class="col2" />');
}

for (var i=lb; i<=ub; i+=numCols) {
document.write('<tr>');
for (var count=i; count<i+numCols; count++) {
if (count <= ub) {
var isoChar = '&#'+count+';';
document.write('<td>&#38;&#35;'+count+'&#59;</td>');
document.write('<td>'+isoChar+'</td>');
}
else
document.write('<td></td>');
}
document.write('</tr>');
}

document.write('</table>');
var f = document.forms[0];
f.elements['cols'].value = numCols;
f.elements['lb'].value = lb;
f.elements['ub'].value = ub;
</script>
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum