<title>4-15</title> <script language="javascript"> <!-- var students = new Array( "杨宗楠", "杨玉婷", "李莉" ); for( index in students ) { if( students[index] != "杨宗楠" ) //不是“杨宗楠”就输出为黑色字体 { document.write( "<li>" + students[index] ) } else // 是杨宗楠输出为红色字体 { document.write( "<li><font color=red>" + students[index] + "</font>" ); } } --> </script>
out:
时间: 2024-10-18 15:01:49