Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>output</title>
- </head>
- <body>
- </script>
- <input type="text" id="input1">
- <span id= 'out'></span>
- <button onclick="work1()">Кнопка</button>
- <p id = "span2"></p>
- <script type="text/javascript">
- function work1() {
- var s1 = document.getElementById('input1').value;
- var s2 = s1.split(' ');
- var s3 = document.getElementById('out');
- s3.innerHTML = s2.length;
- if(s2.length<10){
- s3.style.backgroundColor = "yellow";
- }
- else{
- s3.style.backgroundColor = "white";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement