JavaScript Not working in Safari and Chrome - HELP!!

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

Ray

VIP Member
Impact
167
solved

My toggleset function does not seem to work with safari or chrome. Basically what is suppose to happen is when the user selects an option through a drop down box a div is suppose to show. It works fine with IE / FireFox / Opera just doesnt with safari or chrome. Please Help

JavaScript

Code:
<script type="text/javascript"> 

function toggleSet(rad) 
{ 
var type = rad.value;  
var list=document.getElementsByTagName('div')  
for (var k=0,elm;elm=list[k];k++)    
if (elm.className=='item')      
	elm.style.display = elm.id==type? 'inline':'';		
} 
</script>

HTML Form

HTML:
	 <select name="set1" onchange="toggleSet(this)">
	 			<option>-Select-</option>

				<option value="dom">Domain</option>
				<option value="sub">Sub Domain</option>
			</select>

DIVS
HTML:
<style>
div.item {  
display: none;  
padding: 10px;}
</style>

<div id="1" class="item" style="width:260px">stuff... 1</div>
<div id="2" class="item" style="width:260px">stuff... 2</div>


---------- Post added at 12:28 PM ---------- Previous post was at 11:44 AM ----------

Fixed:

was missing a ;

<select name="set1" onchange="toggleSet(this);">
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Truehost — .com domains from $4.99, hosting includedTruehost — .com domains from $4.99, hosting included

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back