473,378 Members | 1,400 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,378 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 43482
"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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.