输出字体颜色 "<li><font color=red>" + ......+ "</font>"

<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:

 

posted on 2017-08-06 12:40  huodaihao  阅读(1535)  评论(0编辑  收藏  举报

导航