Home >Web Front-end >JS Tutorial >JavaScript background color changes on time_page background

JavaScript background color changes on time_page background

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 19:13:451242browse





Background Color Test

<script> <br>function setcolor() <br>{ <br>var colorString; <br>do{ <br> colorString="#" Math.floor(Math.random()*Math.pow(2,24)).toString(16); <br>} <br>while (colorString.length<7); <br><br>document.getElementById("mydiv").style.backgroundColor=colorString; <br><br>setTimeout(setcolor,100); <BR>} <br><br></script>
< /body>


[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<script> function setcolor() { var colorString; do{ colorString="#"+Math.floor(Math.random()*Math.pow(2,24)).toString(16); } while (colorString.length<7); document.getElementById("mydiv").style.backgroundColor=colorString; setTimeout(setcolor,100); } </script>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn