473,399 Members | 2,478 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Set a td class on the fly... easy???

I have td(s) set up like this

<td id="1">Blah</td>
<td id="2">Blah blah</td>
etc...

Then in my script I am trying to do this...
for(var k = 0; k < tdArr.length; k++) {
if (something) {
tdArr[k].class = "myH2"
}
}

But this does not set the class for the td cell...

The javascript console says the error is:
"missing name after . operator"

What am I doing wrong? Can a class be assigned to a td like this?

Thanks
Jul 23 '05 #1
4 1968
news.west.cox.net wrote:
[...]
tdArr[k].class = "myH2"
}
}

[...]

tdArr[k].className = "myH2"

should do the trick.

Rob
Jul 23 '05 #2
"RobG" <rg***@iinet.net.auau> wrote in message
news:65*****************@news.optus.net.au...
news.west.cox.net wrote:
[...]
tdArr[k].class = "myH2"
}
}

[...]

tdArr[k].className = "myH2"

should do the trick.

Rob


Thanks Rob... you are the man.

I think I am finally done with the javascript for this page.

http://pending.buildingonline.com/spib/locator.pl


Jul 23 '05 #3
news.west.cox.net wrote:
[...]

I think I am finally done with the javascript for this page.

http://pending.buildingonline.com/spib/locator.pl


Hmm, not a bad looking page, can I offer a couple of tips?

I'm at a bit of a loss as to why you made display of the header image
dependent on JavaScript. It may be better to load an image with an
HTML <img...> tag then change it with JS. That way the page still
looks good without JS, just that the image won't change.

Another trick would be to hide the "Check All" checkbox - say use
style="visibility: hidden;" so your page layout is unaffected - then
use JS to reveal it when the page is loaded;

checkboxRef.style.visibility = 'visible';

That way if the user doesn't have JS enabled, they don't see a button
that doesn't do anything for them.

I also don't know why the "View entire roster in popup" page uses JS at
all. On the ancient machine I'm using, it loads in about 1/4 the time
with JS disabled and looks pretty much the same. I can't see how JS is
improving the page.

Anyhow, what you do about the above is up to you :-)

Cheers, Rob.
Jul 23 '05 #4
"RobG" <rg***@iinet.net.auau> wrote in message
news:41***********************@per-qv1-newsreader-01.iinet.net.au...
news.west.cox.net wrote:
[...]

I think I am finally done with the javascript for this page.

http://pending.buildingonline.com/spib/locator.pl


Hmm, not a bad looking page, can I offer a couple of tips?

I'm at a bit of a loss as to why you made display of the header image
dependent on JavaScript. It may be better to load an image with an
HTML <img...> tag then change it with JS. That way the page still
looks good without JS, just that the image won't change.

Another trick would be to hide the "Check All" checkbox - say use
style="visibility: hidden;" so your page layout is unaffected - then
use JS to reveal it when the page is loaded;

checkboxRef.style.visibility = 'visible';

That way if the user doesn't have JS enabled, they don't see a button
that doesn't do anything for them.

I also don't know why the "View entire roster in popup" page uses JS at
all. On the ancient machine I'm using, it loads in about 1/4 the time
with JS disabled and looks pretty much the same. I can't see how JS is
improving the page.

Anyhow, what you do about the above is up to you :-)


Thanks for the tips. The big JS trick I am doing is disabling checkboxes
depending on what state has been selected. For example, click on Texas,
Florida, or Alababama and some of the boxes become useless.

This is a perl script so all of the javascript (well most of it) is created
on
the fly. Nothing related to the database is hardcoded... which will make
life much easier in the coming months and years.

Thanks again for the tips and the help.
Jul 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Edvard Majakari | last post by:
Hi, I just found py.test and converted a large unit test module to py.test format (which is actually almost-no-format-at-all, but I won't get there now). Having 348 test cases in the module and...
6
by: Jon Slaughter | last post by:
Is there any way to get the class type from a pointer? I'm working on a class that acts as a set: I have two classes, one called FSet and the other called Element. FSet inherets Element and...
9
by: Sacha | last post by:
I work on a rather large C++ project. The design, so far, seems to be fine. However, there is one class, where the number of methods (and less dramtically the number of members, too) is growing and...
166
by: Graham | last post by:
This has to do with class variables and instances variables. Given the following: <code> class _class: var = 0 #rest of the class
14
by: Lee Franke | last post by:
I can't seem to figure this one out. Here is my class structure namespace name { public class foo { } }
11
by: JZ | last post by:
Hi, I'm using a class and binary formatter to store data in files. For example.. Dim FPs As New StuctureDataFile() Dim FileStream As Stream = File.Open(pfile, FileMode.Open) Dim...
9
by: Rudy | last post by:
Hello All! I'm a little confused on Public Class or Modules. Say I have a this on form "A" Public Sub Subtract() Dim Invoice As Decimal Dim Wage As Decimal Static PO As Decimal Invoice =...
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
20
by: vbgunz | last post by:
I remember learning closures in Python and thought it was the dumbest idea ever. Why use a closure when Python is fully object oriented? I didn't grasp the power/reason for them until I started...
0
by: =?Utf-8?B?Qm9iUGl0YnVsbA==?= | last post by:
Suppose that my base class is A and I have classes B, C and D deriving from A. I then have B2 deriving from B and C2 deriving from C... and B3 deriving from B2. Then... suppose that I have some...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.