Html-iFrame-Javascript
-
I have html which contain iframe in it. I have a button in my html which will call javascript(ajax) function and I will get server response from php script. Normally if I want to display it in my main html, I can use:
var spantag=document.getElementById("displayCamera");
spantag.innerHTML=xhr.responseText;How can I display the result into other html file/my iframe(let say I have span id in html of the iframe).
-
I have html which contain iframe in it. I have a button in my html which will call javascript(ajax) function and I will get server response from php script. Normally if I want to display it in my main html, I can use:
var spantag=document.getElementById("displayCamera");
spantag.innerHTML=xhr.responseText;How can I display the result into other html file/my iframe(let say I have span id in html of the iframe).
try
window.iframeID.spanID
where iframeID is the id of your iframe and spanID is the id of your span.Yusuf Can I help you?
-
try
window.iframeID.spanID
where iframeID is the id of your iframe and spanID is the id of your span.Yusuf Can I help you?
Its done by
window.frames["displayCatalog"].document.getElementById("displayCamera").innerHTML = xhr.responseText;
So I have to change the iframe's attribute to name and not id. Thanks though for the heads up.