SCHNittER: Dynamischer Funktionsaufruf

Beitrag lesen

Funktioniert auch nicht (s. Fehlermeldung):

<script language="JavaScript">
<!--
function on(i)
 {
  document[i].style.visibility = "visible"; //kriege document[..].style ist kein Objekt Fehlermeldung
  document[i].style.fontSize = "12";
 }

function off(i)
 {
  document[i].style.visibility = "hidden"; //kriege document[..].style ist kein Objekt Fehlermeldung
  document[i].style.fontSize = "0";
 }

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<STYLE Type=text/css>
 .text1 { font-size:16px; font-family:Arial; position:static; visibility:visible }
 .t2 { font-size:0px; font-family:Arial; position:static; visibility:hidden }
</STYLE>

<div Class=text1>
 <a href=http://www.ich.de onmouseover="on('t1');" onmouseout="off('t1');">der</a></div>
 <div ID=t1> test<br>test<br>test</div>

<div ID=pop1 Class=text1>
 <a href=http://www.ich.de onmouseover="on('t2');" onmouseout="off('t2');">der</a></div>
 <div ID=t2> test<br>test<br>test</div>

Aber hier gings, ist aber ebend undynamisch:

<script language="JavaScript">
<!--

function on()
 {
  pop2.style.visibility = "visible"; //IE
  pop2.style.fontSize = "12";
 }

function off()
 {
  pop2.style.visibility = "hidden"; //IE
  pop2.style.fontSize = "0";
 }

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
//-->
</SCRIPT>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_callJS('off()')">
<STYLE Type=text/css>
 .text1 { font-size:16px; font-family:Arial; position:static; visibility:visible }
 .text2 { font-size:0px; font-family:Arial; position:static; visibility:hidden }
</STYLE>
<div Class=text1>
 <a href=http://www.ich.de onmouseover="on()" onmouseout="off()">der</a></div>
 <div ID=pop2> test<br>test<br>test</div>
<div ID=pop1 Class=text1>
 <a href=http://www.ich.de onmouseover="on()" onmouseout="off()">der</a></div>