table correction

liunx

Guest
Need slightly to correct code for css. I need to display only my table, i.e. I just need modify a table name that this corresponded to a CSS code. What is corrrect syntax to rename table?




<html>
<head>
<title></title>

<style type="text/css">
table {
display:none;
}

table.myTable {
display:block;
}
</style>
</head>

<body>


<table border="1" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>name1</font></td>
<td>name2</font></td>
</tr>

<template>
<tr>
<td><<name1>></td>
<td><<name2>></td>
</tr>
</template>

</table>

<b>
Total number of records:</b> <<#_total>> <b>Matching records:</b> <<#_matches>></font>
</body>
</html>Instead of trying to change the class of the table on the fly I think you'd be better off just giving that table an ID then manipulating its visibility.Could give an exact example of your approach?
Though I would like look on my approach also.Does someone have any suggestions to improve that html page?You want to hide all your tables besides this one?

hmmm... I won't ask why...

you could do this :

<style type="text/css">
table {
display:none;
}

table#myTable {
display:block;
}
</style>
</head>

<body>


<table id="myTable" border="1" cellpadding="1" cellspacing="0" width="100%">

etc.

You could also put more of that table formatting into your css, but that's another question.Yes, I want to hide all extraneous tables, except for mine tables. How I can add still additional tables, that they were displayed, besides this one?table#myTable, table#myTable2, table#myTable3, {
display:block;
}
or give them the same class:
table.myTable {
display:block;
}
...
<table class="myTable" ...And what's way more correct, in your opinion?
Also, should be used # instead of "." in table#myTable ?Either way is correct, it depends how your page is layed out.
See selectors (<!-- m --><a class="postlink" href="http://www.w3schools.com/css/css_syntax.asp">http://www.w3schools.com/css/css_syntax.asp</a><!-- m -->)So, the code should looks like this:

<style type="text/css">
table {
display:none;
}

table#myTable, table#myTable2, table#myTable3,{
display:block;
}
</style>
</head>

<body>

<table id="myTable" border="1" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>name</td>
<td>name2</td>
</tr>

<table id="table#myTable2" border="1" cellpadding="1" cellspacing="0" width="100%">
...
<table id="table#myTable3" border="1" cellpadding="1" cellspacing="0" width="100%">
...

-----------------------------------
or

<style type="text/css">
table {
display:none;
}

table.myTable {
display:block;
}
</style>
</head>

<body>


<table class="myTable" table border="1" cellpadding="1" cellspacing="0" width="100%">
<tr>
<td>name1</td>
<td>name2</td>
</tr>

<table class="myTable" table border="1" cellpadding="1" cellspacing="0" width="100%">
...
<table class="myTable" table border="1" cellpadding="1" cellspacing="0" width="100%">
...

is this correct?The first one is incorrect; the ids should be id="myTable2" id="myTable3" etc.Thank you, this help.
 
Back
Top