Can't seem to be able to run this array.
<HTML>
<HEAD></HEAD>
<BODY>
<script language="javascript">
function e(#####,n) {
this.s = s;
this.m = m;
this.n = n;
}
var table = new Array();
var i = 0;
table[i] = new e("a", "A", 1);
table[++i] = new e("b", "B", 2);
etc...
function let(l) {
for (i = 0; i < 109; ++i) {
if (l = table[i].number)
return table[i].s + " "
}
return l+" "
}
function go() {
s = new String("L")
r = ''
for (i = 0; i < s.length; ++i) {
r += let(String.fromCharCode(s.charAt(i)))
s += s.charAt(i)
}
document.write(r)
}
go()
</script>
</BODY>
</HTML> 2 1159
the ram arm said: Can't seem to be able to run this array.
<HTML> <HEAD></HEAD> <BODY> <script language="javascript"> function e(#####,n) { this.s = s; this.m = m; this.n = n; }
var table = new Array(); var i = 0; table[i] = new e("a", "A", 1); table[++i] = new e("b", "B", 2); etc...
function let(l) { for (i = 0; i < 109; ++i) { if (l = table[i].number) return table[i].s + " " } return l+" " }
function e(#####,n) {
should probably be:
function e(s,m,n) {
and:
if (l = table[i].number)
should probably be:
if (l == table[i].n)
since it looks like you're trying to make a comparison ( == instead of = )
and you haven't defined an attribute named "number".
If the numbers in your objects are all unique, you could simplify your
code quite a bit:
var table = new Array();
function e(s,m,n) {
this.s = s;
this.m = m;
table[n]=this;
}
"the ram arm" <th*******@yahoo.com> writes: Can't seem to be able to run this array.
How do you run an array?
<HTML> <HEAD></HEAD> <BODY> <script language="javascript">
Should be
<script type="text/javascript">
function e(#####,n) {
I assume "#####" should be "s,m". Are you affected by some kind
of moronic content filter? :)
this.s = s; this.m = m; this.n = n; }
var table = new Array(); var i = 0; table[i] = new e("a", "A", 1); table[++i] = new e("b", "B", 2);
A shorter notation would be:
var table = [
new e("a", "A", 1),
new e("b", "B", 2),
// etc
];
function let(l) { for (i = 0; i < 109; ++i) {
Here I would make "i" a local variable:
for (var i = 0; i < 109; i++) {
I assume that 109 is the length of "table".
if (l = table[i].number)
Should probably be:
if (l == table[i].n)
Notice the double equal, which is comparison, where the single
is assigment. Also, e-objects have no "number" property, so
I'm guessing it's the "n" property.
function go() { s = new String("L") r = '' for (i = 0; i < s.length; ++i) { r += let(String.fromCharCode(s.charAt(i)))
What is happening here?
S.charAt(i) is "L". Then String.fromCharCode("L") should fail.
Do you mean:
r += let(s.charCodeAt(i));
That would make the argument to "let" a number. Probably not the
correct number, since "L" has char code 76.
s += s.charAt(i)
So s becomes "LL", then "LLL", then "LLLL", and the loop never ends.
So, what are you trying to do? Because the code is far from being obvious,
except where it is obviously wrong :)
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.' This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Jedediah Smith |
last post by:
In order to facilitate search engine indexing, I'd like to be able to
access a script using something like this:
http://server/script.asp/param
where this would execute script.asp which could...
|
by: ZMan |
last post by:
Scenario:
This is about debugging server side scripts that make calls to
middle-tier business DLLs. The server side scripts are legacy ASP 3.0
pages, and the DLLs are managed DLLs...
|
by: Pete Beech |
last post by:
Hi,
We have an ASP.NET 1.1 webapp, deployed on an integration and a
production server - exactly the same code. One of the
pages has client side validation script, using the validation...
|
by: Phoe6 |
last post by:
Hi all,
Part of my script is to check for pre-requisite rpms to be
installed.
If its installed, I just display the rpm version as in rpm database,
otherwise I output a message saying:
' rpm is...
|
by: dbee |
last post by:
Right. I've got a really, really annoying/difficult/time consuming
problem with my development environment. I'm using django to build a
web app with paypal integration. My server is hosted...
|
by: dragze |
last post by:
Hi,
On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player.
Now use one of the scripts it works fine, use both and...
|
by: cassbiz |
last post by:
Could use some help here.
This script is carrying over an image just fine but the text isn't coming over. can you see why it is not working????
from the form I want to carry over two lines of...
|
by: =?Utf-8?B?SmFwZQ==?= |
last post by:
im writing a c# console application that copies files chosen from the windows
explorer. I chose the files i want to copy and then from the (right key) menu
chose my program.
the program starts...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| | |