var con=document.getElementsByTagName("li");
for (var i=0; i< con.length;i++)
{
var text=con[i].getAttribute("title");
if(text!=null)
{
document.write(text+"<br>");
}
}
for (var i=0; i< con.length;i++)
{
var text=con[i].getAttribute("title");
if(text!=null)
{
document.write(text+"<br>");
}
}
2020-06-28
<input type="text" id="count" onfocus="startCount()"/>
<script type="text/javascript">
var num=0;
function startCount()
{
document.getElementById('count').value=num;
num=num+1;
setTimeout("startCount()",1000);
}
</script>
<script type="text/javascript">
var num=0;
function startCount()
{
document.getElementById('count').value=num;
num=num+1;
setTimeout("startCount()",1000);
}
</script>
2020-06-28
document.write(myyear+"年"+mymonth+"月"+myDate+"日&nbsp;"+weekday[mynum]+"--"+"班级总分为:"+Math.round(cont/sco.length));
var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var sco=scoreStr.split(";");
var cont = 0;
for(i = 0;i<sco.length;i++){
var score = sco[i].indexOf(':');
cont += parseInt(sco[i].substr(score+1,2));
};
var sco=scoreStr.split(";");
var cont = 0;
for(i = 0;i<sco.length;i++){
var score = sco[i].indexOf(':');
cont += parseInt(sco[i].substr(score+1,2));
};
留下记录
var today=new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=today.getDay();
var myyear=today.getFullYear();
var mymonth=today.getMonth()+1;
var myDate=today.getDate();
var today=new Date();
var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
var mynum=today.getDay();
var myyear=today.getFullYear();
var mymonth=today.getMonth()+1;
var myDate=today.getDate();
已采纳回答 / 宝慕林6934861
应该是这个原理:<script type="text/javascript">document.write("重点看这里"+"<br>"); //html中标签可嵌入javascript ,javascript语句中也可以输出html标签</script>
2020-06-25