Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

224
Visualizações
How to access and edit the attributes of the controls inside an iframe through javascript?

I need to access a button inside an iframe through javascript. Below is the iframe code in the aspx file:

<iframe id="headerframe" runat="server" src="./DashHeader.html" marginheight="0" marginwidth="0" frameborder="0" style="width:inherit;height:inherit;overflow:hidden;">
            </iframe>

There is a tab strip in the same file:

<telerik:RadTabStrip RenderMode="Lightweight" runat="server" ID="RadTabStrip1" Orientation="HorizontalTop" Width="100%" Height="32px" OnClientTabSelected="tabClicked" OnClientTabSelecting="savePreviousTab" SelectedIndex="0" >
                </telerik:RadTabStrip>

When I try to access the control btnSearch(which belongs to the iframe) from the tabClick method of the tabstrip, I am able to find the button and perform the required action.

function tabClicked(sender, args) {
                    document.getElementById('headerframe').contentWindow.document.getElementById('btnSearch').style = "something";                                                     
                }

But when I try to access the same control from a different custom javascript function, I am not able to access the required control.

function setSearchButtonVisibility()
                {
                    document.getElementById('headerframe').contentWindow.document.getElementById('btnSearch').style = "something";
                }

Please suggest what needs to be done in this case.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda