Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

JavaScript Not working in Safari and Chrome - HELP!!

SpaceshipSpaceship
SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
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
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
DomainEasy: flexible LTO options. Close more domain deals with financing.

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Search: choose where to search from the All tab
Open the search at the top of any page. On the All tab, the list next to the search box lets you choose where to search: everything, all...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back