Удалить определенные фреймы после отправки формы
Всем привет!
Я начинающий в этом деле. Нужно чтобы после отправки формы (только при правильном вводе логина и пароля), удалялись ненужные фреймы. Что то не работает( Посмотрите, что не так? <script type="text/javascript"> function Hide() { var iframe = document.getElementById(child); if (iframe.style.display == '') { iframe.style.display = 'none'; } } </script> <body> <iframe id="parent" style="width:100%; height:100%; position:absolute; top:0px; left:0px;" src="https://mysite.ru/" onsubmit="Hide()"></iframe> <iframe id="child" style="width:51%; height:100%; position:absolute; top:0px; left:0px;" src="2.html" scrolling="no" frameborder="0" style="display:'';"></iframe> <iframe id="child" style="width:100%; height:25%; position:absolute; top:480px; left:0px;" src="2.html" scrolling="no" frameborder="0" style="display:'';"></iframe> <iframe id="child" style="width:100%; height:20%; position:absolute; top:300px; left:0px;" src="2.html" scrolling="no" frameborder="0" style="display:'';"></iframe> </body> |
var iframe = document.getElementById("child"); может, "child" кавычки нужны? |
Но на сколько я знаю, на странице может быть только один элемент с конкретным id. При разборе страницы следующие элементы с таким же id будут игнорироваться (сами элементы будут, только без id, как-будто вы его и не задавали)
|
Попробовал так, но тоже не работает:blink:
<script type="text/javascript"> function Hide() { var div = document.getElementById('child'); if (div.style.display == '') { div.style.display = 'none'; } } </script> <body> <iframe id="parent" style="width:100%; height:100%; position:absolute; top:0px; left:0px;" src="https://my.mobiletool.ru/" onsubmit="Hide()"></iframe> <iframe id="child" style="width:51%; height:100%; position:absolute; top:0px; left:0px; display:'';" src="2.html" scrolling="no" frameborder="0"></iframe> </body> |
Цитата:
<iframe id="parent" style="width:100%; height:100%; position:absolute; top:0px; left:0px;" src="https://my.mobiletool.ru/" onsubmit="Hide()"></iframe> |
Цитата:
Простите за нубство Вы поняли мою идею? Сможете помочь реализовать ее? Буду очень вам признателен:) |
НУ попробуйте обычную кнопку вставить и по клику убирать iframe. Когда с обычной кнопкой получиться - тогда пробовать с onsubmit
|
Цитата:
<!DOCTYPE HTML> <html> <head> <title></title> <meta name="" content=""> </head> <style> #child { display:block; } </style> <script type="text/javascript"> function hide(){ var iFrame = document.getElementById('child') iFrame.style.display = 'none' var iFrame1 = document.getElementById('child1') iFrame1.style.display = 'none' var iFrame2 = document.getElementById('child2') iFrame2.style.display = 'none' } </script> <body> <input type="submit" onclick="hide()" /> <iframe id="parent" style="width:100%; height:100%; position:absolute; top:100px; left:0px;" src="https://my.mobiletool.ru/" onclick="hide()"></iframe> <iframe id="child" style="width:51%; height:100%; position:absolute; top:100px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> <iframe id="child1" style="width:100%; height:25%; position:absolute; top:480px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> <iframe id="child2" style="width:100%; height:20%; position:absolute; top:300px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> </body> </html> Но нужно чтобы срабатывало после авторизации. Подскажите а?:cray: :cray: :cray: :cray: |
ваш код читать не удобно. оформляйте код правильно: http://javascript.ru/formatting#ofor...-i-zapusk-koda
|
Цитата:
<!DOCTYPE HTML> <html> <head> <title></title> <meta name="" content=""> </head> <style> #child { display:block; } </style> <script type="text/javascript"> function hide(){ var iFrame = document.getElementById('child') iFrame.style.display = 'none' var iFrame1 = document.getElementById('child1') iFrame1.style.display = 'none' var iFrame2 = document.getElementById('child2') iFrame2.style.display = 'none' } </script> <body> <input type="submit" onclick="hide()" /> <iframe id="parent" style="width:100%; height:100%; position:absolute; top:100px; left:0px;" src="https://my.mobiletool.ru/" onclick="hide()"></iframe> <iframe id="child" style="width:51%; height:100%; position:absolute; top:100px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> <iframe id="child1" style="width:100%; height:25%; position:absolute; top:480px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> <iframe id="child2" style="width:100%; height:20%; position:absolute; top:300px; left:0px;" src="2.html" scrolling="no" frameborder="0"></iframe> </body> </html> |
Часовой пояс GMT +3, время: 19:36. |