脚本部分:
function school(sName,sDddress,sPhone,sMail){ this.SName = sName; this.SAddress = sDddress; this.SPhone = sPhone; this.SMail = sMail; this.parmsArray = new Array("test1", "test2", "test3", "test4"); this.index = 0; this.SInfomation = ShowInfomation; this.trades = CreateSort; this.SAnchorUrl = AnchorUrl;}function ShowInfomation(){ var msg = ""; msg += "学校名称:" + this.SName + "\n"; msg += "学校地址:" + this.SAddress + "\n"; msg += "学校电话:" + this.SPhone + "\n"; msg += "电子邮件:" + this.SMail; window.alert(msg);}function CreateSort(){ var objArray = new Array("一年级", "二年级", "三年级", "四年级", "五年级", "六年级"); objArray.sort(function (arg1, arg2) { if (arg1.length > arg2) return false; else return true; }); window.alert(objArray.join(","));}function AnchorUrl(){ if (this.index < 3) this.index++; else this.index = 0; window.location.hash = this.parmsArray[this.index];}
HTML部分:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>锚点间跳转实例