947740 Posted April 13, 2010 Share Posted April 13, 2010 I can't figure out what's wrong with this script. IE says there is a missing expectected identifier: <script language='javascript' type='text/javascript'> function changeMain(class) { var main_table = document.getElementById('main'); switch(class) { case "soldier": main_table.innerHTML = "<p>HTML here</p>"; break; case "stealth": main_table.innerHTML = "HTML here"; break; case "armored": main_table.innerHTML = "HTML here"; break; case "engineer": main_table.innerHTML = "HTML here"; break; case "scout": main_table.innerHTML = "HTML here"; break; case "medic": main_table.innerHTML = "HTML here"; break; default: main_table.innerHTML = ""; } } function changeSecondary(class) { var primary_table = document.getElementById('primary'); switch(class) { case "spiritualist": primary_table.innerHTML = "HTML here"; break; case "stealth": primary_table.innerHTML = "HTML here"; break; case "firstaid": primary_table.innerHTML = "HTML here"; break; case "gunmaster": primary_table.innerHTML = "HTML here"; break; case "bombexpert": primary_table.innerHTML = "HTML here"; break; case "captain": primary_table.innerHTML = "HTML here"; break; case "supplier": primary_table.innerHTML = "HTML here"; break; case "pyromaniac": primary_table.innerHTML = "HTML here"; break; case "spy": primary_table.innerHTML = "HTML here"; break; default: primary_table.innerHTML = ""; } } </script> Link to comment https://forums.phpfreaks.com/topic/198444-javascript-problem/ Share on other sites More sharing options...
yozyk Posted April 14, 2010 Share Posted April 14, 2010 Class is keyword. Rename parameters of your functions. Link to comment https://forums.phpfreaks.com/topic/198444-javascript-problem/#findComment-1041431 Share on other sites More sharing options...
947740 Posted April 23, 2010 Author Share Posted April 23, 2010 Thanks. Link to comment https://forums.phpfreaks.com/topic/198444-javascript-problem/#findComment-1046752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.