Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
getElemenstByTag devuelve nulo dentro del iframe del complemento de la página de Facebook

¿Hay algún error en el código? o ¿Cómo debo obtener el resultado deseado?

mi objetivo es hacer esto

 document.getElementById('iframe1').contentWindow.document.getElementsByTagName("IMG").style = "filter:invert(100%);";

El código completo se proporciona a continuación

 <iframe onload="frameload()" lazy="true" sandbox="allow-same-origin allow-scripts block-popups allow-forms" class='viewport-iframe' id='iframe1' src="https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2FTroll.Malayalam%2Fposts%2F&tabs=timeline&width=340&height=500&small_header=true&adapt_container_width=true&colorscheme=&hide_cover=false&show_facepile=false&appId" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share" frameborder="0" allowFullScreen="true" webkitallowfullscreen="true" mozallowfullscreen="true"></iframe> <script type="text/javascript"> function frameload(){ alert(document.getElementById('iframe1')); alert(document.getElementById('iframe1').getElementsByTagName("img")); } </script>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Si obtiene iframe con éxito, cambie su código de esta manera. Agregue sus atributos en la etiqueta iframe

 <iframe onload="frameload()" id='iframe1'></iframe> <script type="text/javascript"> function frameload(){ var tags = [...document.getElementById('iframe1').contentWindow.document.getElementsByTagName("img")]; tags.forEach((el)=>{el.style="filter:invert(100%);"}); } </script>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!