Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

mestre fyoda

bloquear janela pai

Recommended Posts

a sugestão que dou é utilizar CSS e iframea idéia seria criar um layer que cobrisse toda a área da "janela pai"e dentro do layer fazer chamada para a página popup, que na verdade estará dentro de um iFrameoutra opção é usar o "html modal dialog"busque no google ou aqui mesmo no forum

Compartilhar este post


Link para o post
Compartilhar em outros sites

como eu faço para bloquear a janela pai quando abir a janela filho e ao clicar no botao fechar fechar a janela filho habilitar a pai ?

pensei no seguinte...

abrir a janela filha

e qualquer ação de click ou tecla na janela pai

deve levar o foco para a janela filha então fiz o seguinte »

 

 

são 2 arquivos:

 

trava_pai.htm

 

<html><head><script><!--var filhafunction abre_filha(){filha = window.open("trava_filha.htm","","width=250, height=300, top=30, left=300")}function foco_filha(){document.onclick = function(){ filha.focus(); }document.onkeydown = function(){ filha.focus(); }}--></script></head><body><a href="#" onclick="abre_filha()">abre filha</a></body></html>

 

trava_filha

 

<html><head><script>function fecha_filha(){opener.document.onkeydown = function(){}opener.document.onclick = function(){}window.close();}opener.foco_filha();</script></head><body><a href="#" onclick="fecha_filha()">fecha filha</a></body></html>
valeu?? ;]

Compartilhar este post


Link para o post
Compartilhar em outros sites

tygo, nesse esquema que você passou é apenas o foco que é jogado na janela.a janela pai continuará livre para utilização

Compartilhar este post


Link para o post
Compartilhar em outros sites

tygo,

 

nesse esquema que você passou é apenas o foco que é jogado na janela.

 

a janela pai continuará livre para utilização

realmente os links ainda continuam ativos.//

 

bom... fiz o seguinte:

 

depois de devolver o foco à janela filha a função retorna falso

evitando q links sejam "executados"

 

function foco_filha(){document.onclick = function(){ filha.focus();return false; }document.onkeydown = function(){ filha.focus();return false; }}
tah.. mas os links devem estar usando o atributo href:

<a href="java script:abre_filha();" >abre filha</a>

<a href="http://www.imasters.com.br" >imasters</a>

Essa solução não "desativa" o onclick de um elemento "a".

Mas poderia muito bem setar uma variável q possa ser utilizada por qualquer função chamada por um evento qualquer como o onclick//

Essa variável iria permitir ou não a execução das funções.

 

 

e claro... alterar a chamada da função fecha_filha() para q a mesma seja executada

qnd a janela for descarregada/fechada de qualquer maneira.

 

//bom.. estou só jogando idéias

Compartilhar este post


Link para o post
Compartilhar em outros sites

kra, tem um esquema pra abrir janelas de dialog... faz mto tempo q eu n mexo com isso, mas funciona exatamente da maneira que voce precisa... eu lembro q o uso eh variavel de browser para browser e nao lembro do codigo agora, mas procura na net por "javascript open dialog" que da pra achar ;)

Compartilhar este post


Link para o post
Compartilhar em outros sites

kra, dei uma procurada aki e achei... mas soh funciona em IE =/

 

de qq forma, se for util:

 

window.showModalDialog("url.html")

basicamente é isso, vo posta a referencia desse e do outro metodo disponivel, mas aviso logo, ta em ingles:

 

showModalDialog(url [, arguments][, features]) Creates a dialog box that keeps focus and must be addressed before any other action can occur in the browser. The url specifies the URL of the document to display and arguments defines the value set in the new window’s dialogArguments property. Returns the value of the returnValue property of the new window when it closes. The features string is a semicolon-separated list of the "feature:value" entries of the features listed in Table B-3 (for example, "help:yes;center:yes"), as provided by Microsoft's documentation. (IE4+)showModelessDialog(url [, argument][, features]) Creates a dialog box that stays on top of any other browser windows. The url specifies the URL of the document to display and argument is a string that defines the value set in the new window’s dialogArguments property. Returns a reference to the new window. The features string is a semicolon-separated list of the "feature:value" entries of the features listed in Table B-4 (for example, "help:yes;center:yes"), as provided by Microsoft's documentation. (IE4+)Table B-4: Possible Values for Parts of the features Argument to showModalDialog and showModelessDialog  feature:value Description dialogHeight:Height Sets the height of the dialog window. dialogLeft:XPos Sets the left position of the dialog window relative to the upper-left corner of the desktop. dialogTop:YPos Sets the top position of the dialog window relative to the upper-left corner of the desktop. dialogWidth:Width Sets the width of the dialog window. center:{ yes | no | 1 | 0 | on | off } Specifies whether to center the dialog window within the desktop. The default is yes. dialogHide:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window is hidden when printing or using print preview. This feature is only available when a dialog box is opened from a trusted application. The default is no. edge:{ sunken | raised } Specifies the edge style of the dialog window. The default is raised. help:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays the context-sensitive Help icon. The default is yes. resizable:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window has fixed dimensions. The default is no. scroll:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays scroll bars. The default is yes. status:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays a status bar. The default is yes for untrusted dialog windows and no for trusted dialog windows. unadorned:{ yes | no | 1 | 0 | on | off } Specifies whether the dialog window displays the border window chrome. This feature is only available when a dialog box is opened from a trusted application. The default is no.

ta meio baguncada pq tinha tabelas e eu soh copiei e colei... =P

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.