<div id="IMContentTest">
<textarea name="IMContent" class="IMClass" style="color:#ff0000;510px; height: 50px;" id="Textarea0"></textarea>
<textarea name="IMContent" class="IMClass" style="color:#ff0000;510px; height: 50px;" id="Textarea1"></textarea><br/><br/>
<textarea name="IMContent" class="IMClass" style="color:#ff0000;510px; height: 50px;" id="Textarea2"></textarea><br/><br/>
<textarea name="IMContent" class="IMClass" style="color:#ff0000;510px; height: 50px;" id="Textarea3"></textarea><br/><br/>
<textarea name="IMContent" class="IMClass" style="color:#ff0000;510px; height: 50px;" id="Textarea4"></textarea>
</div>
//变量定义
var testflag = 0, t, sipaccount, fruency, count = 0, se1, se2, m = 0, h = 0, s = 0, ss = 1;
var testcontent
//时、分、秒、毫秒的计算
function second(showtimeTag) {
if ((ss % 100) == 0) {
s += 1; ss = 1;
}
if (s > 0 && (s % 60) == 0) {
m += 1; s = 0;
}
if (m > 0 && (m % 60) == 0) {
h += 1; m = 0;
}
document.getElementById(showtimeTag).value = h + "时" + m + "分" + s + "秒";
ss += 1;
}
var ImContentList = "";
//获得一个0到4的随机整数
function getNumber() {
var random = 4 * Math.random();
if (!isNaN(random) && isFinite(random)) {
return parseInt(random);
}
}
//发送消息动作
function sendmessage() {
var IMContents = $(".IMClass");
$(IMContents).each(function () {
if ($(this).attr("value") != undefined)
ImContentList += $(this).attr("value") + ",";
});
ImContentList = ImContentList.substr(0, ImContentList.length - 1);
var contentlist = ImContentList.split(',');
var numb = getNumber();
var content = contentlist[numb];
//document.forms[0].forms[0].elements[parseInt(5 * Math.random())].value
testcontent = "[" + sip + "]" + " [ " + count + " ]" + "[ " + h + "时" + m + "分" + s + "秒" + " ] " + " " + content;
count++;
}
//开始测试
function starttest(showtimeTag) {
var time = parseInt(document.getElementById("secondText").value) * 1000;
var temp1 = "second("" + showtimeTag + "")";
var temp2 = "sendmessage()";
se1 = self.setInterval(temp1, 10);
se2 = self.setInterval(temp2, time);
}
//暂停测试
function pausetest() {
window.clearInterval(se1);
window.clearInterval(se2);
}
//停止测试
function stoptest() {
window.clearInterval(se1);
window.clearInterval(se2);
testflag = 0;
ss = 1;
m = h = s = 0;
document.getElementById("showtime").value = "0时0分0秒";
}