הרשם שאלות ותשובות רשימת חברים לוח שנה חיפוש הודעות מהיום סמן פורומים כנקראו

   
|!|

 
 
כלים לאשכול תצורת הצגה
Prev הודעה קודמת   הודעה הבאה Next
ישן 15-07-09, 23:51   # 1
Gal Shafrir
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
הודעות: 1,626

Gal Shafrir לא מחובר  

בעיה עם setTimeout

היי אנשים.

יש לי בעיה עם jQuery/setTimeout. אני חושב שזה עם הjQuery
כי כשעשיתי שcloseMsg תציג alert הsetTimeout עבד מעולה.

הקוד עובד בסדר, אין בו שגיאות למי שתוהה (חוץ מסגירת ההודעה).
פשוט ברגע שאני כותב בsetTimeout דיליי שהוא יותר גדול מ900 זה לא עובד.

הנה הפונקצייה:
PHP קוד:
function addSelectedItems(formcat) {

    var 
products = [];
    var 
count 0;
    var 
countAdd 0;
    var 
msg "";

    
// get the products number
    
var 0;
    $(
"input.amount").each(function() {
        
j++;
        
count++;

        
amount = $('#amount' j).val();
        if (
amount 0)
            
countAdd++;

    });


    for (var 
1<= counti++) {

        if (
== 1) {

            $(
"#AddToShoppingCart").fadeIn("slow");
            $(
"#ShoppingCartMsg").html("the products were added to your shopping cart");

        } else {

            if ((
1) == countAdd) {
                
setTimeout('closeMsg();',1000);
            }

        }
    
        var 
amount = $('#amount' i).val();
        if (
amount 0) {

        
            var 
colorObj document.getElementById('color-' i);
            if (
colorObj) {
                
color colorObj.options[colorObj.selectedIndex].value;
            } else {
                
color "default";
            }

            var 
catalog_number = $('#catalog_number' i).val();

            var 
time = new Date().getTime();
            var 
serverPage 'index.php?module=cart&advanced=true&ajax=true&act=addProduct&catalog_number=' catalog_number '&amount=' amount '&color=' color '&time=' time;

            $.
get(serverPage);

            
MiniCart(false); // updates MiniCart

            
document.getElementById('items').innerHTML getItems();

            var 
mktime = new Date().getTime();
            if (
cat != "") {

                var 
loadPage 'index.php?module=catalog&act=categories&id=' cat '&ajax=true&time=' mktime;

                $.
get(loadPage, function(server) {
                    $(
"#products-list").html(server);
                })

            } else {

                var 
page document.getElementById("page").value;
                
                $.
get(page+"&time="+mktime, function(server) {
                    $(
"#products-list").html(server);
                });

            }

        }
    }


הפונקצייה closeMsg:
PHP קוד:
function closeMsg() {
    $(
"#ShoppingCartMsg").html("TESTING");


תודה לעוזרים
__________________
בברכה,
גל שפריר - מעצב ומפתח אתרים.

עופר שפריר - במאי, תסריטאי ומפיק.
  Reply With Quote
 

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 

כלים לאשכול
תצורת הצגה

חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 05:37.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ