473,394 Members | 1,721 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,394 software developers and data experts.

How to change table border from javascript?

Whats wrong with this?

top.document.frmMain.tabMain.border = "1";

thanks
Jul 20 '05 #1
9 43485
"Harry" <a@abc.com> wrote in message
news:A1*********************@news-text.cableinet.net...
Whats wrong with this?

top.document.frmMain.tabMain.border = "1";


It has no context.

Richard.
Jul 20 '05 #2
how would I do it then? - what am I missing?

thanks

"Richard Cornford" <Ri*****@litotes.demon.co.uk> wrote in message
news:bn*******************@news.demon.co.uk...
"Harry" <a@abc.com> wrote in message
news:A1*********************@news-text.cableinet.net...
Whats wrong with this?

top.document.frmMain.tabMain.border = "1";


It has no context.

Richard.

Jul 20 '05 #3
In article <n8*********************@news-text.cableinet.net>, a@abc.com
enlightened us with...
how would I do it then? - what am I missing?


You're missing the rest of the code and an explanation of what doesn't
work, what you want, and target browsers, if any.

Context = tell us what the heck you want.

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #4
sorry, target browsers are ie 5.5 & netscape 7

I want the user to be able to click on a checkbox which will using
javascript show/hide the border of a table

thanks

harry
"kaeli" <in********************@NOSPAMatt.net> wrote in message
news:MP************************@nntp.lucent.com...
In article <n8*********************@news-text.cableinet.net>, a@abc.com
enlightened us with...
how would I do it then? - what am I missing?


You're missing the rest of the code and an explanation of what doesn't
work, what you want, and target browsers, if any.

Context = tell us what the heck you want.

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------

Jul 20 '05 #5
In article <2d*********************@news-text.cableinet.net>, a@abc.com
enlightened us with...
sorry, target browsers are ie 5.5 & netscape 7

I want the user to be able to click on a checkbox which will using
javascript show/hide the border of a table

thanks


If the table is named tabMain (<table id="tabMain">)

if (document.getElementById && document.getElementById("tabMain").style)
{
document.getElementById("tabMain").style.border = "1";
}
else alert("You need a better browser.");
You don't need "top" unless you're using frames, in which case you need
the frame name as defined in the frameset.

if (top.frames["frameName"].document.getElementById && top.frames
["frameName"].document.getElementById("tabMain").style)
{
top.frames["frameName"].document.getElementById
("tabMain").style.border = "1";
}
else alert("You need a better browser.");

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #6
kaeli <in********************@NOSPAMatt.net> writes:
If the table is named tabMain (<table id="tabMain">)

if (document.getElementById && document.getElementById("tabMain").style)
{
document.getElementById("tabMain").style.border = "1";
That is unlikely to work, since "1" is not a valid CSS value for the
border property.
You don't need "top" unless you're using frames, in which case you need
the frame name as defined in the frameset.


The original poster wrote this "top.document.frmMain.tabMain.border". I
assume "frmMain" is a frame name. I.e., something like:

var frm = top.frames['frmMain'];
if (frm && frm.document.getElementById) {
var elem = frm.document.getElementById("tabMain");
if (elem && elem.style) {
elem.style.border = "1px solid black";
}
}

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #7
In article <3c**********@hotpop.com>, lr*@hotpop.com enlightened us
with...
kaeli <in********************@NOSPAMatt.net> writes:
If the table is named tabMain (<table id="tabMain">)

if (document.getElementById && document.getElementById("tabMain").style)
{
document.getElementById("tabMain").style.border = "1";


That is unlikely to work, since "1" is not a valid CSS value for the
border property.


How WOULD you set the border to 1? I stick to DIVs mostly, which would
be like...
document.getElementById("tabMain").style.border="t hin solid black";
I don't think that would set the borders for the cells, though, just the
table. It would look different than having border be "1" in the table
def...

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #8
kaeli <in********************@NOSPAMatt.net> writes:
How WOULD you set the border to 1? I stick to DIVs mostly, which would
be like...
document.getElementById("tabMain").style.border="t hin solid black";
If you want to simulate the border attribute, the most likely way is:
document.getElementById("tabMain").border=1;
If that doesn't work, you can try:
document.getElementById("tabMain").setAttribute("b order","1");
I don't think that would set the borders for the cells, though, just the
table. It would look different than having border be "1" in the table
def...


Yes. I never used the border attribute, so I would go for a CSS solution:

<style type="text/css">
table {
border-collapse:collapse;
}
.borderTable td {
border: 1px solid black;
}
</style>

and then set the className instead of the border property:

document.getElementById("tabMain").className="bord erTable";

To remove the border, you would then do:

document.getElementById("tabMain").className="";

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #9
In article <u1**********@hotpop.com>, lr*@hotpop.com enlightened us
with...
kaeli <in********************@NOSPAMatt.net> writes:
Yes. I never used the border attribute, so I would go for a CSS solution:


Thanks!

-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------
Jul 20 '05 #10

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

Similar topics

1
by: Robert | last post by:
I created two pages. One using CSS and the other using a table. I'd like the css version to work like the table version. The problem arises when the full image doesn't fit in the window. Click...
0
by: yurps | last post by:
Hello here is my html, if you click the missing image in the first column on the left, the div is shown, when clicked again the div disappears...but the bottom border disappears as well...Is there...
3
by: Peter Williams | last post by:
Hi All, I want to write some javascript for a html page which does the following. Imagine that the page contains a table with 2 columns and 3 rows, e.g.: +---+---+ | A | B | +---+---+
13
by: Gary | last post by:
I have a table with a form consisting of several checkboxes and I'm wondering if its possible to change the table row background color on mouseover or hover and make it stay that color when the...
3
by: vanisathish | last post by:
Hi I am running a client side javascript timer to periodically refresh the contents of some tables in the HTML page. The table values are dynmically binded from XML DOM object using the <XML tag...
1
by: Rako | last post by:
My problem is: I want to create an index to any of the available picture-groups. This index is a table of thumbs with a scrollbar. If you click on the thumb, you get the full picture displayed. ...
0
by: RubbedLung | last post by:
http://www.hometeamproperties.net/Forms/PVA/LPV.htm As you can see its a valid page but now the bottom right rounded corner is gone, and there are entire blocks of color missing from the interior...
0
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...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
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...

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.