How to edit HTML when an link is clicked
Moderator: General Moderators
How to edit HTML when an link is clicked
When the user clicks a link, i would like the browser to edit an Iframe's height. The iframe's name is 'iframe1'. How could i do this, in either DHTML or Javascript?
first of all, assign the iframe an ID as well as a name.
<a href="whatever" onclick="resize('iframe1','200')">blag</a>
and then the function:
untested, but it should work (this would change iframe1's height to 200px). Note that you may have to explicitly define iframe1's height beforehand or it may not work.
<a href="whatever" onclick="resize('iframe1','200')">blag</a>
and then the function:
Code: Select all
function resize(objectID, newHeight) {
var objStyle = document.getElementById(objectID).style;
objStyle.height = newHeight + "px";
}- code_monkey
- Forum Newbie
- Posts: 16
- Joined: Tue Jul 08, 2003 6:13 am
- Location: UK
- Contact:
You want somthing like name and id eg.
in your iframe tag.
Code: Select all
<iframe name="iframe1" id="iframe1">