Hide a div with javascript from an iFrame page

B

Bubu

It's possible to hide or show e div from a iFrame page with javascript?
If yes, please can anyone tell me how to do this?

Thanks
Bubu
 
O

Otto Wyss

Bubu said:
It's possible to hide or show e div from a iFrame page with javascript?
If yes, please can anyone tell me how to do this?
I tried to hide a <blockquote> with "style="visibility:hidden" yet this
just hided the text while the space still was shown as a white area. So
I'm also interested in knowing how to suppress a block.

O. Wyss
 
A

ASM

Otto Wyss a écrit :
I tried to hide a <blockquote> with "style="visibility:hidden" yet this
just hided the text while the space still was shown as a white area. So
I'm also interested in knowing how to suppress a block.

From/in your frame :
====================

Javascript in head :
--------------------

function showHide(someThing) {
var elmt = parent.document.getElementById(someThing).style;
elmt.visibility = elmt.visibility==''? 'hidden' : '';
}

function showHideFull(someThing) {
var elmt = parent.document.getElementById(someThing).style;
elmt.display = elmt.display==''? 'none' : '';
}

function deleteElmt(someThing) {
var elmt = parent.document.getElementById(someThing);
elmt.parentNode.removeChild(elmt);
}

function moveElmt(someThing, tarGet) {
var elmt = parent.document.getElementById(someThing);
tarGet = tarGet=='body'? parent.document.body :
parent.document.getElementById(tarGet)
target.appendChild(elmt);
}

HTML (examples) :
-----------------

<a href="#" onclick="showHide('theBlock')">
hide/show main comment
</a>

<a href="#" onclick="showHideFull('theBlock')">
compress/depress main comment
</a>

<button onclick="moveElmt('theBlock','body')">
move main comment to bottom
</button>

<button onclick="moveElmt('theBlock','here')">
move main comment to div 'here'
</button>

<button onclick="deleteElmt('theBlock')">
delete main comment
</button>


HTML in main window :
=====================

<blockquote id="theBlock"> blah ...</blockquote>

<div id="here"></div>


Notice :
========

Main page and page in iFrame must come from same domain.
 
B

Bubu

Bubu said:
It's possible to hide or show e div from a iFrame page with javascript?
If yes, please can anyone tell me how to do this?

Thanks
Bubu

Thanks
Bubu
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top