Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
arrrggghhh switching classes in IE
Old 03-26-2007, 06:13 PM arrrggghhh switching classes in IE
numbenator's Avatar
Webmaster Talker

Posts: 516
Location: London
Trades: 0
Hi there,

I have the below code. it s a stripped down basic of a php file.

What is attached is simply supposed to switch a border on ad off depending on the status of a check box.

It runs fine in all browsers but in IE , nothing.

Has anyone got any ideas cause ive been pulling y hair out on this for a number of hours now.

cheers
steve

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 
 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">


.itemgroup {
	border:1px solid #FFFFFF;
	 
 
	}
 

.itemgroup_show {
    border:1px solid #0000FF;
	 
	 
	}
 

</style>
<script type="text/javascript">

function show_groups() {
	
	  var check_status = document.getElementById('group_outlines');
	 
	  if(check_status.checked) { 
	  
		  var items_to_show = document.getElementsByTagName("div");	
		  for(var i=0; i< items_to_show.length ; i++) {
			   var class_text = items_to_show[i].getAttribute("class");
			   if(class_text == "itemgroup") {
					 items_to_show[i].setAttribute("class" , "itemgroup_show");
			   }
		  }
	   } 
	   
	   if(!check_status.checked) { 
		    var items_to_show = document.getElementsByTagName("div");	
			for(var i=0; i< items_to_show.length ; i++) {
				 var class_text = items_to_show[i].getAttribute("class");
				 if(class_text == "itemgroup_show") {
						 items_to_show[i].setAttribute("class" , "itemgroup");
				 }
			 }
      }
	}
 
</script>
 
</head> 


<body> 

<ul class='sortabledemo' id='groupUL2'>

     <li id='groupUL2_groupUL21'>

    <div class="itemgroup_show">
 
	hello there
	
	 
	</div>
	</li>
	</ul>

<div id="right"  align="right">
  <fieldset id="display" class="fieldSetBorder">
  <legend class="leg">Display</legend>
  <input name="group_outlines" type="checkbox" id="group_outlines" onClick="show_groups();" checked="checked" />
  <label for="group_outlines">Show group outlines</label>
  <br />
  </fieldset>
  
</div>

</body>



</html>
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 03-27-2007, 08:52 PM Re: arrrggghhh switching classes in IE
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by numbenator View Post
Hi there,

I have the below code. it s a stripped down basic of a php file.

What is attached is simply supposed to switch a border on ad off depending on the status of a check box.

It runs fine in all browsers but in IE , nothing.

Has anyone got any ideas cause ive been pulling y hair out on this for a number of hours now.

cheers
steve

Code:
                 var class_text = items_to_show[i].getAttribute("class");

I.E. probably expects you to set className not class.

Instead of using getAttribute / setAttribute, read and write to items_to_show[ i ].className.
logic ali is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to arrrggghhh switching classes in IE
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41985 seconds with 12 queries