Go Back   CodingForums.com > :: Client side development > JavaScript programming > Post a JavaScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-22-2002, 03:49 PM   PM User | #1
beetle
Senior Coder

 
Join Date: Aug 2002
Posts: 3,467
Thanks: 0
Thanked 0 Times in 0 Posts
beetle has a little shameless behaviour in the past
ISO 8859-1 Character set

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 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
Code:
<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>&#'+count+';</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>

Last edited by beetle; 08-23-2002 at 07:29 PM..
beetle is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:53 PM.


Advertisement
Log in to turn off these ads.