»
AnglaisFranaisVietnamien

Imprimer - Texte dynamique sur le titre - JavaScriptBank.com

Version complte: jsB@nk » État » Sound » Texte dynamique sur le titre
URL: http://www.javascriptbank.com/dynmic-text-on-title.html

Texte dynamique sur le titre © JavaScriptBank.comSeulement, avec 7 lignes de code, vous pouvez faire titre de vos pages Web scroll à partir de la droite vers la gauche en permanence. Un code court, mais utile.

Version complte: jsB@nk » État » Sound » Texte dynamique sur le titre
URL: http://www.javascriptbank.com/dynmic-text-on-title.html



JavaScript
<script language="javascript">var tongHaiSo;var soLanChon = 0;var dung = 0;var sai = 0;function addTwoRandomNumber(){form1.so1.value = Math.round(Math.random()*18);form1.so2.value = Math.round(Math.random()*(18 - form1.so1.value));tongHaiSo = parseInt(form1.so1.value) + parseInt(form1.so2.value);}function kiemtra(value){if(value == tongHaiSo){form1.trueOrFalse.value = "Ban chon chinh xac";dung +=1;form1.soLanDung.value = dung; soLanChon += 1; }else{form1.trueOrFalse.value = "Ban chon khong chinh xac";sai +=1form1.soLanSai.value = sai; soLanChon += 1;}form1.tyLe.value = ((dung/soLanChon) * 100) + "%";}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<div style="border: 1px solid silver; width: 60%;">  <form name="form1" method="post" action="">    <table width="100%" border="0" cellpadding="2">      <tr>        <td colspan="2">          <input name="sinhSoNgauNhien" type="button" id="sinhSoNgauNhien" value="Make two random numbers have the sum <= 18" onClick="addTwoRandomNumber();" title="Sinh hai số ngẫu nhiên <= 18" />        </td>      </tr>      <tr>        <td>        <label title="Số thứ nhất">Num 1</label>: <input name="so1" type="text" id="so1" />        </td>    <td>    <label title="Số thứ hai">Num 2</label>: <input name="so2" type="text" id="so2" />    </td>      </tr>      <tr>        <td colspan="2">          <p>            <input name="1" type="button" id="1" value="1" onClick="kiemtra(this.value);">            <input name="2" type="button" id="2" value="2" onClick="kiemtra(this.value);">            <input name="3" type="button" id="3" value="3" onClick="kiemtra(this.value);">            <input name="4" type="button" id="4" value="4" onClick="kiemtra(this.value);">            <input name="5" type="button" id="5" value="5" onClick="kiemtra(this.value);">            <input name="6" type="button" id="6" value="6" onClick="kiemtra(this.value);">            <input name="7" type="button" id="7" value="7" onClick="kiemtra(this.value);">            <input name="8" type="button" id="8" value="8" onClick="kiemtra(this.value);">            <input name="9" type="button" id="9" value="9" onClick="kiemtra(this.value);">          </p>          <p>          <input name="10" type="button" id="10" value="10" onClick="kiemtra(this.value);">            <input name="11" type="button" id="11" value="11" onClick="kiemtra(this.value);">            <input name="12" type="button" id="12" value="12" onClick="kiemtra(this.value);">            <input name="13" type="button" id="13" value="13" onClick="kiemtra(this.value);">            <input name="14" type="button" id="14" value="14" onClick="kiemtra(this.value);">            <input name="15" type="button" id="15" value="15" onClick="kiemtra(this.value);">            <input name="16" type="button" id="16" value="16" onClick="kiemtra(this.value);">            <input name="17" type="button" id="17" value="17" onClick="kiemtra(this.value);">            <input name="18" type="button" id="18" value="18" onClick="kiemtra(this.value);">          </p>        </td>      </tr>      <tr>        <td colspan="2">          <input name="trueOrFalse" type="text" id="trueOrFalse" size="50">        </td>      </tr>      <tr>        <td colspan="2">          <table width="100%" border="0" cellpadding="4">            <tr>              <td>              <label title="Số lần đúng">Right choices</label>: <input name="soLanDung" type="text" id="soLanDung"></td>              <td>              <label title="Số lần sai">Wrong choices</label>: <input name="soLanSai" type="text" id="soLanSai"></td>              <td>              <label title="Tỉ lệ">Ratio</label>: <input name="tyLe" type="text" id="tyLe"></td>            </tr>          </table>        </td>      </tr>    </table>  </form></div><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->