HI everyone My question is like that this is the code: <script language="javascript"> function showHideTable(menuId){ var obj=document.getElementById(menuId) obj.style.visibility=(obj.style.visibility=="visible"?"hidden":"visible") } </script> I need three things: 1 can someone put this code into reguler if/else and make it more simple for me? 2 what is this syntax with "? :" means? 3 why do i need this function to a pop-up menu? looking fror hearing from all of u guys progfrog
I'll answer question 1 & 2 for you. <script language="javascript"> function showHideTable(menuId){ var obj=document.getElementById(menuId) if (obj.style.visibility == "visible"){ obj.style.visibility = "hidden"; } else { obj.style.visibility = "visible"; } } </script> Code (markup): That's your function re-written for IF/ELSE. (obj.style.visibility=="visible"?"hidden":"visible") Code (markup): Means set if obj.style.visibility is visible, return hidden, otherwise return visible. Sorry if that's bit confusing. It means exactly what the IF/ELSE statement does above. Jay