Jump to content

Hersarma

New Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by Hersarma

  1. Hersarma

    functions

    Ty for answer. And yes they are all in one div except one tag. I try to move that tag in another div. Or i can delete that div and add another div in same place whit a function. But any way ty
  2. Hersarma

    functions

    Hello all. So i have a question about functions. Example: I like to change css style on multiple id's in a function like this. / * function endGame () { document.getElementById ('easybtn'). style.display = 'none'; document.getElementById ('mediumbtn'). style.display = 'none'; document.getElementById ('hardbtn'). style.display = 'none'; document.getElementById ('randombtn'). style.display = 'none'; document.getElementById ('textOutput'). style.display = 'none'; document.getElementById ('hide'). style.display = 'none'; } * / But it looks like a lot of repiting. So i made another function where i used array of id's and use foor loop. / * var ids = ['easybtn', 'mediumbtn', 'hardbtn', 'randombtn', 'textOutput', 'hide'] function endGame () { for (var i = 0; and <ids.length; and ++) { document.getElementById (ids ). style.display = 'none'; } * / They both work But what function is bether to use in this situation or is there even a bether way. Ty. And sry for my bad english.
  3. Hello all. Im trying to understand 'fuctions()' in javascript. So i made some modifications from Beginners Javascript 2015foundation ch12-lesson-1. Can you tell me pls if im going in right direction. I attach one file check it out pls. TY. ch12-lesson-1.html
×
×
  • Create New...