ฟังก์ชั่น location.href ใช้สำหรับแสดงไฟล์เอกสารปัจจุบันใน browser
สามารถนำไปประยุกต์สร้างลิ๊งค์ได้
ตัวอย่าง
1 2 3 4 5 6 7 8 9 10 11 12 | < html > < head > < title >test page</ title > </ head > < body > < script language = "javascript" > document.write(location.href); document.write("< p >"); document.write("< a href = '"+location.href+"' >Link To Current Page</ a >"); </ script > </ body > </ html > |