3 replies [Last post]
aka.snowball
aka.snowball's picture
User offline. Last seen 1 year 45 weeks ago. Offline
newbie
Timezone: GMT+2
Joined: 2010-06-07
Posts: 8
Points: 14

The following works if the row that i want to display has one class. But if it has two classes this don't work.

for example this works

<tr class="testcase-failed-message">
<th>
testcase-failed-message
</th>
<th>
testcase-failed-message
</th>
</tr>

And this don't since it has two classes. How can i have two classes on a tag and still chose wich one i want to use when i want to show them or not??

<tr class="testcase-failed-message failed-skipped">
<th>
testcase-failed-message
</th>
<th>
testcase-failed-message
</th>
</tr>

function show(){
doShow('testcase-failed-message');
}
 
 
 
 
function doShow(textstring) {
 
var allPageTags=document.getElementsByTagName("*");
 
for (i=0; i<allPageTags.length; i++) {
 
if (allPageTags[i].className==textstring || allPageTags[i].className==textstring2) {
 
allPageTags[i].style.display='none';
}
 
 
}
}

Tags:
Hugo
Hugo's picture
User offline. Last seen 5 hours 26 min ago. Offline
rank Moderator
Moderator
Timezone: GMT+1
Joined: 2004-06-06
Posts: 15197
Points: 2300

Honestly this is a easy

Honestly this is a easy requirement and simplicty to do if only you would use jQuery as advised in another thread, I won't touch old school JavaScript at all nowadays. jQuery is very quick to pick up as well so won't cause you too much lost time.

Before you make your first post it is vital that you READ THE POSTING GUIDELINES!
----------------------------------------------------------------
Please post ALL your code - both CSS & HTML - in [code] tags
Please validate and ensure you have included a full Doctype before posting.
Why validate? Read Me

jon19870
jon19870's picture
User offline. Last seen 37 weeks 5 days ago. Offline
rank Enthusiast
Enthusiast
Timezone: GMT+1
Joined: 2007-01-05
Posts: 195
Points: 194

First of all we need clamp

First of all we need clamp down on people posting JavaScript problems in a CSS forum. Puzzled

gary.turner
gary.turner's picture
User is online Online
rank Moderator
Moderator
Timezone: GMT-5
Joined: 2004-06-25
Posts: 7928
Points: 1767

Consider this sub-forum's

Consider this sub-forum's description: "Talk about other areas of web development, PHP, DHTML, (X)HTML, JavaScript etc." Bolding added.

cheers,

gary

Unplanned code results in a tangled wad of brain-cramping confusion.

There are enough html & css demos and tutorials to be interesting. Please visit.