An HTML iframe is used to display a web page within a web page.
Syntax
<iframe src="https://edurev.gumlet.io/rl" title="description"></iframe>
Tip: It is a good practice to always include a title attribute for the <iframe>. This is used by screen readers to read out what the content of the iframe is.
Example
<iframe src="https://edurev.gumlet.io/emo_iframe.htm" height="200" width="300" title="Iframe Example"></iframe>
Or you can add the style attribute and use the CSS height and width properties:
Example
<iframe src="https://edurev.gumlet.io/emo_iframe.htm" style="height:200px;width:300px;" title="Iframe Example"></iframe>
Example
<iframe src="https://edurev.gumlet.io/emo_iframe.htm" style="border:none;" title="Iframe Example"></iframe>
With CSS, you can also change the size, style and color of the iframe's border:
Example
<iframe src="https://edurev.gumlet.io/emo_iframe.htm" style="border:2px solid red;" title="Iframe Example"></iframe>
An iframe can be used as the target frame for a link.
The target attribute of the link must refer to the name attribute of the iframe:
Example
<iframe src="https://edurev.gumlet.io/emo_iframe.htm" name="iframe_a" title="Iframe Example"></iframe>
<p><a href="https://www.w3schools.com" target="iframe_a">W3Schools.com</a></p>
JavaScript makes HTML pages more dynamic and interactive.
Example
Example
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
Here are some examples of what JavaScript can do:
Example
JavaScript can change content:
document.getElementById("demo").innerHTML = "Hello JavaScript!";
Example
JavaScript can change styles:
document.getElementById("demo").style.fontSize = "25px";
document.getElementById("demo").style.color = "red";
document.getElementById("demo").style.backgroundColor = "yellow";
Example
JavaScript can change attributes:
document.getElementById("image").src = "picture.gif";
The HTML <noscript> tag defines an alternate content to be displayed to users that have disabled scripts in their browser or have a browser that doesn't support scripts:
Example
<script>
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
<noscript>Sorry, your browser does not support JavaScript!</noscript>
14 videos|31 docs|24 tests
|
|
Explore Courses for Class 3 exam
|