[RESOLVED] disable Iframes!!

liunx

Guest
Hi all,

please i want to know if there is a way to disable an iframe.
Or if it is possible to disable all the controls on the iframe...

I explain :

i have a page (page A) who contains an iframe who call (page B)
i want to disable all the controls of the page B from the page A

If there is a solution i thank you by advance
:)I don't understand what your asking for...

could you explain it a little better?

IE: give a link, say what controls need to be disabled...Do you have control of page B or is it from a different site? You could set scrolling="no" on the iframe. That will remove scrollbars. Why exactly would you want to do this?okey thanks for your quick reply:

here is what i want to do :

my page contains an iframe

Page A :

<table width="100%" border="0" cellspacing="2" cellpadding="0">
<tr>
<td><iframe src=http://www.webdeveloper.com/forum/archive/index.php/"addphoto_new.php" frameborder="0" width="100%" height="400" name="framePics" id="framePics" scrolling="auto"></iframe></td>
</tr>
</table>

the "addphoto_new.php" contains a form like :

<form action="edit.php" id="frm_bien_r" name="frm_bien_r" method="POST" onSubmit="return validationForm(this);">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="right">
<input id="modifier" type="button" value="Modifier" onClick="btnModif();">
<input id="submiter" type="submit" value="Valider">
<input id="reseter" type="reset" value="Annuler">
</td>
</tr>
</table>
</form>


So my question is :
i am in the first page(page A) and i want to disable the iframe or the controls(button submit,button,reset)
is it possible?? i precise,i am in the (page A)

i hope you will understand me,i know that my english is not good :-(I'm a little confused as to why you want to disable it. If you don't want people using it then why even have it in the iframe in the first place?:) Aerospace_Eng_
i can control the page B ;)

why i want to do this, because i am obligate to put the page B in the iframe...
And the user can't access to controls until he pushes a button(on the page A) when he pushes the buttons,then he can access to controls of page BBecause i have to reload only the page B sometimes :)Its not fool proof because javascript can be disabled. Add this in between the head tags of page B.
<script type="text/javascript">
function disableThem()
{
var inputs = document.getElementsByTagName('input');
for(var i = 0; i < inputs.length; i++)
{
inputs.disabled = true;
}
var selects = document.getElementsByTagName('select');
for(var j = 0; j < selects.length; j++)
{
selects[j].disabled = true;
}
var textareas = document.getElementsByTagName('textarea');
for(var k = 0; k < textareas.length; k++)
{
textareas[k].disabled = true;
}
}
window.onload = disableThem;
</script>
Then in page A put this in between the head tags.
<script type="text/javascript">
function enableThem()
{
var el = parent.frames['nameofiframe']; // this is the name of the iframe.
var inputs = el.document.getElementsByTagName('input');
for(var i = 0; i < inputs.length; i++)
{
inputs.disabled = false;
}
var selects = el.document.getElementsByTagName('select');
for(var j = 0; j < selects.length; j++)
{
selects[j].disabled = false;
}
var textareas = el.document.getElementsByTagName('textarea');
for(var k = 0; k < textareas.length; k++)
{
textareas[k].disabled = false;
}
}
</script>
Then just call the function using onclick or whatever
onclick="enableThem()"
Just be sure to match the iframe names in the javascript and html.

Good luck.Thanks a lot

it works ;)
 
Back
Top