نمایش نتایج 1 تا 6 از 6

نام تاپیک: مشکل mozilla با جاوا اسکریپت

  1. #1

    مشکل mozilla با جاوا اسکریپت

    سلام دوستان!
    من یک سری کد جاوا اسکریپت توی برنامه گذاشتم که همشون توی IE درست کار می کنن اما تو mozilla اصلا کار نمی کنن. باید چه تغییری بدیم تو کد که توی browserهای دیگه هم کار کنه؟

  2. #2
    کاربر دائمی آواتار alireza_s_84
    تاریخ عضویت
    فروردین 1386
    محل زندگی
    اهواز
    پست
    1,191

    نقل قول: مشکل mozilla با جاوا اسکریپت

    نقل قول نوشته شده توسط cs_mania مشاهده تاپیک
    سلام دوستان!
    من یک سری کد جاوا اسکریپت توی برنامه گذاشتم که همشون توی IE درست کار می کنن اما تو mozilla اصلا کار نمی کنن. باید چه تغییری بدیم تو کد که توی browserهای دیگه هم کار کنه؟
    دوست عزیز بدون اسکریپت که نمیشه گفت باید چکار کنی . شما کدهاتو بذار اینجا تا بچه ها بهت بگن که کجاش توی موزیلا ساپورت نمیشه تا برطرفش کنی
    موفق باشید

  3. #3

    نقل قول: مشکل mozilla با جاوا اسکریپت

    در کل می خواستم بدونم که چه چیزی باعث می شود که جاوا اسکریپت تو mozill کار نمی کنه. اما کدی که برام مهمه یه تقویم فارسیه که با انتخاب اون یه textbox پر می شود :

    کد اسکریپت :

    //////////////////////////////////////////////////////////////
    ///// Jalali (Shamsi) Calendar Date Picker (JavaScript) /////
    ////////////////////////////////////////////////////////////

    var datePickerDivID = "datepicker";
    var iFrameDivID = "datepickeriframe";

    var dayArrayShort = new Array('ش' , 'ی', 'د', 'س', 'چ', 'پ', 'ج');
    var dayArrayMed = new Array('شنبه' , 'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه' , 'پنجشنبه' , 'جمعه');
    var dayArrayLong = dayArrayMed;
    var monthArrayShort = new Array('فروردین','اردیبهشت','خرد د','تیر','مرداد','شهریور','مهر' ,'آبان','آذر','دی','بهمن','اسفند ');
    var monthArrayMed = monthArrayShort;
    var monthArrayLong = monthArrayShort;

    // these variables define the date formatting we're expecting and outputting.
    // If you want to use a different format by default, change the defaultDateSeparator
    // and defaultDateFormat variables either here or on your HTML page.
    var defaultDateSeparator = "/"; // common values would be "/" or "."
    var defaultDateFormat = "ymd" // valid values are "mdy", "dmy", and "ymd"
    var dateSeparator = defaultDateSeparator;
    var dateFormat = defaultDateFormat;

    function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep)
    {
    var targetDateField = document.getElementsByName (dateFieldName).item(0);

    // if we weren't told what node to display the datepicker beneath, just display it
    // beneath the date field we're updating
    if (!displayBelowThisObject)
    displayBelowThisObject = targetDateField;

    // if a date separator character was given, update the dateSeparator variable
    if (dtSep)
    dateSeparator = dtSep;
    else
    dateSeparator = defaultDateSeparator;

    // if a date format was given, update the dateFormat variable
    if (dtFormat)
    dateFormat = dtFormat;
    else
    dateFormat = defaultDateFormat;

    var x = displayBelowThisObject.offsetLeft;
    var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;

    // deal with elements inside tables and such
    var parent = displayBelowThisObject;
    while (parent.offsetParent) {
    parent = parent.offsetParent;
    x += parent.offsetLeft;
    y += parent.offsetTop ;
    }

    drawDatePicker(targetDateField, x, y);
    }

    /**
    Draw the datepicker object (which is just a table with calendar elements) at the
    specified x and y coordinates, using the targetDateField object as the input tag
    that will ultimately be populated with a date.

    This function will normally be called by the displayDatePicker function.
    */
    function drawDatePicker(targetDateField, x, y)
    {
    var dt = getFieldDate(targetDateField.value);

    // the datepicker table will be drawn inside of a <div> with an ID defined by the
    // global datePickerDivID variable. If such a div doesn't yet exist on the HTML
    // document we're working with, add one.
    if (!document.getElementById(datePickerDivID)) {
    // don't use innerHTML to update the body, because it can cause global variables
    // that are currently pointing to objects on the page to have bad references
    //document.body.innerHTML += "<div id='" + datePickerDivID + "' class='dpDiv'></div>";
    var newNode = document.createElement("div");
    newNode.setAttribute("id", datePickerDivID);
    newNode.setAttribute("class", "dpDiv");
    newNode.setAttribute("style", "visibility: hidden;");

    document.body.appendChild(newNode);
    }

    // move the datepicker div to the proper x,y coordinate and toggle the visiblity
    var pickerDiv = document.getElementById(datePickerDivID);
    pickerDiv.style.position = "absolute";
    pickerDiv.style.left = x + "px";
    pickerDiv.style.top = y + "px";
    pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" : "visible");
    pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
    pickerDiv.style.zIndex = 10000000;

    // draw the datepicker table
    refreshDatePicker(targetDateField.name, dt[0], dt[1], dt[2]);
    }


    /**
    This is the function that actually draws the datepicker calendar.
    */
    function refreshDatePicker(dateFieldName, year, month, day)
    {
    // if no arguments are passed, use today's date; otherwise, month and year
    // are required (if a day is passed, it will be highlighted later)
    var thisDay = getTodayPersian();
    var weekday = (thisDay[3] - thisDay[2] + 1)%7;
    if(!day)
    day =1;
    if ((month >= 1) && (year > 0)) {
    thisDay = calcPersian(year,month,1);
    weekday = thisDay[3];
    thisDay = new Array(year,month,day,weekday);
    thisDay[2] = 1;
    } else {
    day = thisDay[2];
    thisDay[2] = 1;
    }

    // the calendar will be drawn as a table
    // you can customize the table elements with a global CSS style sheet,
    // or by hardcoding style and formatting elements below
    var crlf = "\r\n";
    var TABLE = "<table cols='7' class='dpTable' cellspacing='2px' cellpadding='2px'>" + crlf;
    var xTABLE = "</table>" + crlf;
    var TR = "<tr class='dpTR'>";
    var TR_title = "<tr>";
    var TR_days = "<tr class='dpDayTR'>";
    var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
    var xTR = "</tr>" + crlf;
    var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver=' this.className=\"dpTDHover\";' "; // leave this tag open, because we'll be adding an onClick event
    var TD_Blank = "<td class='dpTDBlank' onMouseOut='this.className=\"dpTDBlank\";' onMouseOver=' this.className=\"dpTDBlankHover\";' "; // leave this tag open, because we'll be adding an onClick event
    var TD_title = "<td colspan=5 class='dpTitleTD'>";
    var TD_buttons = "<td class='dpButtonTD' width='10%'>";
    var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
    var TD_days = "<td class='dpDayTD'>";
    var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' "; // leave this tag open, because we'll be adding an onClick event
    var xTD = "</td>" + crlf;
    var DIV_title = "<div class='dpTitleText'>";
    var DIV_selected = "<div class='dpDayHighlight'>";
    var xDIV = "</div>";

    // start generating the code for the calendar table
    var html = TABLE;

    // this is the title bar, which displays the month and the buttons to
    // go back to a previous month or forward to the next month
    html += "<tr class='dpTitleTR'><td colspan='7' valign='top'><table width='100%' cellspacing='0px' cellpadding='0px'>"
    html += TR_title;
    html += TD_buttons + getButtonCodeYear(dateFieldName, thisDay, -1, "&lt;&lt;") + xTD;// << //
    html += TD_buttons + getButtonCode(dateFieldName, thisDay, -1, "&lt;") + xTD;// < //
    html += TD_title + DIV_title + monthArrayLong[ thisDay[1] - 1 ]+ thisDay[0] + xDIV + xTD;
    html += TD_buttons + getButtonCode(dateFieldName, thisDay, 1, "&gt;") + xTD ;// > //
    html += TD_buttons + getButtonCodeYear(dateFieldName, thisDay, 1, "&gt;&gt;") + xTD ;// >> //
    html += xTR;
    html += "</table></td></tr>"

    // this is the row that indicates which day of the week we're on
    html += TR_days;
    var i;
    for(i = 0; i < dayArrayShort.length; i++)
    html += TD_days + dayArrayShort[i] + xTD;
    html += xTR;

    // now we'll start populating the table with days of the month
    html += TR;

    // first, the leading blanks
    if(weekday != 6)
    for (i = 0; i <= weekday; i++)
    html += TD_Blank + "&nbsp;" + xTD;

    // now, the days of the month
    var len = 31;
    if( thisDay[1] > 6)
    len = 30;
    if( thisDay[1] == 12 && !leap_persian(thisDay[0]))
    len = 29;

    for(var dayNum = thisDay[2]; dayNum <= len; dayNum++) {
    TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString(thisDay) + "');\">";

    if (dayNum == day)
    html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
    else
    html += TD + TD_onclick + dayNum + xTD;

    // if this is a Friday, start a new row
    if (weekday == 5)
    html += xTR + TR;
    weekday++;
    weekday = weekday % 7;

    // increment the day
    thisDay[2]++;
    }

    // fill in any trailing blanks
    if (weekday > 0) {
    for (i = 6; i >weekday; i--)
    html += TD_Blank + "&nbsp;" + xTD;
    }
    html += xTR;

    // add a button to allow the user to easily return to today, or close the calendar
    html += TR_todaybutton + TD_todaybutton;
    var today = getTodayPersian();
    html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", "
    + today[0] + ", " + today[1] + ", " + today[2] + ");'>امروز</button> ";
    // html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName + "\");'>امروز</button> ";
    html += "<button class='dpTodayButton' onClick='updateDateField(\"" + dateFieldName + "\");'>بستن</button>";
    html += xTD + xTR;

    // and finally, close the table
    html += xTABLE;

    document.getElementById(datePickerDivID).innerHTML = html;
    // add an "iFrame shim" to allow the datepicker to display above selection lists
    adjustiFrame();
    }


    /**
    Convenience function for writing the code for the buttons that bring us back or forward
    a month.
    */
    function getButtonCode(dateFieldName, dateVal, adjust, label)
    {
    var newMonth = (dateVal[1] + adjust) % 12;
    var newYear = dateVal[0] + parseInt((dateVal[1] + adjust) / 12);
    if (newMonth < 1) {
    newMonth += 12;
    newYear += -1;
    }

    return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", "
    + newYear + ", " + newMonth + ");'>" + label + "</button>";
    }

    function getButtonCodeYear(dateFieldName, dateVal, adjust, label)
    {
    var newMonth = dateVal[1];
    var newYear = (dateVal[0] + adjust);

    return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", "
    + newYear + ", " + newMonth + ");'>" + label + "</button>";
    }
    /**
    Convert a JavaScript Date object to a string, based on the dateFormat and dateSeparator
    variables at the beginning of this script library.
    */
    function getDateString(dateVal)
    {
    var dayString = "00" + dateVal[2];
    var monthString = "00" + (dateVal[1]);
    dayString = dayString.substring(dayString.length - 2);
    monthString = monthString.substring(monthString.length - 2);

    switch (dateFormat) {
    case "dmy" :
    return dayString + dateSeparator + monthString + dateSeparator + dateVal[0];
    case "ymd" :
    return dateVal[0] + dateSeparator + monthString + dateSeparator + dayString;
    case "mdy" :
    default :
    return monthString + dateSeparator + dayString + dateSeparator + dateVal[0];
    }
    }


    /**
    Convert a string to a JavaScript Date object.
    */
    function getFieldDate(dateString)
    {
    var dateVal;
    var dArray;
    var d, m, y;

    try {
    dArray = splitDateString(dateString);
    if (dArray) {
    switch (dateFormat) {
    case "dmy" :
    d = parseInt(dArray[0], 10);
    m = parseInt(dArray[1], 10);
    y = parseInt(dArray[2], 10);
    break;
    case "ymd" :
    d = parseInt(dArray[2], 10);
    m = parseInt(dArray[1], 10);
    y = parseInt(dArray[0], 10);
    break;
    case "mdy" :
    default :
    d = parseInt(dArray[1], 10);
    m = parseInt(dArray[0], 10);
    y = parseInt(dArray[2], 10);
    break;
    }
    dateVal = new Array(y, m, d);
    } else if (dateString) {
    dateVal = getTodayPersian();
    } else {
    dateVal = getTodayPersian();
    }
    } catch(e) {
    dateVal = getTodayPersian();
    }

    return dateVal;
    }


    /**
    Try to split a date string into an array of elements, using common date separators.
    If the date is split, an array is returned; otherwise, we just return false.
    */
    function splitDateString(dateString)
    {
    var dArray;
    if (dateString.indexOf("/") >= 0)
    dArray = dateString.split("/");
    else if (dateString.indexOf(".") >= 0)
    dArray = dateString.split(".");
    else if (dateString.indexOf("-") >= 0)
    dArray = dateString.split("-");
    else if (dateString.indexOf("\\") >= 0)
    dArray = dateString.split("\\");
    else
    dArray = false;

    return dArray;
    }

    /**
    Update the field with the given dateFieldName with the dateString that has been passed,
    and hide the datepicker. If no dateString is passed, just close the datepicker without
    changing the field value.

    Also, if the page developer has defined a function called datePickerClosed anywhere on
    the page or in an imported library, we will attempt to run that function with the updated
    field as a parameter. This can be used for such things as date validation, setting default
    values for related fields, etc. For example, you might have a function like this to validate
    a start date field:

    function datePickerClosed(dateField)
    {
    var dateObj = getFieldDate(dateField.value);
    var today = new Date();
    today = new Date(today.getFullYear(), today.getMonth(), today.getDate());

    if (dateField.name == "StartDate") {
    if (dateObj < today) {
    // if the date is before today, alert the user and display the datepicker again
    alert("Please enter a date that is today or later");
    dateField.value = "";
    document.getElementById(datePickerDivID).style.vis ibility = "visible";
    adjustiFrame();
    } else {
    // if the date is okay, set the EndDate field to 7 days after the StartDate
    dateObj.setTime(dateObj.getTime() + (7 * 24 * 60 * 60 * 1000));
    var endDateField = document.getElementsByName ("EndDate").item(0);
    endDateField.value = getDateString(dateObj);
    }
    }
    }

    */
    function updateDateField(dateFieldName, dateString)
    {
    var targetDateField = document.getElementsByName (dateFieldName).item(0);
    if (dateString)
    targetDateField.value = dateString;

    var pickerDiv = document.getElementById(datePickerDivID);
    pickerDiv.style.visibility = "hidden";
    pickerDiv.style.display = "none";

    adjustiFrame();
    targetDateField.focus();

    // after the datepicker has closed, optionally run a user-defined function called
    // datePickerClosed, passing the field that was just updated as a parameter
    // (note that this will only run if the user actually selected a date from the datepicker)
    if ((dateString) && (typeof(datePickerClosed) == "function"))
    datePickerClosed(targetDateField);
    }


    /**
    Use an "iFrame shim" to deal with problems where the datepicker shows up behind
    selection list elements, if they're below the datepicker. The problem and solution are
    described at:

    http://dotnetjunkies.com/WebLog/jking/archive/2003/07/21/488.aspx
    http://dotnetjunkies.com/WebLog/jking/archive/2003/10/30/2975.aspx
    */
    function adjustiFrame(pickerDiv, iFrameDiv)
    {
    // we know that Opera doesn't like something about this, so if we
    // think we're using Opera, don't even try
    var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera" ) != -1);
    if (is_opera)
    return;

    // put a try/catch block around the whole thing, just in case
    try {
    if (!document.getElementById(iFrameDivID)) {
    // don't use innerHTML to update the body, because it can cause global variables
    // that are currently pointing to objects on the page to have bad references
    //document.body.innerHTML += "<iframe id='" + iFrameDivID + "' src='javascript:false;' scrolling='no' frameborder='0'>";
    var newNode = document.createElement("iFrame");
    newNode.setAttribute("id", iFrameDivID);
    newNode.setAttribute("src", "javascript:false;");
    newNode.setAttribute("scrolling", "no");
    newNode.setAttribute ("frameborder", "0");
    document.body.appendChild(newNode);
    }

    if (!pickerDiv)
    pickerDiv = document.getElementById(datePickerDivID);
    if (!iFrameDiv)
    iFrameDiv = document.getElementById(iFrameDivID);

    try {
    iFrameDiv.style.position = "absolute";
    iFrameDiv.style.width = pickerDiv.offsetWidth;
    iFrameDiv.style.height = pickerDiv.offsetHeight ;
    iFrameDiv.style.top = pickerDiv.style.top;
    iFrameDiv.style.left = pickerDiv.style.left;
    iFrameDiv.style.zIndex = pickerDiv.style.zIndex - 1;
    iFrameDiv.style.visibility = pickerDiv.style.visibility ;
    iFrameDiv.style.display = pickerDiv.style.display;
    } catch(e) {
    }

    } catch (ee) {
    }

    }

    /*
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    Modulus function which works for non-integers. --> <<<<< Calculate Persian Date >>>>>
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

    */

    function mod(a, b)
    {
    return a - (b * Math.floor(a / b));
    }

    function jwday(j)
    {
    return mod(Math.floor((j + 1.5)), 7);
    }

    var Weekdays = new Array( "Sunday", "Monday", "Tuesday", "Wednesday",
    "Thursday", "Friday", "Saturday" );

    // LEAP_GREGORIAN -- Is a given year in the Gregorian calendar a leap year ?

    function leap_gregorian(year)
    {
    return ((year % 4) == 0) &&
    (!(((year % 100) == 0) && ((year % 400) != 0)));
    }

    // GREGORIAN_TO_JD -- Determine Julian day number from Gregorian calendar date

    var GREGORIAN_EPOCH = 1721425.5;

    function gregorian_to_jd(year, month, day)
    {
    return (GREGORIAN_EPOCH - 1) +
    (365 * (year - 1)) +
    Math.floor((year - 1) / 4) +
    (-Math.floor((year - 1) / 100)) +
    Math.floor((year - 1) / 400) +
    Math.floor((((367 * month) - 362) / 12) +
    ((month <= 2) ? 0 :
    (leap_gregorian(year) ? -1 : -2)
    ) +
    day);
    }

    // JD_TO_GREGORIAN -- Calculate Gregorian calendar date from Julian day

    function jd_to_gregorian(jd) {
    var wjd, depoch, quadricent, dqc, cent, dcent, quad, dquad,
    yindex, dyindex, year, yearday, leapadj;

    wjd = Math.floor(jd - 0.5) + 0.5;
    depoch = wjd - GREGORIAN_EPOCH;
    quadricent = Math.floor(depoch / 146097);
    dqc = mod(depoch, 146097);
    cent = Math.floor(dqc / 36524);
    dcent = mod(dqc, 36524);
    quad = Math.floor(dcent / 1461);
    dquad = mod(dcent, 1461);
    yindex = Math.floor(dquad / 365);
    year = (quadricent * 400) + (cent * 100) + (quad * 4) + yindex;
    if (!((cent == 4) || (yindex == 4))) {
    year++;
    }
    yearday = wjd - gregorian_to_jd(year, 1, 1);
    leapadj = ((wjd < gregorian_to_jd(year, 3, 1)) ? 0
    :
    (leap_gregorian(year) ? 1 : 2)
    );
    month = Math.floor((((yearday + leapadj) * 12) + 373) / 367);
    day = (wjd - gregorian_to_jd(year, month, 1)) + 1;

    return new Array(year, month, day);
    }

    // LEAP_PERSIAN -- Is a given year a leap year in the Persian calendar ?

    function leap_persian(year)
    {
    return ((((((year - ((year > 0) ? 474 : 473)) % 2820) + 474) + 38) * 682) % 2816) < 682;
    }

    // PERSIAN_TO_JD -- Determine Julian day from Persian date

    var PERSIAN_EPOCH = 1948320.5;
    var PERSIAN_WEEKDAYS = new Array("í˜ÔäÈå", "ÏæÔäÈå",
    "Óå ÔäÈå", "åÇÑÔäÈå",
    "äÌ ÔäÈå", "ÌãÚå", "ÔäÈå");

    function persian_to_jd(year, month, day)
    {
    var epbase, epyear;

    epbase = year - ((year >= 0) ? 474 : 473);
    epyear = 474 + mod(epbase, 2820);

    return day +
    ((month <= 7) ?
    ((month - 1) * 31) :
    (((month - 1) * 30) + 6)
    ) +
    Math.floor(((epyear * 682) - 110) / 2816) +
    (epyear - 1) * 365 +
    Math.floor(epbase / 2820) * 1029983 +
    (PERSIAN_EPOCH - 1);
    }

    // JD_TO_PERSIAN -- Calculate Persian date from Julian day

    function jd_to_persian(jd)
    {
    var year, month, day, depoch, cycle, cyear, ycycle,
    aux1, aux2, yday;


    jd = Math.floor(jd) + 0.5;

    depoch = jd - persian_to_jd(475, 1, 1);
    cycle = Math.floor(depoch / 1029983);
    cyear = mod(depoch, 1029983);
    if (cyear == 1029982) {
    ycycle = 2820;
    } else {
    aux1 = Math.floor(cyear / 366);
    aux2 = mod(cyear, 366);
    ycycle = Math.floor(((2134 * aux1) + (2816 * aux2) + 2815) / 1028522) +
    aux1 + 1;
    }
    year = ycycle + (2820 * cycle) + 474;
    if (year <= 0) {
    year--;
    }
    yday = (jd - persian_to_jd(year, 1, 1)) + 1;
    month = (yday <= 186) ? Math.ceil(yday / 31) : Math.ceil((yday - 6) / 30);
    day = (jd - persian_to_jd(year, month, 1)) + 1;
    return new Array(year, month, day);
    }

    function calcPersian(year,month,day)
    {
    var date,j;

    j = persian_to_jd(year,month,day);
    date = jd_to_gregorian(j);
    weekday = jwday(j);
    return new Array(date[0], date[1], date[2],weekday);
    }

    // calcGregorian -- Perform calculation starting with a Gregorian date
    function calcGregorian(year,month,day)
    {
    month--;

    var j, weekday;

    // Update Julian day

    j = gregorian_to_jd(year, month + 1, day) +
    (Math.floor(0 + 60 * (0 + 60 * 0) + 0.5) / 86400.0);

    // Update Persian Calendar
    perscal = jd_to_persian(j);
    weekday = jwday(j);
    return new Array(perscal[0], perscal[1], perscal[2],weekday);
    }

    function getTodayGregorian()
    {
    var t = new Date();
    var today = new Date();

    var y = today.getYear();
    if (y < 1000) {
    y += 1900;
    }

    return new Array(y, today.getMonth() + 1, today.getDate(),t.getDay());
    }

    function getTodayPersian()
    {
    var t = new Date();
    var today = getTodayGregorian();

    var persian = calcGregorian(today[0],today[1],today[2]);
    return new Array(persian[0],persian[1],persian[2],t.getDay());
    }







    به این صورت هم استفاده می شود :
     <asp:TextBox ID="txtBirthDate" runat="server"></asp:TextBox>
    <img alt="انتخاب تاریخ" src="../Template/Main/Images/Calendar.png" onclick="displayDatePicker('ctl00_ContentPlaceHold er1_txtBirthDate', this);" />(با کلیک بر روی تقویم تاریخ را انتخاب نمایید )


    ممنون می شم اگه کمک کنین که این کار کنه تو mozilla

  4. #4

    نقل قول: مشکل mozilla با جاوا اسکریپت

    مشکلی که تو mozilla دارم می بینم سر این خطه :

     var targetDateField = document.getElementsByName (dateFieldName).item(0);

    نمی فهمم مشکلش چیه!

  5. #5

    نقل قول: مشکل mozilla با جاوا اسکریپت

    مشکل اون قبلیه حل شد! الان برای تغییر زبان نمیدونم چه مشکلی هست... ممنون می شم اگه دوستان کمک کنند
    function keyenter(field,e)
    {
    var key;
    if (window.event)//IE
    key = window.event.keyCode;
    else
    key = e.which; // Firefox

    if (key>31)
    if (key<128)
    {

    if (window.event)
    {
    window.event.keyCode=' !"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُيلا÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثب لاهتنمئدخحضقسفعرصطغظ<|>ّ'.cha rCodeAt(key-32);

    }
    else
    {
    e.which='!"#$%،گ)(×+و-./0123456789:ك,=.؟@ِذ}ىُيلا÷ـ،/’د×؛َءٍف‘{ًْإ~جژچ^_پشذزيثب لاهتنمئدخحضقسفعرصطغظ<|>ّ'.cha rCodeAt(key-32);


    }

    }
    }


  6. #6

    نقل قول: مشکل mozilla با جاوا اسکریپت

    نقل قول نوشته شده توسط cs_mania مشاهده تاپیک
    مشکل اون قبلیه حل شد!
    مشکل قبلی را چطوری حل کردین که توی فایر فاکس هم کار کنه

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •