我已经创建了一个数组,我要找出记录,当我要查找大写单词的记录时,它是可以的,但是当我要查找带有小写字母的记录时,它没有找到记录。folloying 是我制作的脚本。
if (document.getElementById('drop_down_list_1').value == "Genetic") {
if (document.getElementById('search_input').value == "") {
alert("Please Enter a charactor / word..");
} else {
var con = document.getElementById('first_div');
var con2 = document.getElementById('first_div2');
var char = document.getElementById('search_input').value;
var str = '';
var j = 0;
var ad = ['GLARIFIDE Deadlines 2012 - 2013 Nov', 'REPRODUCTIVE VACCINES — REPRODUCTIVE CLAIMS', 'M', 'M', 'R'];
var len = ad.length;
//char.toLowerCase().indexOf(ad) != -1;
var break_line = '<br>';
for (j = 0; j < len; j++) {
var str = ad[j];
var n = str.indexOf(char);
if (n == 0)
con.innerHTML += '<table id="results" style="margin-top: -3px;"><tr><td>' + str + '</td><td id="td1"><a href="javascript:presenter.command(\'viewPdf\',{\'path\': \'/images/pdf/Dairy/' + j + '.pdf\'});"><img src="images/view.png" style="margin-left:250px;"></a><img src="images/email.png"></td></tr></table>' + break_line;
break_line = '<br>';
}
}
}