[JavaScript] Firefox und getElementById()



  • Moin!
    ich werde hier nochmal blöd. Ich will einfach nur per JavaScript ein verstecktes div sichtbar machen. Das Div hat die id "content". Im IE funzt das Script wunderbar. Aber der Firefox meckert. Hat jemand eine Ahnung, woran es liegen könnte?

    <script language="JavaScript">
    		var isNew = 0;
    		var isNS = 0;
    		var isIE = 0;
    		var docObj;
    		var StyleObj;
    
    		function detectBrowser()
    		{
    			var brow = navigator.appName;
    
    			if(brow == "Netscape")
    				isNS = 1;
    			else if(brow == "Microsoft Internet Explorer")
    				isIE = 1;
    			else
    				isNew == 1;
    
    			docObj = 'document.all';
    
    			docObj = (isNS) ? 'document' : 'document.all';
    			styleObj = (isNS) ? '' : '.style';
    
    		}
    
    		function showit()
    		{
    			dom = eval(docObj + "." + "content" + styleObj);
    			dom.visibility = "visible";
    		}
    </script>
    


  • Für Netscape:
    document.getElementById('element_id').style.visibility = 'hidden';
    ...oder so ähnlich, ggf. nochmal bei selfhtml nachgucken. 👍


Anmelden zum Antworten