رفتن به مطلب

برسی کد جاوا اسکریپت که کار نمیکند


پست های پیشنهاد شده

سلام :

من این کد رو درست کردم و نمیدونم چرا اجرا نمیشه لطف میکنید کمک کنید.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
    <script type="text/javascript">
        {
            if (navigator.onLine == true)

                swal({
                title: "Good job!",
                text: "You clicked the button!",
                icon: "success",
                button: "Aww yiss!",
            });
            else
         swal({
                title: "Good job!",
                text: "You clicked the button!",
                icon: "success",
                button: "Aww yiss!",
            });
        }
    </script>
</head>
 <body>
    صفحه اصلی سایت
</body>
</html>

 

لینک به ارسال
در 15 دقیقه قبل، amirali1380008 گفته است :

سلام :

من این کد رو درست کردم و نمیدونم چرا اجرا نمیشه لطف میکنید کمک کنید.


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
    <script type="text/javascript">
        {
            if (navigator.onLine == true)

                swal({
                title: "Good job!",
                text: "You clicked the button!",
                icon: "success",
                button: "Aww yiss!",
            });
            else
         swal({
                title: "Good job!",
                text: "You clicked the button!",
                icon: "success",
                button: "Aww yiss!",
            });
        }
    </script>
</head>
 <body>
    صفحه اصلی سایت
</body>
</html>

 

سلام. این رو تست کنید:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
 <body>
    صفحه اصلی سایت
    <script>
		(function() {
   			if (navigator.onLine == true)
                swal({
                title: "Good job!",
                text: "You clicked the button!",
                icon: "success",
                button: "Aww yiss!",
            });
            else
         		swal({
                	title: "Good job!",
                	text: "You clicked the button!",
                	icon: "success",
                	button: "Aww yiss!",
            	});
		})();
    </script>
</body>
</html>

 

  • پسندیدن 1
لینک به ارسال
در 2 ساعت قبل، amirali1380008 گفته است :

الان وقتی افلاین هستیم اون اررور بالا نماید

ببینید در کل باید سایت آنلاین باشه، شما همین الان دارید از یه سرور دیگه فایل اصلی رو میگیرید:

https://unpkg.com/sweetalert/dist/sweetalert.min.js

منظورم فایل بالاست. این رو باید بذارید کنار فایلهای خودتون. اگه بناست که هر لحظه قطع شد ارتباط، پیام بدید باید از setInterval استفاده کنید و مثلا هر 3 ثانیه کد رو اجرا کنید. کدی که الان دارید فقط بعد از لود صفحه یکبار اجرا میشه.

  • پسندیدن 1
لینک به ارسال

لطفا برای ارسال دیدگاه وارد شوید

شما بعد از اینکه وارد حساب کاربری خود شدید می توانید دیدگاهی ارسال کنید



ورود به حساب کاربری
×
×
  • اضافه کردن...