|
-
Mar 9th, 2005, 01:35 AM
#1
Thread Starter
Hyperactive Member
JavaScript: what is the function of "length" in this case?
Because the error says "null or not an object".
Code:
<!-- //
conv_tbl = [
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
32, 33,8704, 1513,1505, 37, 83,8717, 65, 79, 8727, 1496, 44,8722, 58, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 46, 59, 60, 61, 62, 63,
64, 1488, 1489, 1510, 1491, 69, 70, 1490, 1492, 73, 74, 1499, 1500, 1502, 1504, 1506,
1508, 81, 1512, 1513, 1514, 85, 1493, 87, 1495, 1497, 90, 91, 92, 93, 94, 95,
63, 97, 66, 1509, 68, 101, 102, 71, 72, 105, 106, 1498, 1500, 1501, 1503, 111,
1507, 1511, 82, 8707, 84, 117, 118, 86, 88, 89, 1494, 123, 124, 125, 126, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 978,8242,8804,8260,8734, 402,9827,9830,9829,9824,8596,8592,8593,8594,8595,
63, 177,8243,8805, 215,8733,8706,8729, 247,8800,8801,8776,8230, 63, 63,8629,
8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,
8736,8711, 174, 169,8482,8719,8730,8901, 172,8743,8744,8660,8656,8657,8658,8659,
9674,9001, 174, 169,8482,8721, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63,9002,8747,8992, 63,8993, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63
];
function convert(mc, unic_textarea)
{
unic = '';
for (i = 0; i < mc.length; i++)
{
tbl_idx = mc.charCodeAt(i);
code = tbl_idx < conv_tbl.length ? conv_tbl[tbl_idx] : 63;
unic = unic + String.fromCharCode(code)
}
unic_textarea.value = unic;
}
function mc2unic()
{
mc = document.conv_form.mc_code.value;
convert(mc, document.conv_form.unic_area);
}
// -->
-
Mar 9th, 2005, 04:06 AM
#2
Re: JavaScript: what is the function of "length" in this case?
Is that the correct way to declare an array?
try
conv_tbl = new Array(63,63,63...);
-
Mar 9th, 2005, 04:32 AM
#3
Thread Starter
Hyperactive Member
Re: JavaScript: what is the function of "length" in this case?
This was the original coding:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Michigan-Claremont Hebrew Encoding to Unicode Converter</title>
<script type="text/javascript" language="JavaScript1.3">
<!-- //
conv_tbl = [
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
32, 33,8704, 1513,1505, 37, 83,8717, 65, 79, 8727, 1496, 44,8722, 58, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 46, 59, 60, 61, 62, 63,
64, 1488, 1489, 1510, 1491, 69, 70, 1490, 1492, 73, 74, 1499, 1500, 1502, 1504, 1506,
1508, 81, 1512, 1513, 1514, 85, 1493, 87, 1495, 1497, 90, 91, 92, 93, 94, 95,
63, 97, 66, 1509, 68, 101, 102, 71, 72, 105, 106, 1498, 1500, 1501, 1503, 111,
1507, 1511, 82, 8707, 84, 117, 118, 86, 88, 89, 1494, 123, 124, 125, 126, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 978,8242,8804,8260,8734, 402,9827,9830,9829,9824,8596,8592,8593,8594,8595,
63, 177,8243,8805, 215,8733,8706,8729, 247,8800,8801,8776,8230, 63, 63,8629,
8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,
8736,8711, 174, 169,8482,8719,8730,8901, 172,8743,8744,8660,8656,8657,8658,8659,
9674,9001, 174, 169,8482,8721, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63,9002,8747,8992, 63,8993, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63
];
function convert(mc, unic_textarea, html_textarea)
{
unic = '';
html = '';
for (i = 0; i < mc.length; i++)
{
tbl_idx = mc.charCodeAt(i);
code = tbl_idx < conv_tbl.length ? conv_tbl[tbl_idx] : 63;
unic = unic + String.fromCharCode(code);
html = html + '&#' + code + ';'
}
unic_textarea.value = unic;
html_textarea.value = html;
}
function mc2unic()
{
mc = document.conv_form.mc_code.value;
convert(mc, document.conv_form.unic_area, document.conv_form.html_area);
}
// -->
</script>
<style type="TEXT/CSS">
<!--
.onLoad {
color:khaki;
background:black;
scrollbar-base-color:darkgrey;
}
.onMouseOver {
color:khaki;
background:black;
scrollbar-base-color:grey;
}
.onMouseOut {
color:khaki;
background:black;
scrollbar-base-color:grey;
}
//-->
</style>
</head>
<body bgcolor="black" text="khaki" link="yellow" vlink="white" alink="orange">
<!-- START HOME FREE HEADER CODE -->
</div>
</title>
<br>
<!-- END HOME FREE HEADER CODE -->
<center>
<h1>Michigan-Claremont Hebrew Encoding to Unicode Converter</h1>
</center>
<form name="conv_form">
<center>
<table border=0 cellspacing=10 cellpadding=10 align=center>
<tr>
<td>
<center><b>Codes:</b></center><br>
<table border = 1 align=top cellspacing=2 cellpadding=2>
<tr>
<td align=center>
A = א<br>
</td>
<td align=center>
M = מ<br>
</td>
</tr>
<tr>
<td align=center>
B = ב<br>
</td>
<td align=center>
n = נ<br>
</td>
</tr>
<tr>
<td align=center>
G = ג<br>
</td>
<td align=center>
N = ן<br>
</td>
</tr>
<tr>
<td align=center>
D = ד<br>
</td>
<td align=center>
$ = ס<br>
</td>
</tr>
<tr>
<td align=center>
H = ה<br>
</td>
<td align=center>
O = ע<br>
</td>
</tr>
<tr>
<td align=center>
V = ו<br>
</td>
<td align=center>
p = פ<br>
</td>
</tr>
<tr>
<td align=center>
Z = ז<br>
</td>
<td align=center>
P = ף<br>
</td>
</tr>
<tr>
<td align=center>
X = ח<br>
</td>
<td align=center>
c = צ<br>
</td>
</tr>
<tr>
<td align=center>
+ = ט<br>
</td>
<td align=center>
C = ץ<br>
</td>
</tr>
<tr>
<td align=center>
Y = י<br>
</td>
<td align=center>
q = ק<br>
</td>
</tr>
<tr>
<td align=center>
k = כ<br>
</td>
<td align=center>
R = R<br>
</td>
</tr>
<tr>
<td align=center>
K = ך<br>
</td>
<td align=center>
S = ש<br>
</td>
</tr>
<tr>
<td align=center>
L = ל<br>
</td>
<td align=center>
T = ת<br>
</td>
</tr>
<tr>
<td align=center>
m = ם<br>
</td>
<td align=center>
. = :<br>
</td>
</tr>
</table>
</td>
<td>
<h4>MC Codes</h4>
<textarea name="mc_code" rows="3" cols="64"
class="onLoad" onmouseover="this.className='onMouseOver'"
onmouseout="this.className='onMouseOut'"></textarea> <br>
<h4>Unicode</h4>
<textarea name="unic_area" rows="3" cols="64"
class="onLoad" onmouseover="this.className='onMouseOver'"
onmouseout="this.className='onMouseOut'"></textarea> <br>
<h4>HTML4.x</h4>
<textarea name="html_area" rows="3" cols="64"
class="onLoad" onmouseover="this.className='onMouseOver'"
onmouseout="this.className='onMouseOut'"></textarea> <br>
<br>
<center> <input name="convert" type="button" value="Convert" onclick="mc2unic()"></center>
</center></form></td></table></body></html>
But I had to change it to somehow make it fit for my database recordset. (I use ASP)
Here is the altered version of the javascript. I took out the 3rd textarea, which is html_area, and all the red sections. But it then gave the error:
Code:
<!-- //
conv_tbl = [
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
32, 33,8704, 1513,1505, 37, 83,8717, 65, 79, 8727, 1496, 44,8722, 58, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 46, 59, 60, 61, 62, 63,
64, 1488, 1489, 1510, 1491, 69, 70, 1490, 1492, 73, 74, 1499, 1500, 1502, 1504, 1506,
1508, 81, 1512, 1513, 1514, 85, 1493, 87, 1495, 1497, 90, 91, 92, 93, 94, 95,
63, 97, 66, 1509, 68, 101, 102, 71, 72, 105, 106, 1498, 1500, 1501, 1503, 111,
1507, 1511, 82, 8707, 84, 117, 118, 86, 88, 89, 1494, 123, 124, 125, 126, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63, 978,8242,8804,8260,8734, 402,9827,9830,9829,9824,8596,8592,8593,8594,8595,
63, 177,8243,8805, 215,8733,8706,8729, 247,8800,8801,8776,8230, 63, 63,8629,
8501,8465,8476,8472,8855,8853,8709,8745,8746,8835,8839,8836,8834,8838,8712,8713,
8736,8711, 174, 169,8482,8719,8730,8901, 172,8743,8744,8660,8656,8657,8658,8659,
9674,9001, 174, 169,8482,8721, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
63,9002,8747,8992, 63,8993, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63
];
function convert(mc, unic_textarea)
{
unic = '';
for (i = 0; i < mc.length; i++)
{
tbl_idx = mc.charCodeAt(i);
code = tbl_idx < conv_tbl.length ? conv_tbl[tbl_idx] : 63;
unic = unic + String.fromCharCode(code)
}
unic_textarea.value = unic;
}
function mc2unic()
{
mc = document.conv_form.mc_code.value;
convert(mc, document.conv_form.unic_area);
}
// -->
-
Mar 9th, 2005, 06:27 AM
#4
Re: JavaScript: what is the function of "length" in this case?
after this line of code
mc = document.conv_form.mc_code.value;
try alert(mc); just to see if it contains anything.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|