Using Javascript for iframes list

Asked

Viewed 55 times

0

I’m using iframes to a portal, I had to use it calling for id to solve a previous problem. The problem now is that I can’t create a list of iframes in javascript, I can only create a id with the src.

Can someone help me?

I’m using it like this, but just store it src, I can’t store anymore.

window.onload = function() {
document.getElementById("id_Iframe").src="LINK_IFRAME";
}
  • Can you give more details? What do you mean by IFRAMES list? Because in my understanding just replicate the codes to have several.

  • I passed beaten in ; to close each line. kkkk I will test.

1 answer

0


Really I was being silly. I had to close with ;; for the next code:

window.onload = function() {
document.getElementById("id_Iframe").src="LINK_IFRAME";;
document.getElementById("id_Iframe2").src="LINK_IFRAME";;
}

Then I’ll just call id in html.

Edited:

Much better solution, which solved my problem, and the iframe only opens when the modal and when the modal he unloads the src.

   $('#MyModal').on('show.bs.modal', function () {
   $('#MyModal iframe').attr('src','LINK EXTERNO OU INTERNO');
  })
   $('#MyModal').on('hide.bs.modal', function () {
   $('#MyModal iframe').removeAttr('src');
  })

Very good for the site not get heavy carrying the iframes before I opened it

  • It can even work but the correct one is only 1 point and comma (;) per line.

  • Only ; it’s not working. I call src by id in a modal.

  • Friend, I repeated several. More he starts caching in the browser. As iframe are from the same site, the elements of iframes stop working. How can I get around?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.