Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

style sheet effect after the table is sorted

Posted on 2003-11-01
6
Medium Priority
?
311 Views
Last Modified: 2010-04-09
I have a HTML table which is using an external stylesheet. The rows are sorted when the user clicks on the heading of the table. The problem is that after the rows are sorted the the style sheet does not show its effect and the page is displayed normally.
i ma doing
              var oldDsply = tblEl.style.display;
in the beginning of the javascipt function which sorts
and the following in the end of the function.
 tblEl.style.display = oldDsply;

But it doesn't work.
Please help
0
Comment
Question by:anshul9189
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:anshul9189
ID: 9662315
to be more specific
It is not working for only this class which I have in the external style sheet

.fontColor{
color: #003366;
font-family: Times;
font-size: 14;
}
For other classes it is working fine.
0
 

Author Comment

by:anshul9189
ID: 9662322
It doesn't work for the following class which is in the external style sheet.
.fontColor{
color: #003366;
font-family: Times;
font-size: 14;
}
I am using this class in the html page as follows
<font class=fontColor>text</font>
But this class does not display its effect after the rows are sorted. All other classes work fine.
0
 
LVL 2

Assisted Solution

by:ericsDev
ericsDev earned 600 total points
ID: 9665424
sort the rows and document.write them to the page. but instead of writing <font class=fontColor>text</font> write <font id="fontColor_X">text</font> where "X" is a counter variable that starts at 0 and goes to however many font tags are generated.  After the document.write is complete run a loop that looks something like this:

function setFontColor()
{
     var counter = 0;
     while(document.getElementById("fontColor_" + counter) != null)
     {
          document.getElementById("fontColor_" + counter).className = "fontColor";
          counter++;
     }
}

I believe this will work, let me know if it does not or if you see something wrong with my code.  It is untested at time of posting :)
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 11

Accepted Solution

by:
Zontar earned 880 total points
ID: 9668081
Using CSS for font tags is rather counterproductive, since the whole point of CSS is to *get rid* of things like font tags.

If you want to apply a style class to the text of a table cell, then use

<td class="fontColor">some text...</td>

If you want it to apply to all text in the table, then use

<table class="fontColor">
...
</table>

and define your style class like so:

table.fontColor td {...}

>  sort the rows and document.write them to the page

My guess is that this isn't what's happening, since using document.write()s within the page after it's loaded would clear it. I know that the way I'd do this would be to use DOM element removal/insertion/etc. methods on the table rows. If this is what's being done, then chances are that what's happening is that the font tags aren't being re-created. Which is good, as they shouldn't bloody well be there in the first place. :)

If this doesn't help, then please post the table and script code or a link to them so we can see what's actually going on here.
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9668114
> var oldDsply = tblEl.style.display;
> in the beginning of the javascipt function which sorts
> and the following in the end of the function.
> tblEl.style.display = oldDsply;
> But it doesn't work.

The display property has nothing to do with colours or style sheets apply to an element or anything like that. It controls what sort of box the element generates -- whether it's inline, block, etc.
0
 

Author Comment

by:anshul9189
ID: 9668671
thnks a lot
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question