Zobrazit stránkuStarší verzeZpětné odkazyNahoru Tato stránka je pouze pro čtení. Můžete si pouze prohlédnout zdrojový kód, ale ne ho měnit. Zeptejte se správce, pokud si myslíte, že něco není v pořádku. <code html> <html> <head> <title></title> </head> <body> <script> </code> <code javascript> function uloha(){ var delkaCesty=parseFloat(document.getElementById('delkaCesty').value); var rychlostMyslivce=parseFloat(document.getElementById('rychlostMyslivce').value); var rychlostZeny=parseFloat(document.getElementById('rychlostZeny').value); var rychlostPsa=parseFloat(document.getElementById('rychlostPsa').value); //vypocteni casu za ktery se setkaji myslivec a zena var cas= delkaCesty / (rychlostMyslivce+rychlostZeny); var drahaPsa = cas * rychlostPsa; /* Vypsani odpovedi slovni ulohy */ var odpoved="Pes ubehl "+drahaPsa+"km"; console.log(odpoved); document.getElementById('reseni').value=odpoved; } </code> <code html> </script> <p> <label for="delkaCesty">Délka cesty</label> <input type="number" id="delkaCesty"> </p> <p> <label for="delkaCesty">Rychlost myslivce</label> <input type="number" id="rychlostMyslivce"> </p> <p> <label for="delkaCesty">Rychlost ženy</label> <input type="number" id="rychlostZeny"> </p> <p> <label for="delkaCesty">Rychlost psa</label> <input type="number" id="rychlostPsa"> </p> <button onclick="uloha()">Uloha</button> <p> <input type="text" id="reseni" disabled="disabled"> </p> </body> </html> </code> uloha/slovni_uloha.txt Poslední úprava: 2023/11/15 20:54autor: 127.0.0.1