how can I make when a button is pressed it changes position | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

how can I make when a button is pressed it changes position

Please help https://code.sololearn.com/WV713KDkhFou/?ref=app

8th Aug 2020, 8:13 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
31 Answers
+ 3
Es porque tiene también que cambiar las innerWidth y innerHeight con las letras mayúsculas. Sin este, registrá la width y height con una valor indefinida, y la opération Math.random() entonces le retorno un valor de NaN, pues cuando toca el "no", no hay valores que utilizar
8th Aug 2020, 9:35 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 5
Thanks Emmanuel.z
8th Aug 2020, 9:01 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
8th Aug 2020, 9:23 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 4
Thanks
8th Aug 2020, 9:10 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 4
No, 🌞, sonreí No le hace con código, quiero decir que su button quizás va a ser a fuera de la original vista y entonces debe utilizar las barres de navigations al lado y bajo para verlo.Disculpe si no utilizo las palabras correctas. Pero ha olvidado las letras mayúsculas en su corrección, sobre window.innerWidth y window.innerHeight. Valor👍🏻,vas a llegar.
8th Aug 2020, 9:55 PM
EmmanueLZ.
EmmanueLZ. - avatar
8th Aug 2020, 10:01 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 4
No
9th Aug 2020, 12:23 PM
Battala Durganjaneyulu
Battala Durganjaneyulu - avatar
+ 3
Bryan Gustavo Vargas hi, You have few typos in your js. The console messages could have point you towards them. Look closely at how you spell the word "random", once corrected, you'll have another error an you should be able to solve it (hint: it's about camelCase).
8th Aug 2020, 8:56 PM
EmmanueLZ.
EmmanueLZ. - avatar
8th Aug 2020, 9:00 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
So??
8th Aug 2020, 9:01 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
Did you figure out for the second one ?
8th Aug 2020, 9:04 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 3
Doesn't it tell me that the get is wrong?
8th Aug 2020, 9:05 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
You help me??
8th Aug 2020, 9:05 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
Sorry I don't understand the "get" reference. In the console, you'll see an error , it gives you the line number and the message refeer to the code. It could be many reasons, but in your case it is about camelCase notation.
8th Aug 2020, 9:09 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 3
You get it ? getElementById in camelCase...
8th Aug 2020, 9:14 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 3
I do not understand?
8th Aug 2020, 9:14 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
Do you speak Spanish?
8th Aug 2020, 9:16 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 3
Si, in poco. En su código en la línea 12, no reconoce la función getElementByid porque tienes que respectar la sensibilidad al notation. Debes escribir getElementById, con un "i" Major/capital.
8th Aug 2020, 9:21 PM
EmmanueLZ.
EmmanueLZ. - avatar
+ 3
Si ya estoy en eso nada más que no se mueve.
8th Aug 2020, 9:22 PM
Bryan Gustavo Vargas Madrigal
Bryan Gustavo Vargas Madrigal - avatar
+ 2
Cuando está bloquea como este, puedes poner algunas console.log() en su código para entiender lo que se pasa. Por ejemplo, detrás de su línea: width= window.innerwidth; console.log(width); // undefined Así puede ver que hay una cosa que no es correcto,pues espera una número y no undefined....
8th Aug 2020, 9:40 PM
EmmanueLZ.
EmmanueLZ. - avatar