HomeОбразованиеRelated VideosMore From: DarkCode

Random Color Generator Using JavaScript

122 ratings | 2456 views
join our group in facebook https://www.facebook.com/groups/704904666369941/ like our page https://www.facebook.com/darkcode0/ Paypal Donation Link https://paypal.me/YBenlachheb _Music___ Music Name : Disfigure - Blank (HYLO Remix) NCS Release Music Link : https://www.youtube.com/watch?v=g04nYW6Y7wE Artist Social Networks : [Hylo] • https://soundcloud.com/itshylo • https://twitter.com/itshylo • https://facebook.com/itshylo
Html code for embedding videos on your blog
Text Comments (15)
HugsForDrugs? (20 days ago)
My background isnt changing color, please help code: <!DOCTYPE html> <html lang="eng"> <head> <meta charset="utf-8"> <title>Random Color Generator</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="color"> <span id="hex">#e74c3c</span> <button onclick>Get New Color</button> </div> <script type="text/javascript"> function getNewColor() { var symbols,color; symbols ="0123456789ABCDEF"; color = "#"; for(var i =0;i<6;i++) { color = color + symbols[Math.floor(Math.random() * 16)]; } document.body.style.background = color; } </script> </body> </html>
DarkCode (19 days ago)
you have a problem in your code line 11 write the getnewcolor function in oneclick event like this <button onclick="getNewColor()">Get New Color</button>
Jonathan Guzmán V (1 month ago)
Como siempre grande 👏✌🇨🇷
Shitty Code (1 month ago)
Great videos and thanks for your undertitle. Was helpful :)
Shitty Code (1 month ago)
+DarkCode hey could you make a cool doble sidebar like a small one with just icons and a larger one that opens up after a click on that icon? Like in vscode. Would really appreaciate it mate!!!
DarkCode (1 month ago)
Welcome brother
net imeni (3 months ago)
Cool)
HTML & CSS Tutorials (8 months ago)
Can you provide a link to the source code, bro?
Sajad R (8 months ago)
i can't some you can help me HTML <!DOCTYPE html> <html> <head> <meta charset="urf-8"> <title>random color</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="color"> <span id="hex">#e74c3c</span> <button onclick="getNewColor()">Get New Color</button> </div> <script type="text/javascript"> function getNewColor() { var symbols,color(){ symbols = "0123456789ABCDEF"; color ="#"; for(var i =0;i<6;i++){ color = color + symbols[Math.floor(Math.random() *16)]; } document.body.style.background = color; document.getElemenById("hex").innerHTML = color; } </script> </body> </html> CSS body{ margin: 0; padding: 0; background: #e74c3c; font-family: "Montserrat"; } .color{ margin-top: 300px; text-align: center; } #hex{ display: block; color: white; font-size: 40px; text-transform: uppercase; margin: 20px; } .color button{ background: none; outline: none; color: white; border: 3px solid white; cursor: pointer; font-size: 24px; } plz help Thank you.
DarkCode (8 months ago)
you are welcome bro
Sajad R (8 months ago)
Thank you very much This is my project. https://vimeo.com/261628590
DarkCode (8 months ago)
and in the last line in java script code write getElementById not getElemenById you Forget " T "
DarkCode (8 months ago)
look in java script code in the third line you should remove brackets write like this var symbols,color;
Thanks man, you are the best of the best ! :-)
Brian BG (8 months ago)
EXCELENTE VIDEO VEO TUS VIDEOS SON MUY BUENOS SALUDOS DESDE: COLOMBIA!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.