私のonkeypressでイベントを開催するためにこのJavaScriptを使用しています
function myFunction() {
if (window.event || window.event.keyCode == 13) {
changeSource();
}
}
function changeSource(){
document.getElementById("frame1").src="Log-In.aspx";
window.alert("wow");
}
ここでonkeypressイベントを使用します
<input id= "Text1" placeholder="Search here..." type="text" onkeypress="myFunction()"/>
これは、イベントを変更したいiframeです。
<iframe id="frame1" width="100%" height="100%" frameborder="0" name="page" src="about:blank" ></iframe>
問題は、iframeのsrcを変更できないが、イベントがトリガーされていることです