3-amaliy ish Mavzu: JavaScript funksiyalar va obyektlari. JavaScriptda doimiy ifodalar. Ishdan maqsad
Download 124.5 Kb.
|
3-amaliy ish
- Bu sahifa navigatsiya:
- Location obyekti
- Amali ish ning topshiriqlari
home.gif name=“pic1” width = 200 height = 100> http://maks/index.html”> < form name = “myForm > < input type = “text” name = “myText” value = “xa xa xa” > < input type = “button” name=“button1” value = “button1” > onclick = “first ()” < input type = “checkbox” name = “mycheckbox”> < input type = “button” name=“button 2” value = “button2” > onclick = “second()” < /form > < p > < br > < br > < script language = “ JavaScript ”> document.write( “Fon ranggi bu : ”) ; document.write( document.bgcolor+ “ ”) ; document.write( “ 2 chi button dagi matn :”) ; document.write( “ document.myForm.button 2.value”) ; // -- < /script > < /body > Location obyekti JavaScript da window va document obyektlaridan tashqari location deb ataluvchi yana bir muhim obyekt mavjud. Bu obyektda HTML dokument Yo’qlangan adres saqlanadi. Agar siz http://www.xyz.com/page/html Sahifasini Yo’qlagan bo’lsangiz, u xolda location.href ning qiymati ham xuddi shu adresga mos tushadi. Shunday bo’lsada biz uchun juda muhim narsa shuki, siz location.href ga yangi qiymat yozishingiz mumkin. Masalan, quyidagi misolda tugmacha joriy darchadan yangi Sahifaga o’tishni Yo’qlaydi : < form > < input type = button value=“Yahoo”> onclick = “location.href = ` http://www.Yahoo.com ` ; ” < /form > Amali ishning topshiriqlari: |