44. فتح الصفحة والجوال
أضف الكود التالي إلى منطقة <Body>
<script language = "javaScript"> <!- ابدأ لـ (t = 2 ؛ t> 0 ؛ t--) { لـ (x = 20 ؛ x> 0 ؛ x--) { لـ (y = 10 ؛ y> 0 ؛ y--) { parent.moveby (0 ، -x) ؛ } } لـ (x = 20 ؛ x> 0 ؛ x--) { لـ (y = 10 ؛ y> 0 ؛ y--) { parent.moveby (0 ، x) ؛ } } لـ (x = 20 ؛ x> 0 ؛ x--) { لـ (y = 10 ؛ y> 0 ؛ y--) { parent.moveby (x ، 0) ؛ } } لـ (x = 20 ؛ x> 0 ؛ x--) { لـ (y = 10 ؛ y> 0 ؛ y--) { parent.moveby (-x ، 0) ؛ } } } //-> // end -> </script> |
45. عرض تاريخ ووقت جهاز العميل الشخصي
<script language = "livescript"> <!- الاختباء اليوم = تاريخ جديد () *** ("الوقت الحالي هو:" ، اليوم. gethours () ، ":" ، اليوم. *** ("<br> تاريخ اليوم هو:" ، اليوم. // نهاية مختبئ المحتويات -> </script> |
46. قم بإنشاء آخر تاريخ تم تعديله تلقائيًا في كل مرة:
<html> <body> هذه صفحة HTML بسيطة. <br> التغييرات الأخيرة: <script language = "livescript"> <!- إخفاء البرنامج النصي من المتصفحات القديمة *** (document.lastmodified) // نهاية مختبئ المحتويات -> </script> </body> </html> |
47. القيود التي لا يمكن أن تكون فارغة وعناوين البريد الإلكتروني:
<html> <head> <script language = "javaScript"> <!- إخفاء وظيفة test1 (form) { if (form.text1.value == "") تنبيه ("أنت لم تكتب أي شيء ، الرجاء إدخاله مرة أخرى!") آخر { ALERT ("HI"+form.text1.value+"! لقد أدخلته كاملة!") ؛ } } وظيفة test2 (form) { if (form.text2.value == "" || form.text2.value.indexof ('@' ، 0) == -1) تنبيه ("هذا ليس هو عنوان البريد الإلكتروني الصحيح! الرجاء إدخاله مرة أخرى!") ؛ تنبيه آخر ("لقد أدخلته كاملة!") ؛ } // -> </script> </head> <body> <name form = "first"> أدخل اسمك: <br> <type type = "text" name = "text1"> <type type = "button" name = "button1" value = "input test" onClick = "Test1 (this.form)"> <p> أدخل عنوان البريد الإلكتروني الخاص بك: <br> <type type = "text" name = "text2"> <type type = "button" name = "button2" value = "test test" onClick = "Test2 (this.form)"> </body> |
48. ضوء سباق الخيل
<html> <head> <script language = "javaScript"> <!- إخفاء var scrtxt = "كيف هو! إنه رائع! يمكنك أيضًا تجربته."+"هنا يذهب رسالتك إلى الزوار الخاص بك سوف تنظر الصفحة "+" لساعات في سحر نقي ... "؛ var lentxt = scrtxt.length ؛ عرض var = 100 ؛ var pos = 1-width ؛ وظيفة Scroll () { POS ++ ؛ var scroller = "" ؛ if (pos == lentxt) { POS = 1 عرض ؛ } إذا (pos <0) { لـ (var i = 1 ؛ i <= math.abs (pos) ؛ i ++) { Scroller = scroller+"" ؛} scroller = scroller+scrtxt.substring (0 ، width-i+1) ؛ } آخر { scroller = scroller+scrtxt.substring (pos ، width+pos) ؛ } window.status = scroller ؛ setTimeout ("scroll ()" ، 150) ؛ } //-> </script> </head> <body onload = "scroll () ؛ return true ؛"> يمكن عرض صفحة الويب الخاصة بك هنا! </body> </html> |
49. استخدم الأزرار في صفحة الويب للتحكم في عرض الصفحة السابقة والصفحة التالية والصفحة الرئيسية.
<html> <body> <name form = "buttonbar"> <type type = "button" value = "back" onClick = "History.back ()"> <type type = "button" value = "js- home" onClick = "location = 'script.html'"> <type type = "button" value = "next" onClick = "History.Forward ()"> </form> </body> </html> |
50. تحقق من الكود المصدر لعنوان URL معين
أضف الكود التالي إلى منطقة <Body>
<script> وظيفة إضافة () { var ress = document.forms [0] .luxiaoqing.value window.location = "view-source:"+ress ؛ } </script> أدخل عنوان عنوان URL لعرض رمز المصدر: <Porm> <input type = "text" name = "luxiaoqing" size = 40 value = "http: //" <Porm> <br> <type type = "button" value = "عرض رمز المصدر" onClick = add ()> </form> |
51. يعرض العنوان تاريخ
أضف الكود التالي إلى منطقة <Body>:
<script language = "javaScript1.2"> <!-إخفاء var isnmonth = جديد Array ("يناير" ، "فبراير" ، "مارس" ، "أبريل" ، "مايو" ، "يونيو" ، "يوليو" ، "أغسطس" ، "سبتمبر" ، "أكتوبر" ، "نوفمبر" ، "ديسمبر") ؛ var isnday = جديد Array ("Sunday" ، "Monday" ، "Tuesday" ، "Wednesday" ، "Finay" ، "Friday" ، "Saturday" ، "Sunday") ؛ اليوم = تاريخ جديد () ؛ السنة = اليوم. getyear () ؛ Date = Today.getDate () ؛ if (document.all) document.title = "اليوم هو:"+year+"year"+isnmonth [today.getMonth ()]+date+"day"+isnday [today.getday ()] //-إخفاء-> </script> |