我正在尋找的代碼將焦點設置文本框在iframe中,我發現這樣的代碼將焦點設置的iFrame jQuery的內部控制
//get the IFRAME element - note no hashes in the name, we're using browser functionality
var iframeRef = document.getElementById("IFRAMEID");
//focus the IFRAME element
$(iframeRef).focus();
//use JQuery to find the control in the IFRAME and set focus
$(iframeRef).contents().find("#CONTROLID").focus();
但很少有人說這個代碼不工作....所以這將是正確的代碼。謝謝
此iframe內容頁面是否與父頁面具有相同的域? –