笨笨網站超級論壇 (綠色版本)


頁: [1]

#1  生肖計算語法 -  (Administrator) 發表於 30-5-2012 11:35

<script type="text/javascript"><!--
function getpet() {
var toyear = 1997;
var birthyear = document.getElementById("inyear".value;
x = (toyear - birthyear) % 12
if ((x == 1) || (x == -11)) {birthpet="鼠"}
else if (x == 0) {birthpet="牛"}
else if ((x == 11) || (x == -1)) {birthpet="虎"}
else if ((x == 10) || (x == -2)) {birthpet="兔"}
else if ((x == 9) || (x == -3)) {birthpet="龍"}
else if ((x == 8) || (x == -4)) {birthpet="蛇"}
else if ((x == 7) || (x == -5)) {birthpet="馬"}
else if ((x == 6) || (x == -6)) {birthpet="羊"}
else if ((x == 5) || (x == -7)) {birthpet="猴"}
else if ((x == 4) || (x == -8)) {birthpet="雞"}
else if ((x == 3) || (x == -9)) {birthpet="狗"}
else if ((x == 2) || (x == -10)) {birthpet="豬"}
else {birthpet="輸入錯誤"}
document.getElementById("birth".innerHTML = birthpet;}
// --></script>
出生年份:<input type="text" size="5" id="inyear" />
<input type="button" value="開始" onclick="getpet()" />
生肖是:<span id="birth"></span>

<BR><BR><BR><BR><BR><BR>

<P><FONT color=blue>&lt;script type="text/javascript"&gt;&lt;!--<BR>function getpet() { <BR>var toyear = 1997; <BR>var birthyear = document.getElementById("inyear".value; <BR>x = (toyear - birthyear) % 12 <BR>if ((x == 1) || (x == -11)) {birthpet="鼠"} <BR>else if (x == 0) {birthpet="牛"} <BR>else if ((x == 11) || (x == -1)) {birthpet="虎"} <BR>else if ((x == 10) || (x == -2)) {birthpet="兔"} <BR>else if ((x == 9) || (x == -3)) {birthpet="龍"} <BR>else if ((x == 8) || (x == -4)) {birthpet="蛇"} <BR>else if ((x == 7) || (x == -5)) {birthpet="馬"} <BR>else if ((x == 6) || (x == -6)) {birthpet="羊"} <BR>else if ((x == 5) || (x == -7)) {birthpet="猴"} <BR>else if ((x == 4) || (x == -8)) {birthpet="雞"} <BR>else if ((x == 3) || (x == -9)) {birthpet="狗"}<BR>else if ((x == 2) || (x == -10)) {birthpet="豬"}<BR>else {birthpet="輸入錯誤"}<BR>document.getElementById("birth".innerHTML = birthpet;}<BR>// --&gt;&lt;/script&gt;<BR>出生年份:&lt;input type="text" size="5" id="inyear" /&gt;<BR>&lt;input type="button" value="開始" onclick="getpet()" /&gt;<BR>生肖是:&lt;span id="birth"&gt;&lt;/span&gt;</FONT></P>
<P><FONT color=#0000ff></FONT> </P>
<P><FONT color=#0000ff></FONT> </P>
<P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=#0000ff size=3></FONT> </P>
<P><FONT color=#0000ff size=3>如不能顯示語法效果可貼去本站</FONT><A href="http://www.bunbun000.com/html/index.htm" target=_blank><FONT color=red size=3>語法測試板</FONT></A><FONT color=#0000ff size=3>試看</FONT></P>

#2  複製上列語法 -  (Administrator) 發表於 25-5-2013 16:28

<form name="copy">
<textarea cols="40" name="txt" rows="4" style="BACKGROUND-COLOR:#ffffff; COLOR:#000000; FONT-SIZE:9pt">
<script type="text/javascript"><!--
function getpet() {
var toyear = 1997;
var birthyear = document.getElementById("inyear".value;
x = (toyear - birthyear) % 12
if ((x == 1) || (x == -11)) {birthpet="鼠"}
else if (x == 0) {birthpet="牛"}
else if ((x == 11) || (x == -1)) {birthpet="虎"}
else if ((x == 10) || (x == -2)) {birthpet="兔"}
else if ((x == 9) || (x == -3)) {birthpet="龍"}
else if ((x == 8) || (x == -4)) {birthpet="蛇"}
else if ((x == 7) || (x == -5)) {birthpet="馬"}
else if ((x == 6) || (x == -6)) {birthpet="羊"}
else if ((x == 5) || (x == -7)) {birthpet="猴"}
else if ((x == 4) || (x == -8)) {birthpet="雞"}
else if ((x == 3) || (x == -9)) {birthpet="狗"}
else if ((x == 2) || (x == -10)) {birthpet="豬"}
else {birthpet="輸入錯誤"}
document.getElementById("birth".innerHTML = birthpet;}
// --></script>
出生年份:<input type="text" size="5" id="inyear" />
<input type="button" value="開始" onclick="getpet()" />
生肖是:<span id="birth"></span>
</textarea><br>
<input onclick="javascript:this.form.txt.focus();this.form.txt.select();" type="button" value="全選">
</form>

<br>

<script type="text/javascript"><!--
google_ad_client = "ca-pub-4078143172638881";
/* 336X280 */
google_ad_slot = "3268225205";
google_ad_width = 336;
google_ad_height = 280;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
頁: [1]

Powered by Discuz Simply! 0.54 Released © wxyuan90