Click to See Complete Forum and Search --> : How to reference web controls in iframe?


Amo_Lin
01-03-2003, 12:35 AM
want to reference web controls in iframe. how to do that?


the following does't work, how to revise?

<html>

<head>
function automatic( )
{
alert(document.getElementById("ID_of_iframe").document.getElementById("ID_of_Font_in_another.html").size);
}
</head>

<body >
<iframe id="ID_of_iframe" src="another.html" ></iframe>
</body>
</html>:confused:

khalidali63
01-03-2003, 06:20 AM
the code snippet below will let you do that,


Khalid


<head>
<title>Untitled</title>

<script>
var size = 10;
function changeFrameFont(){
size = size+2;
iframe.document.getElementById("block").style.fontSize = size+"pt";
}
</script>
</head>

<body>
<form name="frm">
<input type="Button" value="Change Font in Iframe" onclick="changeFrameFont();"></input>
</form>
<iframe name="iframe" src="childIframe.html" frameborder="1"></iframe>

</body>

the code aboe assumes that you have a div tag in iframe src file with id "block"