D
D
doriulbool2016-02-09 12:58:09
css
doriulbool, 2016-02-09 12:58:09

How to implement changing iframe parameters on a page?

Please give me an idea on how to change the width and height parameters for all iframes on the page in a specific block (I use "main" in the example) via JS. The number of iframe objects does not have a fixed number. The iframe does not have an id. The problem is also to organize a check for the presence of the iframes themselves and the domain address in them, so as not to "load" the page once again.
What was:

<div class="main">
<div class="content">
<div class="panel1">
<iframe src="http://****/iframe" width="100" height="20" frameborder="0" allowfullscreen></iframe>
</div>
<div class="panel2">
<iframe src="http://****/iframe" width="100" height="20" frameborder="0" allowfullscreen></iframe>
</div>
<div class="panel3">
<iframe src="http://****/iframe" width="100" height="20" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>

What should be:
<div class="main">
<div class="content">
<div class="panel1">
<iframe src="http://****/iframe" width="auto" height="20" frameborder="0" allowfullscreen></iframe>
</div>
<div class="panel2">
<iframe src="http://****/iframe" width="auto" height="20" frameborder="0" allowfullscreen></iframe>
</div>
<div class="panel3">
<iframe src="http://****/iframe" width="auto" height="20" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question