Forum Sementara Putera.com

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Forum Sementara Putera.com

Bersama kita perkemaskan forum ini sementara forum asal dalam pemulihan.

Forum putera dah kembali. Masalah sudah berjaya diselesaikan. Sila lawati http://forum.putera.com/tanya


2 posters

    Javascript score mark

    avatar
    emeronyr
    Ahli Baharu
    Ahli Baharu


    Number of posts : 4
    Registration date : 23/08/2009

    Javascript score mark Empty Javascript score mark

    Post by emeronyr Sun Aug 23, 2009 9:54 am

    salam...
    mcm mana ek nak buat Javascript score mark..
    benda ni dah 3 hari sangkut..last2 terpaksa gak masuk forum putera ni...
    Javascript ni aku buat ikut itnet ajer... rasanya Javascript nii ada yg tak kena ... sebab dia tak leh running... heheh

    </script>
    <SCRIPT LANGUAGE=JAVASCRIPT>
    function calc()
    {
    var a = form2.BM1.value;

    var c = (a-0) + ;

    if(c=>80)
    {
    document.write("A");
    }
    else if (c=>60)
    {
    document.write("B");
    }
    else if (c=>40)
    {
    document.write("C");
    }
    else if (c=>20)
    {
    document.write("D");
    }
    else (c=>0)
    {
    document.write("E");

    form2.GRED_BM1.value = c;

    }

    </SCRIPT>

    actuly aku nak buat dia cam ni...

    78 = B
    84 = A

    dsb

    mitak tlg kepada otai2.... salam n tq


    Last edited by emeronyr on Sun Aug 23, 2009 4:10 pm; edited 1 time in total
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    Javascript score mark Empty Re: Javascript score mark

    Post by johnburn Sun Aug 23, 2009 11:29 am

    bley tgk cnth bahagian form die x?
    avatar
    emeronyr
    Ahli Baharu
    Ahli Baharu


    Number of posts : 4
    Registration date : 23/08/2009

    Javascript score mark Empty Re: Javascript score mark

    Post by emeronyr Sun Aug 23, 2009 4:03 pm

    <head>
    <title>kira</title>
    </script>
    <SCRIPT LANGUAGE=JAVASCRIPT>
    function calc()
    {
    var a = form2.BM1.value;

    var c = (a-0) + ;

    if(c=>80)
    {
    document.write("A");
    }
    else if (c=>60)
    {
    document.write("B");
    }
    else if (c=>40)
    {
    document.write("C");
    }
    else if (c=>20)
    {
    document.write("D");
    }
    else (c=>0)
    {
    document.write("E");

    form2.GRED_BM1.value = c;

    }

    </SCRIPT>
    </head>
    <form method="post" name="form2" action="<?php echo $editFormAction; ?>">
    <table width="391" border="1" align="center">
    <tr bgcolor="#99CC66">
    <td><div align="center" class="style21">Mata Pelajaran</div></td>
    <td><div align="center" class="style21">BM 1 </div></td>
    <td><div align="center" class="style21">BM 2 </div></td>
    <td><div align="center" class="style21">BI</div></td>
    <td><div align="center" class="style21">Matematik</div></td>
    <td><div align="center" class="style21">Sains</div></td>
    </tr>
    <tr>
    <td><div align="center" class="style22 style15">
    <div align="center">Markah</div>
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="BM1" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="BM2" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="ENGLISH" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="MATEMATIK" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="SAINS" value="" size="2" />
    </div></td>
    </tr>
    <tr>
    <td><div align="center" class="style22">
    <div align="center">Gred</div>
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="GRED_BM1" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="GRED_BM2" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="GRED_ENGLISH" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="GRED_MATEMATIK" value="" size="2" />
    </div></td>
    <td><div align="center">
    <input onChange="calc()" type="text" name="GRED_SAINS" value="" size="2" />
    </div></td>
    </tr>
    </table>
    <table width="391" border="0" align="center">
    <tr valign="baseline">
    <td width="383" align="right" nowrap="nowrap">
    <div align="right">

    <input type="hidden" name="ID" value="" />
    <input type="hidden" name="UJIAN" value="UPPM1" />
    <input type="hidden" name="USERNAME" value="<?php echo $row_TMurid['USERNAME']; ?>" />
    <input type="hidden" name="KP" value="<?php echo $row_TMurid['NAMA']; ?>" />
    <input type="hidden" name="CATATAN" value="" />
    <input type="hidden" name="MM_insert" value="form2" />
    <input name="Submit" type="submit" onclick="MM_goToURL('parent','ujiankelas.php');return document.MM_returnValue" value="Kembali" />
    <input name="submit" type="submit" value="Simpan" />
    </div></td>
    </tr>
    </table>
    <br />
    &nbsp;<br />
    </form>
    <body>
    </body>
    </html>


    cth yang javascrit aku buat hanya cth utk Textfield BM1 shj.. yg lai2n aku lum uat....
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    Javascript score mark Empty Re: Javascript score mark

    Post by johnburn Sun Aug 23, 2009 6:32 pm

    cube try bt cmni untk javascript tu:
    Code:

    <SCRIPT LANGUAGE=JAVASCRIPT>
    function calc() {
    var a = document.form2.BM1.value;
    var c;
    if (a >= 0 && a < 20) {
    c = "E";
    }
    else if (a >= 20 && a < 40) {
    c = "D";
    }
    else if (a >= 40 && a < 60) {
    c = "C";
    }
    else if (a >= 60 && a < 80) {
    c = "B";
    }
    else if (a >= 80 && a <= 100) {
    c = "A";
    }
    else {
    c = "n/a";
    }
    document.form2.GRED_BM1.value = c;
    }
    </SCRIPT>
    satu lagi, aku rase bek pkai onKeyUp daripada onChange kot
    aku xjamin yg atas tu jd sbb aku x test
    just bt sblom g bazar ramadan Razz
    selamat berbuka puasa hehe
    avatar
    emeronyr
    Ahli Baharu
    Ahli Baharu


    Number of posts : 4
    Registration date : 23/08/2009

    Javascript score mark Empty Re: Javascript score mark

    Post by emeronyr Sun Aug 23, 2009 9:07 pm

    bro... coding javascript tu leh pakai.. n onChange="" pun ok gak..
    dah siap nanti aku paste kan coding tu kat situ.. tapi aku buat cara b*d*h2 ajer..asalkan leh runnig...hehe

    1 lgi bro..

    aku buat cam ni

    if (a >= 0 && a < 20) {
    z = "font color="red" E";
    }
    else if (a >= 20 && a < 40) {
    z = "font color="red" D";
    }

    kiranya E & D font="red"
    tapi tak leh runninglah
    pasal ek..
    johnburn
    johnburn
    Moderators
    Moderators


    Gender : Male Number of posts : 755
    Location : Terengganu
    Registration date : 07/03/2009

    Javascript score mark Empty Re: Javascript score mark

    Post by johnburn Mon Aug 24, 2009 12:08 pm

    beza onkeyup atau onkeydown ngan onchange yg onkeyup @ onkeydown event dia berlaku time user ngah type. yg onchange lak berlaku selepas user kuarkn cursor dr field tu. so ikut ko la hehe

    aku rase ko kne pkai style untk ubah kaler.

    Sponsored content


    Javascript score mark Empty Re: Javascript score mark

    Post by Sponsored content


      Current date/time is Mon Nov 18, 2024 10:31 am