我寫了一個ajax頁面,它將更改特定的div內容。在這個Ajax代碼將創建一個文本框。 現在我想在調用該函數後專注於該文本框。在點擊一個按鈕的功能將得到稱爲專注於由ajax創建的文本框
function addnewitem5()
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("aa433").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax-production.php?type=sales",true);
xmlhttp.send();
}
對Ajax的production.php 的代碼只是
<?php echo '<input type="text" name="barcode" id="barcode"/>';?>
我如何可以專注於文本框?
這是不是在得到一票 - 投票? – Sarath