/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] disable Iframes!!

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 ?
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
?

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@scragarNov 29.2006 — 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...
Copy linkTweet thisAlerts:
@_Aerospace_Eng_Nov 29.2006 — 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?
Copy linkTweet thisAlerts:
@DJ_AkAJaYauthorNov 29.2006 — 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="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 :-(
Copy linkTweet thisAlerts:
@_Aerospace_Eng_Nov 29.2006 — 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?
Copy linkTweet thisAlerts:
@DJ_AkAJaYauthorNov 29.2006 — ? 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 B
Copy linkTweet thisAlerts:
@DJ_AkAJaYauthorNov 29.2006 — Because i have to reload only the page B sometimes ?
Copy linkTweet thisAlerts:
@_Aerospace_Eng_Nov 29.2006 — Its not fool proof because javascript can be disabled. Add this in between the head tags of page B.
&lt;script type="text/javascript"&gt;
function disableThem()
{
var inputs = document.getElementsByTagName('input');
for(var i = 0; i &lt; inputs.length; i++)
{
inputs[i].disabled = true;
}
var selects = document.getElementsByTagName('select');
for(var j = 0; j &lt; selects.length; j++)
{
selects[j].disabled = true;
}
var textareas = document.getElementsByTagName('textarea');
for(var k = 0; k &lt; textareas.length; k++)
{
textareas[k].disabled = true;
}
}
window.onload = disableThem;
&lt;/script&gt;

Then in page A put this in between the head tags.
&lt;script type="text/javascript"&gt;
function enableThem()
{
var el = parent.frames['[b]nameofiframe[/b]']; // this is the name of the iframe.
var inputs = el.document.getElementsByTagName('input');
for(var i = 0; i &lt; inputs.length; i++)
{
inputs[i].disabled = false;
}
var selects = el.document.getElementsByTagName('select');
for(var j = 0; j &lt; selects.length; j++)
{
selects[j].disabled = false;
}
var textareas = el.document.getElementsByTagName('textarea');
for(var k = 0; k &lt; textareas.length; k++)
{
textareas[k].disabled = false;
}
}
&lt;/script&gt;

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.
Copy linkTweet thisAlerts:
@DJ_AkAJaYauthorNov 29.2006 — Thanks a lot

it works ?
×

Success!

Help @DJ_AkAJaY spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...