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


    Javascript error pada sesetengah browser... WHY?

    Share

    cixent
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 44
    Age : 27
    Location : Tumpat, Kelantan
    Job/hobbies : Jobless
    Registration date : 08/04/2009

    Javascript error pada sesetengah browser... WHY?

    Post by cixent on Mon Nov 23, 2009 6:13 pm

    Guys... tulung.. pe masalah javascript aku

    Code:
    <script>

    function check_ht(teacher_id) {
    htv = document.getElementById(teacher_id).value
    if ( htv == "0" ) {
    document.getElementById("ht_error").value=1
    if ( !document.getElementById("ht_error_msg") ) {
    generate_error("home_teacher_error_container","***Sila pilih guru tingkatan","ht_error_msg")
    }
    check_all_form()
    }
    if ( htv != "0" ) {
    document.getElementById("ht_error").value=0
    if ( document.getElementById("ht_error_msg") ) {
    remove_sub("home_teacher_error_container","ht_error_msg")
    }
    check_all_form()
    }
    }



    function expand(sid) {
    esid = "subject_sub_"+sid
    total_sub = document.getElementById("total_subject").value
    cnum = 1
    while ( cnum <= total_sub ) {
    if ( document.getElementById("sub_"+cnum).checked == true ) {
    if ( sid == cnum ) {
    document.getElementById("subject_sub_"+cnum).style.height="auto"
    document.getElementById("subject_sub_"+cnum).style.overflow="visible"
    document.getElementById("subject_sp_sub_"+cnum).style.background="url('images/tab_on.jpg')"
    document.getElementById("subject_name_sub_"+cnum).style.background="url('images/tab_on.jpg')"
    document.getElementById("subject_info_sub_"+cnum).style.background="url('images/tab_on.jpg')"
    }
    if ( sid != cnum ) {
    document.getElementById("subject_sub_"+cnum).style.height="0px"
    document.getElementById("subject_sub_"+cnum).style.overflow="hidden"
    document.getElementById("subject_sp_sub_"+cnum).style.background = "#00CCFF"
    document.getElementById("subject_name_sub_"+cnum).style.background = "#00CCFF"
    document.getElementById("subject_info_sub_"+cnum).style.background = "#00CCFF"
    }

    }
    cnum++
    }
    }


    function create_box(sub_form) {
    i = '"'
    total = document.getElementById("form_"+sub_form+"_total").value
    total++
    new_id = total
    new_grade = "div_gred_"+sub_form+"_"+new_id
    new_min = "div_min_"+sub_form+"_"+new_id
    new_max = "div_max_"+sub_form+"_"+new_id
    new_purata = "div_gp_"+sub_form+"_"+new_id
    generate_box("form_gred_"+sub_form+"_container", "<br /><input maxlength='2' onKeyUp='check_gred_error("+i+sub_form+i+")' name='gred_"+sub_form+"_"+new_id+"' id='gred_"+sub_form+"_"+new_id+"' type='text' style='width: 60px; text-align: center;' />", new_grade)
    generate_box("form_min_"+sub_form+"_container", "<br /><input onKeyUp='check_valid_num("+i+sub_form+i+","+i+"min"+i+")' name='min_"+sub_form+"_"+new_id+"' id='min_"+sub_form+"_"+new_id+"' type='text' style='width: 60px; text-align: center;' />", new_min)

    generate_box("form_max_"+sub_form+"_container", "<br /><input onKeyUp='check_valid_num("+i+sub_form+i+","+i+"max"+i+")' name='max_"+sub_form+"_"+new_id+"' id='max_"+sub_form+"_"+new_id+"' type='text' style='width: 60px; text-align: center;' />", new_max)

    generate_box("form_gp_"+sub_form+"_container", "<br /><input maxlength='2' onKeyUp='check_gp("+i+sub_form+i+")' name='gp_"+sub_form+"_"+new_id+"' id='gp_"+sub_form+"_"+new_id+"' type='text' style='width: 60px; text-align: center;' />", new_purata)
    document.getElementById("form_"+sub_form+"_total").value=new_id
    }

    function generate_box(container,code,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("div")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }

    function check_sub(sub_id) {
    if ( document.getElementById("sub_"+sub_id).checked == true ) {
    sub_name = document.getElementById("sub_"+sub_id+"_name").value
    create_new_sub(sub_id, sub_name)
    }
    if ( document.getElementById("sub_"+sub_id).checked == false ) {
    erase_sub("sub_"+sub_id)
    remove_a_copy("sub_"+sub_id)
    }

    }

    function erase_sub(sub_id) {
    remove_sub("subject_container", "menu_sub_"+sub_id)
    remove_sub("form_container", "subject_"+sub_id)
    check_all_form()
    }

    function remove_sub(container,did) {
    var rdc = document.getElementById(container)
    var rc = document.getElementById(did)
    rdc.removeChild(rc)
    }

    function create_new_sub(sub_num, sub_name) {
    i = '"'
    sub_id = "sub_"+sub_num
    menu_container = "<table style='width: 100%'><tr><td id='subject_sp_"+sub_id+"' style='cursor: pointer; width: 9px; background: #00CCFF;' onclick='expand("+i+sub_num+i+")'>&nbsp;</td><td id='subject_name_"+sub_id+"' style='cursor: pointer; width: 180px; background: #00CCFF;' onclick='expand("+i+sub_num+i+")'>"+sub_name+"</td><td style='background: #00CCFF;' id='subject_info_"+sub_id+"'><center><img id='menu_"+sub_id+"_info' src='images/form_ko.gif' width='15' height='15' /></center></td></tr></table>"
    for_form_container = "<div id='subject_"+sub_id+"' style='height: 0px; overflow: visible;'><input id='form_"+sub_id+"_gred' value='1' type='hidden' /><input id='form_"+sub_id+"_min_max' value='1' type='hidden' /><input id='form_"+sub_id+"_mark' value='1' type='hidden' /><input id='form_"+sub_id+"_gp' value='1' type='hidden' /><input id='form_"+sub_id+"_teacher' value='1' type='hidden' /><input id='form_"+sub_id+"_uncomplete' value='1' type='hidden' /><input id='form_"+sub_id+"_blank' value='1' type='hidden' /><input id='form_"+sub_id+"_error' value='1' type='hidden' /><input id='form_"+sub_id+"_total' name='form_"+sub_id+"_total' value='1' type='hidden' /><div id='form_error_"+sub_id+"' style='color: #FF0000; height: auto; overflow: visible;'></div><table style='width: 100%'><tr><td style='width: 138px'>Mata pelajaran</td><td style='width: 29px'>:</td><td>"+sub_name+"</td></tr><tr><td style='width: 138px'>Guru</td><td style='width: 29px'>:</td><td><select onChange='check_teacher("+i+sub_id+i+")' id='form_teacher_"+sub_id+"' name='form_teacher_"+sub_id+"' style='width: 429px'><option value='0' selected='selected'>Sila pilih guru yang mengajar</option></select>&nbsp;</td></tr><tr><td style='width: 138px'>Salin dari subjek</td><td style='width: 29px'>:</td><td id='form_copy_container_'"+sub_id+"><select onChange='copy_to("+i+sub_id+i+","+i+"form_copy_"+sub_id+i+")' id='form_copy_"+sub_id+"' style='width: 150px'><option value='0' selected='selected'>Sila pilih subjek</option></select></td></tr></table><br /><table style='width: 800px'><tr><td>&nbsp;</td></tr><tr><td style='height: 91px; width: 500px' valign='top'><table style='width: 100%'><tr><td><table style='text-align: center'><tr><td style='width: 100px'>Gred</td><td style='width: 100px'>Minima</td><td style='width: 100px'>Maksima</td><td style='width: 100px'>Gred purata</td></tr><tr><td id='form_gred_"+sub_id+"_container' style='height: Auto; width: 100px'><div id='div_gred_"+sub_id+"_1'><br /><input maxlength='2' onKeyUp='check_gred_error("+i+sub_id+i+")' name='gred_"+sub_id+"_1' id='gred_"+sub_id+"_1' type='text' style='width: 60px; text-align: center;' /></div></td><td id='form_min_"+sub_id+"_container' style='height: Auto; width: 100px'><div id='div_min_"+sub_id+"_1'><br /><input onKeyUp='check_valid_num("+i+sub_id+i+","+i+"min"+i+")' name='min_"+sub_id+"_1' id='min_"+sub_id+"_1' type='text' style='width: 60px; text-align: center;' /></div></td><td id='form_max_"+sub_id+"_container' style='height: Auto; width: 100px'><div id='div_max_"+sub_id+"_1'><br /><input onKeyUp='check_valid_num("+i+sub_id+i+","+i+"max"+i+")' name='max_"+sub_id+"_1' id='max_"+sub_id+"_1' type='text' style='width: 60px; text-align: center;' /></div></td><td id='form_gp_"+sub_id+"_container' style='height: Auto; width: 100px'><div id='div_gp_"+sub_id+"_1'><br /><input maxlength='2' onKeyUp='check_gp("+i+sub_id+i+")' name='gp_"+sub_id+"_1' id='gp_"+sub_id+"_1' type='text' style='width: 60px; text-align: center;' /></div></td></tr></table></td><td style='width: 100px; text-align: center; vertical-align: top'><br /><input onclick='create_box("+i+sub_id+i+")'  name='Button1' type='button' value='Tambah' />&nbsp;</td></tr></table></td><td style='height: 91px' valign='top'></td></tr></table></div>"
    generate_new_sub_menu('subject_container', menu_container, 'menu_sub_'+sub_id)
    generate_new_sub('form_container', for_form_container, 'subject_'+sub_id)
    generate_teacher_list('form_teacher_'+sub_id)
    myArray = sub_id.split("_")
    sub_num = myArray[1]
    expand(sub_num)
    insert_copy(sub_id)
    check_all_form()

    }

    function insert_copy(form_field) {
    total_subject = document.getElementById("total_subject").value
    c_n = 1
    while ( c_n <= total_subject ) {
    if ( document.getElementById("sub_"+c_n).checked == true ) {
    if ( document.getElementById("form_sub_"+c_n+"_error").value == 0 ) {
    sub_name = document.getElementById("sub_"+c_n+"_name").value
    if ( !document.getElementById("copy_subject_"+form_field+"_sub_"+c_n) ) {
    generate_new_copy("form_copy_"+form_field,sub_name,"copy_subject_"+form_field+"_sub_"+c_n)
    }
    document.getElementById("copy_subject_"+form_field+"_sub_"+c_n).value="sub_"+c_n

    }
    }
    c_n++
    }
    }


    function copy_to(form_field,select) {
    i = '"'
    total = document.getElementById("form_"+form_field+"_total").value
    from_id = document.getElementById(select).value
    total_from = document.getElementById("form_"+from_id+"_total").value
    //remove all exist gred field
    g_num = 1
    while ( g_num <= total ) {
    remove_sub("form_gred_"+form_field+"_container", "div_gred_"+form_field+"_"+g_num)
    remove_sub("form_min_"+form_field+"_container", "div_min_"+form_field+"_"+g_num)
    remove_sub("form_max_"+form_field+"_container", "div_max_"+form_field+"_"+g_num)
    remove_sub("form_gp_"+form_field+"_container", "div_gp_"+form_field+"_"+g_num)
    g_num++
    }
    //create new gred field with copied value
    c_num = 1
    new_id = 0
    while ( c_num <= total_from ) {
    gred = document.getElementById("gred_"+from_id+"_"+c_num).value
    min = document.getElementById("min_"+from_id+"_"+c_num).value
    max = document.getElementById("max_"+from_id+"_"+c_num).value
    gp = document.getElementById("gp_"+from_id+"_"+c_num).value
    if ( gred != "" && min != "" && max != "" && gp != "" ) {
    new_id++
    new_gred = "div_gred_"+form_field+"_"+new_id
    new_min = "div_min_"+form_field+"_"+new_id
    new_max = "div_max_"+form_field+"_"+new_id
    new_gp = "div_gp_"+form_field+"_"+new_id
    generate_box("form_gred_"+form_field+"_container", "<br /><input maxlength='1' onKeyUp='check_gred_error("+i+form_field+i+")' name='gred_"+form_field+"_"+new_id+"' id='gred_"+form_field+"_"+new_id+"' value='"+gred+"' type='text' style='width: 60px; text-align: center;' />", new_gred)
    generate_box("form_min_"+form_field+"_container", "<br /><input maxlength='3' onKeyUp='check_valid_num("+i+form_field+i+","+i+"min"+i+")' name='min_"+form_field+"_"+new_id+"' id='min_"+form_field+"_"+new_id+"' value='"+min+"' type='text' style='width: 60px; text-align: center;' />", new_min)
    generate_box("form_max_"+form_field+"_container", "<br /><input maxlength='3' onKeyUp='check_valid_num("+i+form_field+i+","+i+"max"+i+")' name='max_"+form_field+"_"+new_id+"' id='max_"+form_field+"_"+new_id+"' value='"+max+"' type='text' style='width: 60px; text-align: center;' />", new_max)
    generate_box("form_gp_"+form_field+"_container", "<br /><input maxlength='2' onKeyUp='check_gp("+i+form_field+i+")' name='gp_"+form_field+"_"+new_id+"' id='gp_"+form_field+"_"+new_id+"' value='"+gp+"' type='text' style='width: 60px; text-align: center;' />", new_gp)
    }
    c_num++
    }
    document.getElementById("form_"+form_field+"_total").value=new_id
    //gather error information
    document.getElementById("form_"+form_field+"_gred").value=document.getElementById("form_"+from_id+"_gred").value
    document.getElementById("form_"+form_field+"_min_max").value=document.getElementById("form_"+from_id+"_min_max").value
    document.getElementById("form_"+form_field+"_gp").value=document.getElementById("form_"+from_id+"_gp").value
    document.getElementById("form_"+form_field+"_mark").value=document.getElementById("form_"+from_id+"_mark").value
    document.getElementById("form_"+form_field+"_uncomplete").value=document.getElementById("form_"+from_id+"_uncomplete").value
    document.getElementById("form_"+form_field+"_blank").value=document.getElementById("form_"+from_id+"_blank").value
    check_form_error(form_field)

    }


    function generate_teacher_list(form_id) {
    var t_array = new Array (
    //function 1
    <?php
    listTeacher('TEACHER_NAME',$myYear);
    ?>
    )
    var id_array = new Array (
    <?php
    listTeacher('TEACHER_ID',$myYear);
    ?>
    )
    c_num = 0
    while ( c_num < id_array.length ) {
    generate_new_option(form_id,t_array[c_num],id_array[c_num],form_id+"_"+id_array[c_num])
    c_num++
    }
    }

    function generate_new_option(container,t_name,t_id,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("option")
    cd.setAttribute('value', t_id)
    cd.setAttribute('id', did)
    cd.innerHTML = t_name
    gd.appendChild(cd)
    document.getElementById(did)
    }


    function generate_new_sub_info(container,code,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("div")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }


    function generate_new_sub_menu(container,code,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("div")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }


    function generate_new_sub(container,code,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("div")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }

    function generate_error(container,code,did) {
    var gd = document.getElementById(container)
    var cd = document.createElement("div")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }

    function check_teacher(form_field) {
    tid = document.getElementById("form_teacher_"+form_field).value
    if ( tid == "0" ) {
    if ( !document.getElementById("form_error_teacher_"+form_field) ) {
     generate_error("form_error_"+form_field,"Sila pilih guru mata pelajaran","form_error_teacher_"+form_field)
     }
     document.getElementById("form_"+form_field+"_teacher").value=1
     check_form_error(form_field)
     }
    if ( tid != "0" ) {
    if ( document.getElementById("form_error_teacher_"+form_field) ) {
     remove_sub("form_error_"+form_field,"form_error_teacher_"+form_field)
     }
     document.getElementById("form_"+form_field+"_teacher").value=0
     check_form_error(form_field)
    }
    }


    //check gred for containing any restricted symbol or number
    function check_gred_error(form_field) {
    if ( check_gred_chr(form_field) == false ) {
    //generate an error notice
    if ( !document.getElementById("form_error_gred_"+form_field) ) {
     generate_error("form_error_"+form_field,"Hanya abjad berhuruf besar sahaja dibenarkan pada ruangan 'Gred'","form_error_gred_"+form_field)
     }
     document.getElementById("form_"+form_field+"_gred").value=1
     check_form_error(form_field)
     }
    if ( check_gred_chr(form_field) == true ) {
    if ( document.getElementById("form_error_gred_"+form_field) ) {
     remove_sub("form_error_"+form_field,"form_error_gred_"+form_field)
     }
     document.getElementById("form_"+form_field+"_gred").value=0
    if ( check_uncomplete_field(form_field) == false ) {
    if ( !document.getElementById("form_error_uncomplete_"+form_field) ) {
     generate_error("form_error_"+form_field,"Terdapat ruangan yang diisi tidak penuh","form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=1
     check_form_error(form_field)
     }
    if ( check_uncomplete_field(form_field) == true ) {
    if ( document.getElementById("form_error_uncomplete_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=0
    if ( check_blank(form_field) == false ) {
    if ( !document.getElementById("form_error_blank_"+form_field) ) {
     generate_error("form_error_"+form_field,"Sila isi maklumat pada ruangan pemarkahan","form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=1
     check_form_error(form_field)
     }
    if ( check_blank(form_field) == true ) {
    if ( document.getElementById("form_error_blank_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=0
    check_form_error(form_field)
     }
     }

    }
    }

    function check_gp(form_field) {
    if ( gp_validate(form_field) == false ) {

    if ( !document.getElementById("form_error_gp_"+form_field) ) {
     generate_error("form_error_"+form_field,"Hanya anka sahaja yang dibenarkan pada ruangan 'Gred purata'","form_error_gp_"+form_field)
     }
     document.getElementById("form_"+form_field+"_gp").value=1
     check_form_error(form_field)
     }

    if ( gp_validate(form_field) == true ) {
    if ( document.getElementById("form_error_gp_"+form_field) ) {
     remove_sub("form_error_"+form_field,"form_error_gp_"+form_field)
     }
     document.getElementById("form_"+form_field+"_gp").value=0
    if ( check_uncomplete_field(form_field) == false ) {
    if ( !document.getElementById("form_error_uncomplete_"+form_field) ) {
     generate_error("form_error_"+form_field,"Terdapat ruangan yang diisi tidak penuh","form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=1
     check_form_error(form_field)
     }
    if ( check_uncomplete_field(form_field) == true ) {
    if ( document.getElementById("form_error_uncomplete_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=0
    if ( check_blank(form_field) == false ) {
    if ( !document.getElementById("form_error_blank_"+form_field) ) {
     generate_error("form_error_"+form_field,"Sila isi maklumat pada ruangan pemarkahan","form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=1
     check_form_error(form_field)
     }
    if ( check_blank(form_field) == true ) {
    if ( document.getElementById("form_error_blank_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=0
    check_form_error(form_field)
     }
     }

    }
    }


    function gp_validate(form_field) {
    total_field = document.getElementById("form_"+form_field+"_total").value
    c_n = 1
    while ( c_n <= total_field ) {
    if ( document.getElementById("gp_"+form_field+"_"+c_n).value != "" ) {
    c_value = document.getElementById("gp_"+form_field+"_"+c_n).value
    c_length = c_value.length
    c_sn = 0
    pattern = /\d/
    while ( c_sn < c_length ) {
    c_s = c_value.charAt(c_sn)
    if ( pattern.exec(c_s) == null ) { return false }
    c_sn++
    }

    }
    c_n++
    }
    return true
    }


    function check_form_error(form_id) {
    gred = document.getElementById("form_"+form_id+"_gred").value
    min_max = document.getElementById("form_"+form_id+"_min_max").value
    gp = document.getElementById("form_"+form_id+"_gp").value
    mark = document.getElementById("form_"+form_id+"_mark").value
    uncomplete = document.getElementById("form_"+form_id+"_uncomplete").value
    blank = document.getElementById("form_"+form_id+"_blank").value
    teacher = document.getElementById("form_"+form_id+"_teacher").value
    if ( gred == "0" && min_max == "0" && gp == "0" && mark == "0" && uncomplete == "0" && blank == "0" && teacher == "0" ) {
    document.getElementById("menu_"+form_id+"_info").src="images/form_ok.gif"
    document.getElementById("form_"+form_id+"_error").value=0
    insert_new_copy(form_id)
    check_all_form()
    }
    if ( gred == "1" || min_max == "1" || gp == "1" || mark == "1" || uncomplete == "1" || blank == "1" || teacher == "1" ) {
    document.getElementById("menu_"+form_id+"_info").src="images/form_ko.gif"
    document.getElementById("form_"+form_id+"_error").value=1
    remove_a_copy(form_id)
    check_all_form()
    }

    }

    function check_all_form() {
    error = "0"
    total_subject = document.getElementById("total_subject").value
    c_n = "1"
    c_num = "0"
    while ( c_n <= total_subject ) {
    if ( document.getElementById("sub_"+c_n).checked == true ) {
    c_num++
    if ( document.getElementById("form_sub_"+c_n+"_error").value == "1" ) { error = "1" }
    }
    c_n++
    }
    if ( c_num == "0" ) {
    document.getElementById("submit").disabled=true
    return;
    }
    if ( document.getElementById("ht_error").value == "1" ) {
    error = "1"
    }
    if ( error == "0" ) {
    document.getElementById("submit").disabled=false
    }
    if ( error == "1" ) {
    document.getElementById("submit").disabled=true
    }
    }

    function insert_new_copy(form_field) {
    total_subject = document.getElementById("total_subject").value
    c_n = 1
    while ( c_n <= total_subject ) {
    if ( document.getElementById("sub_"+c_n).checked == true ) {
    if ( "sub_"+c_n != form_field ) {
    c_sub = "sub_"+c_n
    sub_name = document.getElementById(form_field+"_name").value
    if ( !document.getElementById("copy_subject_"+c_sub+"_"+form_field) ) {
    generate_new_copy("form_copy_"+c_sub,sub_name,"copy_subject_"+c_sub+"_"+form_field)
    }
    document.getElementById("copy_subject_"+c_sub+"_"+form_field).value=form_field
    }
    }
    c_n++
    }
    }


    function remove_a_copy(form_field) {
    total_subject = document.getElementById("total_subject").value
    c_n = 1
    while ( c_n <= total_subject ) {
    if ( document.getElementById("sub_"+c_n).checked == true ) {
    if ( "sub_"+c_n != form_field ) {
    c_sub = "sub_"+c_n
    if ( document.getElementById("copy_subject_"+c_sub+"_"+form_field) ) {
    remove_sub("form_copy_"+c_sub,"copy_subject_"+c_sub+"_"+form_field)
    }
    }
    }
    c_n++
    }

    }

    function generate_new_copy(container,code,did) {
    action = "copy_from('from','to')"
    var gd = document.getElementById(container)
    var cd = document.createElement("option")
    cd.setAttribute('id', did)
    cd.innerHTML = code
    gd.appendChild(cd)
    document.getElementById(did)
    }



    function check_gred_chr(form_id) {
    pattern = /[A-Z]/
    pattern2 = /\d/
    total_field = document.getElementById("form_"+form_id+"_total").value
    i = 1
    while ( i <= total_field ) {
    if ( document.getElementById("gred_"+form_id+"_"+i).value != "" ) {
    c_value = document.getElementById("gred_"+form_id+"_"+i).value
    total = c_value.length
    current = 1
    while ( current <= total ) {
    c_v = c_value.charAt(current-1)
    if ( pattern.exec(c_v) == null && pattern2.exec(c_v) == null && c_v != "+" && c_v != "-" ) { return false }
    if ( c_v == " " ) { return false }
    current++
    }
    }
    i++
    }
    return true
    }

    function check_valid_num(form_field,type) {
    if ( validate_num(form_field,type) == false ) {
    //generate an error notice
    if ( !document.getElementById("form_error_"+type+"_"+form_field) ) {
     generate_error("form_error_"+form_field,"Hanya nombor sahaja dibenarkan pada ruangan '"+type+"'","form_error_"+type+"_"+form_field)
     }
     document.getElementById("form_"+form_field+"_min_max").value=1
     check_form_error(form_field)
     }
    if ( validate_num(form_field,type) == true ) {
    if ( document.getElementById("form_error_"+type+"_"+form_field) ) {
     remove_sub("form_error_"+form_field,"form_error_"+type+"_"+form_field)
     }
      document.getElementById("form_"+form_field+"_min_max").value=0
    if ( check_min_max(form_field) == false ) {
    if ( !document.getElementById("form_error_mark_"+form_field) ) {
     generate_error("form_error_"+form_field,"Markah minima dan maksima masik tidak sepadan","form_error_mark_"+form_field)
    }
    document.getElementById("form_"+form_field+"_mark").value=1
     check_form_error(form_field)
    }
    if ( check_min_max(form_field) == true ) {
    if ( document.getElementById("form_error_mark_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_mark_"+form_field)
    }
    document.getElementById("form_"+form_field+"_mark").value=0
    if ( check_uncomplete_field(form_field) == false ) {
    if ( !document.getElementById("form_error_uncomplete_"+form_field) ) {
     generate_error("form_error_"+form_field,"Terdapat ruangan yang diisi tidak penuh","form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=1
     check_form_error(form_field)
     }
    if ( check_uncomplete_field(form_field) == true ) {
    if ( document.getElementById("form_error_uncomplete_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_uncomplete_"+form_field)
    }
    document.getElementById("form_"+form_field+"_uncomplete").value=0
    if ( check_blank(form_field) == false ) {
    if ( !document.getElementById("form_error_blank_"+form_field) ) {
     generate_error("form_error_"+form_field,"Sila isi maklumat pada ruangan pemarkahan","form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=1
     check_form_error(form_field)
     }
    if ( check_blank(form_field) == true ) {
    if ( document.getElementById("form_error_blank_"+form_field) ) {
    remove_sub("form_error_"+form_field,"form_error_blank_"+form_field)
    }
    document.getElementById("form_"+form_field+"_blank").value=0
    check_form_error(form_field)
     }
     }
    }
    }
    }

    function check_blank(form_field) {
    error = 1
    total_field = document.getElementById("form_"+form_field+"_total").value
    c_n = 1
    while ( c_n <= total_field ) {
    gred = document.getElementById("gred_"+form_field+"_"+c_n).value
    min = document.getElementById("min_"+form_field+"_"+c_n).value
    max = document.getElementById("max_"+form_field+"_"+c_n).value
    gp = document.getElementById("gp_"+form_field+"_"+c_n).value
    if ( gred != "" || min != "" || max != "" || gp != "" ) {
    error = 0
    }
    c_n++
    }
    if ( error == 0 ) { return true }
    if ( error == 1 ) { return false }
    }

    function check_uncomplete_field(form_field) {
    error = 0
    total_field = document.getElementById("form_"+form_field+"_total").value
    c_n = 1
    while ( c_n <= total_field ) {
    gred = document.getElementById("gred_"+form_field+"_"+c_n).value
    min = document.getElementById("min_"+form_field+"_"+c_n).value
    max = document.getElementById("max_"+form_field+"_"+c_n).value
    gp = document.getElementById("gp_"+form_field+"_"+c_n).value
    if ( gred != "" || min != "" || max != "" || gp != "" ) {
    if ( gred == "" || min == "" || max == "" || gp == "" ) {
    error = 1
    }
    }
    c_n++
    }
    if ( error == 0 ) { return true }
    if ( error == 1 ) { return false }
    }


    function check_min_max(form_field) {
    total_field = document.getElementById("form_"+form_field+"_total").value
    c_f = 1
    total_mark = 0
    total_count = -1
    while ( c_f <= total_field ) {
    if ( document.getElementById("min_"+form_field+"_"+c_f).value != "" && document.getElementById("max_"+form_field+"_"+c_f).value != "" ) {
    min = document.getElementById("min_"+form_field+"_"+c_f).value
    max = document.getElementById("max_"+form_field+"_"+c_f).value
    total_mark += parseInt(max)-parseInt(min)
    total_count++
    }
    c_f++
    }
    full = 100
    should = parseInt(full)-parseInt(total_count)
    if ( total_mark == should ) { return true }
    if ( total_mark != should ) { return false }
    }



    function validate_num(form_id,type) {
    total_field = document.getElementById("form_"+form_id+"_total").value
    i = 1
    while ( i <= total_field ) {
    if ( document.getElementById(type+"_"+form_id+"_"+i).value != "" ) {
    c_value = document.getElementById(type+"_"+form_id+"_"+i).value
    l = c_value.length
    pattern = /\d/
    c_l = 0
    while ( c_l < l ) {
    c_s = c_value.charAt(c_l)
    if ( pattern.exec(c_s) == null ) { return false }
    c_l++
    }
    }
    i++
    }
    return true
    }

    </script>


    time aku guna wamp kat umah aku.. aku pakai internet explore 8.. javascript tuh berfungsi sepenuhnya.. then bile aku upload kat internet.. aku p cybercafe.. guna internet explore 8.. tapi script tuh rosak... WHYYYY???? tapi firefox elok lak... Sad

    ayoi
    Moderators
    Moderators

    Gender : Male Number of posts : 1090
    Age : 86
    Registration date : 04/03/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by ayoi on Mon Nov 23, 2009 6:43 pm

    b4 tu kat cybercafe mungkin default setting tak enable js/javascript or tak install java environment
    atau takde microsoft script engine atau ada spyware/malware kat CC tu.. biasa la tu....

    tapi kalau i.e ok ...browser lain tak OK.... pakai i.e jelah.. takleh nakwat apa.... tunggu next version/upgrade latest version


    --------------------------------------------
    ku mencuba survey
    Don't break my heart

    cixent
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 44
    Age : 27
    Location : Tumpat, Kelantan
    Job/hobbies : Jobless
    Registration date : 08/04/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by cixent on Mon Nov 23, 2009 6:53 pm

    what?? tunggu? hmmm.. aku nak release tahun depan dah. .sekolah tgh tunggu... waaa..... mau nyer cikgu nak buat pemrkahan pelajar.. tekan2 butan..box x kuar.. habis laa aku.. kene setlekan gak nih... isk2..

    johnburn
    Moderators
    Moderators

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

    Re: Javascript error pada sesetengah browser... WHY?

    Post by johnburn on Mon Nov 23, 2009 6:55 pm

    bleh bg link site yg ko upload tu x?
    nk tgk


    --------------------------------------------

    tahukah kamu saat kamu menangis
    adalah air mata ku yang jatuh berlinang
    tahukah kamu saat kamu tersakiti
    adalah aku yang pertama terluka
    Jangan Klik

    cixent
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 44
    Age : 27
    Location : Tumpat, Kelantan
    Job/hobbies : Jobless
    Registration date : 08/04/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by cixent on Mon Nov 23, 2009 7:00 pm

    okeys..
    http://cixent.hostse.com

    login pakai id
    id = 881227035949
    pass = syazwani

    dah login tuh.. klik "Kelas" pada bahagian pentadbir pastu klik "kelas baru" then isi borang kelas baru.. pastu klik "teruskan" page seterusnya tuh laa javascript error...

    johnburn
    Moderators
    Moderators

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

    Re: Javascript error pada sesetengah browser... WHY?

    Post by johnburn on Mon Nov 23, 2009 7:06 pm

    xkuar error pn javascript tu
    bg screenshot bleh?


    --------------------------------------------

    tahukah kamu saat kamu menangis
    adalah air mata ku yang jatuh berlinang
    tahukah kamu saat kamu tersakiti
    adalah aku yang pertama terluka
    Jangan Klik

    dans kam
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 172
    Age : 35
    Location : Wangsa Maju
    Job/hobbies : PHP
    Registration date : 19/02/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by dans kam on Mon Nov 23, 2009 7:22 pm

    Setakat yang aku pernah kene la kan. error tu sebab Internet Browser tu disablekan javascript. Secara defaultnya IE memang suka mcm tu. Dia akan kuar notification warna kuning, then kita kene klik and enablekan.

    So.... Cadangan aku la kan..
    Baik ko suggest(paksa) cikgu2 tu guna Mozilla Firefox/Chrome.

    Ko bagi la ape2 ape alasan yg patut: safety, ie senang kene virus, sistem penting kene utamakan safety, bla bla bla...
    kalo diorang xnak guna Firefox, guna Google Chrome: lg ringan, google yg buat, safety, bla bla bla...

    ayoi
    Moderators
    Moderators

    Gender : Male Number of posts : 1090
    Age : 86
    Registration date : 04/03/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by ayoi on Mon Nov 23, 2009 7:31 pm

    ok je... aku guna safari dan firefox... siap buat kelas dahlia.... daftar...


    i.e tu je tak betul..... dan install Mse ke.. java....
    kat CC jgn caya sgt.... buat kat umah or pc kawan orr suruh member kat sini test guna i.e
    aku takde i.e.. hehehe..


    --------------------------------------------
    ku mencuba survey
    Don't break my heart

    cixent
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 44
    Age : 27
    Location : Tumpat, Kelantan
    Job/hobbies : Jobless
    Registration date : 08/04/2009

    Nih Dia punya screen shot....

    Post by cixent on Mon Nov 23, 2009 9:29 pm

    Sepatutnya kuar macam nih



    tapi kuar macam nih



    tapi kan.. firefox pun x jadik gak.. yang paling elok cume pc aku sendiri.. IE8, Windows 7
    mati laaa aku... tolong carikan penyelesaian.. macam mana aku nak buat supaya aku punya JS and HTML boleh dibaca oleh minimum version of browser....

    johnburn
    Moderators
    Moderators

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

    Re: Javascript error pada sesetengah browser... WHY?

    Post by johnburn on Mon Nov 23, 2009 9:43 pm

    xleh nk reproduce keadaan tu la
    cube trangkn step by step cmne ko dpt cmtu


    --------------------------------------------

    tahukah kamu saat kamu menangis
    adalah air mata ku yang jatuh berlinang
    tahukah kamu saat kamu tersakiti
    adalah aku yang pertama terluka
    Jangan Klik

    cixent
    Ahli Baharu
    Ahli Baharu

    Gender : Male Number of posts : 44
    Age : 27
    Location : Tumpat, Kelantan
    Job/hobbies : Jobless
    Registration date : 08/04/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by cixent on Mon Nov 23, 2009 9:51 pm

    johnburn..
    aku design web tuh kat pc aku... elok jer aku punya javascript, style sume... aku guna Windows 7 and IE8

    bile aku upload ke web hosting
    web tuh ader masalah.. macam gambar kat atas.. sepatutnya kalau aku tekan checkbox subject.. maka subject tersebut akan kluar gak kat tab subject kat bawah.. bila klik tab subject keluar form pemarkahan untuk subject tersebut.. tapi.. bila aku guna PC lain.. aku klik tab subject x kuar form. just kosong.. javascript plak xder error... xder pun tanda ! kat bawah yg mengatakan javascript error....
    aku tak tahu.. ini masalah javascript atau browser xleh baca dia punya HTML, Style...

    ayoi
    Moderators
    Moderators

    Gender : Male Number of posts : 1090
    Age : 86
    Registration date : 04/03/2009

    Re: Javascript error pada sesetengah browser... WHY?

    Post by ayoi on Tue Nov 24, 2009 3:39 am

    ko design guna reso tinggi sangat tu satu perkara...
    dan auto resize tak berfungsi...

    cuba ko kecik windows browser site putera sementara ni.. text kita dah post akan auto resize sepadat mungkin.
    dan cuba resize windows site ko lak... kecikkan windows... text table tetap macam tu... drop down panjang sgt.


    --------------------------------------------
    ku mencuba survey
    Don't break my heart

    Sponsored content

    Re: Javascript error pada sesetengah browser... WHY?

    Post by Sponsored content Today at 2:03 pm


      Current date/time is Sun Dec 11, 2016 2:03 pm