Skip to main content
Participant
August 25, 2016
Answered

I can not understand this code

  • August 25, 2016
  • 2 replies
  • 506 views

what do mean "window.parent.document.forms"

is there a way to know what do mean without have rest of the code?

alert('Aviso!');
window.parent.document.forms[0].edAlgo.select();
window.parent.document.forms[0].edAlgo.focus();
    This topic has been closed for replies.
    Correct answer WolfShade

    This is a JavaScript question, not a ColdFusion question, but I will attempt to answer it, anyway.

    window = self.

    parent = self is a child window, so parent is the window that spawned self.

    document = document object model (your code).

    forms[0] = first form in an array of forms.

    window.parent.document.forms[0] = opening (parent) window form.

    .adAlgo.select() = select form element "adAlgo".

    .adAlgo.focus() = place cursor in/on (focus) form element "adAlgo".

    It looks like it's part of form validation; if something in adAlgo is not correct, place the cursor there so the user knows that the value needs to be corrected.

    This is a complete guess, of course.

    HTH,

    ^_^

    2 replies

    Participant
    August 26, 2016

    Yes, i even thought of translator to talk fast, i use to translater some works

    but will be very easy and i not will learn

    i want much talk inglish

    vlw mesmo cara, fica ai um agradecimento em português

    WolfShade
    WolfShadeCorrect answer
    Legend
    August 25, 2016

    This is a JavaScript question, not a ColdFusion question, but I will attempt to answer it, anyway.

    window = self.

    parent = self is a child window, so parent is the window that spawned self.

    document = document object model (your code).

    forms[0] = first form in an array of forms.

    window.parent.document.forms[0] = opening (parent) window form.

    .adAlgo.select() = select form element "adAlgo".

    .adAlgo.focus() = place cursor in/on (focus) form element "adAlgo".

    It looks like it's part of form validation; if something in adAlgo is not correct, place the cursor there so the user knows that the value needs to be corrected.

    This is a complete guess, of course.

    HTH,

    ^_^

    Participant
    August 25, 2016

    thanks a lot

    helped me alot, only in know that is a JavaScript, i am very scatterbrained still

    but with the code seem be all sure, already be working properly

    (at least up to now)

    and sorry by the error of english

    i am from brazil and i not know much well english

    WolfShade
    Legend
    August 25, 2016

    Your English is not horrible; I think I understand what you are saying and asking.  Have you thought of using a mechanical translator, like translate.google.com?  (??????.google.br??)

    If by 'scatterbrained' you mean 'new to coding' - we all have to start somewhere, yes?

    Glad to help you to understand the code you supplied. 

    Seu Inglês não é horrível; Eu acho que entendo o que você está dizendo e fazendo. 
    Você já pensou em usar um tradutor mecânico, como translator.google.com? (??????. Google.br ??)

    Se por "desmiolada" quer dizer "novo para codificação '- todos nós temos que começar em algum lugar, certo?

    Fico feliz em ajudá-lo a entender o código fornecido. 

    V/r,

    ^_^