I-See 論壇 » 網上日記區 » XANGA專區 » 愛情指數計算語法..*

2007-10-2 05:54 PM S!u`K!`=)
愛情指數計算語法..*

吾知大家見過未.33.`
呢個系比你打個名落去., 之後計算出愛情指數*


[quote]
<font size=5><script language=javascript>
<!--
function calc() {
first = document.loveform.name1.value.toUpperCase();
firstlength = document.loveform.name1.value.length;
second = document.loveform.name2.value.toUpperCase();
secondlength = document.loveform.name2.value.length;
var LoveCount=0;
for (Count=0; Count < firstlength; Count++) {
letter1=first.substring(Count,Count+1);
if (letter1=='C') LoveCount+=3;
if (letter1=='U') LoveCount+=3;
if (letter1=='P') LoveCount+=1;
if (letter1=='I') LoveCount+=2;
if (letter1=='D') LoveCount+=2;
if (letter1=='E') LoveCount+=1;
if (letter1=='Q') LoveCount+=1;
}
for (Count=0; Count < secondlength; Count++) {
letter2=second.substring(Count,Count+1);
if (letter2=='V') LoveCount+=2;
if (letter2=='E') LoveCount+=4;
if (letter2=='N') LoveCount+=1;
if (letter2=='U') LoveCount+=2;
if (letter2=='S') LoveCount+=1;
if (letter2=='I') LoveCount+=1;
if (letter2=='Q') LoveCount+=3;
}
amount=0;
if (LoveCount> 0) amount= 5-((firstlength+secondlength)/2)
if (LoveCount> 2) amount= 10-((firstlength+secondlength)/2)
if (LoveCount> 4) amount= 20-((firstlength+secondlength)/2)
if (LoveCount> 6) amount= 30-((firstlength+secondlength)/2)
if (LoveCount> <img src=http://www.hkp2pforum.com/molokmo/emoticons/smile.gif alt="Smile"> amount= 40-((firstlength+secondlength)/2)
if (LoveCount>10) amount= 50-((firstlength+secondlength)/2)
if (LoveCount>12) amount= 60-((firstlength+secondlength)/2)
if (LoveCount>14) amount= 70-((firstlength+secondlength)/2)
if (LoveCount>16) amount= 80-((firstlength+secondlength)/2)
if (LoveCount>18) amount= 90-((firstlength+secondlength)/2)
if (LoveCount>20) amount=100-((firstlength+secondlength)/2)
if (LoveCount>22) amount=110-((firstlength+secondlength)/2)
if (firstlength==0 || secondlength==0) amount= "Err";
if (amount < 0) amount= 0;
if (amount >99) amount=99;
document.loveform.output.value=amount+"%";
}
-->
</script>
<center>
 <table width="185" border="1" cellspacing="0" cellpadding="5" bordercolor="#FF80FF">
  <tr>
   <td bgcolor="#FFBFFF">
<form name=loveform>
<br>
<center>
<input name=name1 size=21 value=請輸入您自己的英文姓名>
<br><br>
<input name=name2 size=21 value=請輸入您朋友的英文姓名>
<br><br>
<input type=button name=calculate onClick=calc() value=開始計算>
<br><br>
<input name=output size=7 value=愛情指數>
</center>
</form>
   </td>
  </tr>
 </table>
</center></font>[/quote]

2007-10-2 09:17 PM ShellLeung
THX FOR SHARING!~

2007-11-25 09:44 PM tommyltk
咁得意...試下先~ thx~

頁: [1]
查看完整版本: 愛情指數計算語法..*


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.