对我来说javascript focus()方法工作正常,如果我使用它与按钮和onClick事件,但与文本框中的onBlur,它不工作.任何人都可以指导我吗?
<html>
<head>
<script type="text/javascript">
function displayResult()
{
var inp1=document.getElementById("text1").value;
var inp2=inp1.length;
if(inp2==0)
{
alert("Field 1 cannot be left Empty");
//document.getElementById("text1").value="";
document.getElementById("text1").focus();
}
}
</script>
</head>
<body>
<input type="text" name="text1" id="text1" onBlur="displayResult();"/>
<input type="text" name="yext2" id="text2" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud) 我想解决以下重现关系:
T(n)= 2T(√n);
我猜T(n) = O(log log n),但我不知道如何证明这一点.我如何证明这种复发可以解决O(log log n)?
我希望序列号:在动态插入行时增加。当任何行被删除时,无论是在开头、结尾还是中间,数字都应按适当的顺序重新排列。我是一个新生,无法理解如何做到这一点。任何人都可以请指导我。预先感谢您的支持。
我在下面给出了我的示例代码。单击“(+)” 按钮时,行会自动增加。发生这种情况时,我希望序列号也自动增加。当任何行被删除时,(即使在表格的中间),数字应该自动以正确的顺序进行调整。请指导我。
<html>
<head>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$(document).ready( function() {
id=1;
var serial =1;
$('#butVal').click(function(){
var master = $(this).parents("#table-2");
id++;
var sample = master.find('.tabRow').clone();
sample.attr("id", id + "item");
master.find('.tabRow').removeClass('tabRow');
master.find('tbody').append(sample);
//alert(master);
//alert(sample);
//alert(sample.html());
//alert(master.html());
var rowLen = $('#table-2 > tbody >tr').length;
//alert(rowLen);
if(rowLen>9)
{
alert("no of row is reached 10");
}
}
);
$('table#table-2 button.remove').live('click', function(){
if($("table#table-2 tbody tr").length > 1)
{
if($("table#table-2 tbody tr").index($(this).parents('tr')) ==$("table#table-2 tbody tr").length -1)
{
$(this).parents('tr').prev().addClass("tabRow");
}
$(this).parents('tr').remove();
}
else
{ …Run Code Online (Sandbox Code Playgroud)