Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Разработка Web-приложений для iPhone

.pdf
Скачиваний:
15
Добавлен:
09.04.2015
Размер:
5.2 Mб
Скачать

&+)-*@+& «name», & 0?" (&),.&+@ # ,"8"D6= &+)-*@+& «salary».

A"#+&%170 +0?- 3",@#$&=+ %#+)&-%&1-0 % 1-> 3)@?-> I.0801+"% XML 3"$@801+&. «organization» - ")?&1-(&C-4 - «department» - "+30. 4%.4=+#4 #"#+&%178- +0?&8-. < +0? «organization» %#+)"017 %#0 "#+&.6170 I.0801+7 3"$@801+&, & % +0?- «department» %#+)&-%&=+#4 ",-#&1-4 "+30."% -, (&3&1170 #""+%0+#+%@=D-8- +0?&8-, #,-#$- #"+)@31-$"% "+30.&.

A"#+&%1"2 +0? «department» -800+ 10#$".6$" &+)-*@+"%

<department title="department1" telno="123-45-67"></department>

;+)-*@+ «title» (&3&0+ 1&(%&1-0 "+30.&, & &+)-*@+ «telno» - 1"80) +0.0B"1& "+30.&. A"#+&%1"2 +0? «organization»

<organization name="myOrg"></organization>

M800+ 03-1#+%01172 &+)-*@+ «name». A"#+&%170 +0?- 8"?@+ #"30)/&+6 3&1170 (A"#+"-+ -( #"+)@31-$"% department2 ) .

3.3. 567#24' XML

H.4 +"?", :+"*7 %7,".14+6 "*)&*"+$@ XML 3"$@801+& % #+)&1-:1"8 #C01&)--, % 4(7$0 JavaScript 10"*>"3-8" #"(3&+6 XML "*R0$+. S*R0$+7 XML ,"(%".4=+ ,".@:&+6 3&1170 - &+)-*@+7, @#+&1&%.-%&+6 3&1170 - &+)-*@+7, -(8014+6 #+)@$+@)@ 3"$@801+&. Javascript ,)03"#+&%.40+ 3.4 "*)&*"+$- XML "*R0$+"% #,0C-&.6170 80+"37.

S*R0$+ 8"/1" #"(3&+6 -( #+)"$- +0$#+& -.- -( B&2.&. H.4 #"(3&1-4 XML "*R0$+& -( B&2.& #"(3&3-8 ,0)08011@= ("*R0$+) - XML Http (&,)"#.

var myRequest = new XMLHttpRequest();

V&,)"#7 +&$"?" %-3& ,)&%-.61" "*)&*&+7%&=+#4 *)&@(0)&8- Safari - FireFox. U)&@(0) M1+0)10+ I$#,.")0) (IE) c "*R0$+&8- XMLHttpRequest 10 )&*"+&0+. < ,)-."/01-- 456 ,"$&(&1 +)0*@0872 3.4 IE #,"#"* #"(3&1-4 (&,)"#&. <#0 3&.6102E-0 302#+%-4 $"))0$+1" %7,".14=+#4 %#08- ,0)0:-#.01178- *)&@(0)&8-.

< ,)-%03011"8 B)&?801+0 #C01&)-4 %%0301& ?."*&.61&4 ,0)08011&4 myRequest. Q@1$C-4 requestContent() %7,".140+ ,"3?"+"%$@ - ,0)03&:@ +)0*@087> 3&117> 1& #0)%0).

function requestContent(){ myRequest.open("GET","department.xml"); myRequest.setRequestHeader("Cache-Control","no-cache"); myRequest.onload=getContent;

myRequest.send("");

}

Q@1$C-4 requestContent() #"30)/-+ :0+7)0 ",0)&+")&, $&/372 -#,".6(@0+ "3-1 -( 80+"3"%

"*R0$+& myRequest.

< ,0)%"8 ",0)&+")0 -#,".6(@0+#4 80+"3 open(parm1,parm2), #"30)/&D-2 3%& ,&)&80+)&. F0)%72 ,&)&80+) 80+"3& ",)030.40+ +-, (&,)"#&, "1 8"/0+ ,)-1-8&+6 (1&:01-0 «GET» -.- «POST». <+")"2 ,&)&80+) (&3&0+ ),"."/01-0 3"$@801+& -.- ##7.$@ 1& #+)&1-C@, ?010)-)@=D@= 3"$@801+ XML. !0+"3 open() 3&0+ %"(8"/1"#+6 4%1" @#+&1"%-+6 #,"#"* %7,".101-4 (&,)"#& (#-1>)"1172 -.- -1>)"1172). A-1>)"1172 #,"#"* ,)03,".&?&0+, :+" ,)-."/01-0, ,0)0#.&%E00 (&,)"# 1& #0)%0) *@30+ 3"/-3&+6#4 "+%0+& "+ #0)%0)&, ,"#.0 :0?" #8"/0+ ,)"3"./-+6 %7,".101-0. N#.-

51

%7*)&1 -1>)"1172 #,"#"* %7,".101-4 (&,)"#&, +" $.-01+#$"0 ,)-."/01-0 #8"/0+ ,)"3"./-+6 %7,".101-0 #%"0?" #C01&)-4. F".@:01-0 "+%0+& "+ #0)%0)&, ,)-%030+ $ %7("%@ B@1$C---"*)&*"+:-$& ,)0)7%&1-4, $"+")&4 #8"/0+ "*)&*"+&+6 %"(%)&D01170 )0(@.6+&+7. K+"+ ,&)&80+) -80+ *@.0%#$"0 (1&:01-0 -#,".6("%&1-0 80+"3& open() # +)084 ,&)&80+)&8- %7?.43-+ +&$:

myRequest.open("GET","department.xml",async);

N#.- async -800+ (1&:01-0 true (,)-14+" ," @8".:&1-=), +" (&,)"# %7,".140+#4 -1>)"11". < ,)"+-%1"8 #.@:&0 – #-1>)"11".

< 80+"30 open() 8"/1" -#,".6("%&+6 0D0 3%& 3",".1-+0.617> ,&)&80+)& 3.4 3"#+@,& 1& WEB @(.7, +)0*@=D-0 &%+")-(&C--. F)-80) ,"3"*1"?" %7("%& 80+"3& ,"$&(&1 1-/0.

myRequest.open("GET","persons.php?id=234&accountnom=16",user,pass);

!0+"3 setRequestHeader @#+&1&%.-%&0+ (&?"."%"$ (&,)"#&. < ,)-%03011"2 B@1$C--

requestContent() (&?"."%"$

myRequest.setRequestHeader("Cache-Control","no-cache")

",)030.40+ ,&)&80+)7 $IE-)"%&1-4 3"$@801+&.

H.4 #.@:&4, ,0)03&:- 3&117> # -#,".6("%&1-08 80+"3& POST (&?"."%"$ %#0?3& 3"./01 -80+6 %-3

myRequest.setRequestHeader("Content-type ", "application/x-www-form-urlencoded");

A.03@=D-2 ",0)&+") (&3&0+ B@1$C-=-"*)&*"+:-$ (&%0)E01-4 (&,)"#& (% 3&11"8 #.@:&0 getContent), +&$"2 #,"#"* ,)-80140+#4 3.4 Safari - FireFox. IE 10 @800+ ",)030.4+6 ,"3"*1"?" +-,& "*)&*"+:-$, #8. F)-."/01-0 456

F"#.031-2 ",0)&+") -#,".6(@0+ 80+"3, "+,)&%.4=D-2 (&,)"# 1& #0)%0) (3.4 «GET» 80+"3 send % $&:0#+%0 &)?@801+& 3"./01 #"30)/&+6 ,@#+@= #+)"$@, 0#.- -#,".6(@0+#4 80+"3 «POST» &)?@801+ 3"./01 #"30)/&+6 ,0)03&%&0870 3&1170).

'#8"+)-8 "*)&*"+$@ (&,)"#& #0)%0)"8, & (&+08 ,0)02308 $ $.-01+#$"8@ ,)-."/01-=

3.4. 56/%6)42% .%(/)0% 0#//)$

A0)%0) % "+%0+ 1& ,)-14+72 (&,)"# 8"/0+ ,0)03&+6 $.-01+#$"8@ ,)-."/01-= (&,)"E01172 3"$@801+ (+&$"0 302#+%-0 ,)03,".&?&0+#4 % )#8&+)-%&08"8 ,)-80)0), -.- 8"/0+ ,0)03&+6 @,)&%.01-0 (&+)0*"%&11"8@ #0)%0)1"8@ ,)-."/01-=, $"+")"0, % #%"= ":0)036, 8"/0+ #:-+&+6 -( B&2."%"2 #-#+087 -.- #?010)-)"%&+6, & (&+08 ,0)03&+6 +)0*@0872 3"$@801+ $.-01+@.

< 1&E08 ,)-80)0 WEB #0)%0) %"(%)&D&0+ (&+)0*"%&1172 3"$@801+ $.-01+#$"8@ ,)-."/01-=. J-$&$-> 3&117> 1& #0)%0) I+"+ (&,)"# 10 ,0)03&0+.

5+"*7 ,0)03&+6 3&1170 1& #0)%0) 3.4 "*)&*"+$- #0)%0)178 ,)-."/01-08 8"/1" %"#,".6("%&+6#4 ,)-08&8-, ,"$&(&1178- % ,)-80)&> 1-2. S*& ,)-80)& "*)&D&=+#4 $ PHP #+)&1-C0, #C01&)-2 $"+")"2 %"(%)&D&0+ 10$"+")72 XML 3"$@801+ $.-01+#$"8@ ,)-."/01-=.

D4':.4 1. !0+"3 GET 3.4 ,0)03&:- 3&117> 1& #0)%0).

HTML - JavaScript $"3, ,"$&(&1172 1& .-#+-1?0 3-2, ,"$&(7%&=+ #,"#"* B")8-)"%&1-4 - ,0)03&:- (&,)"#& 1& #0)%0)

52

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8"

/>

<title>!0+"3 GET</title> <script type='text/javascript'> <!--

var myResponseXML; var myResponseText;

var myRequest = new XMLHttpRequest();

function requestData(){

//9#+&1"%-+6 $"3-)"%$@ #,0C-&.617> #-8%"."% var name = encodeURIComponent

(document.getElementById(“name”).value);

var age=encodeURIComponent(document.getElementById(“age”).value); //F0)03&+6 ,&)&80+)7 :0)0( URL myRequest.open(“GET”,”myPage.php?name=”+name+”&age=”+age); myRequest.setRequestHeader(“Cache-Control”,”no-cache”); myRequest.onload=getContent;

myRequest.send(null);

}

function getContent(){ //S*)&*"+$& )0(@.6+&+"% (&,)"#&

}

//! </script> </head> <body>

<h1>P4,-$@&-1")0+ &",.-4" get</h1>

:"9+ 0?5: <input id=”name” value=”Your name”/><br/> :"9 1-&."43: <input id=”age” value=”Your age”/><br/>

<input type=”button” value=”E-43"103@” onclick=”requestData()”/> </body>

</html>

+'*$'", 3-2. HTML - JavaScript #C01&)-2 3.4 -..=#+)&C-- 80+"3& GET

S#"*011"#+6= JavaScript $"3& 4%.40+#4 10"*>"3-8"#+6 $"3-)"%$- ,&)&80+)"% (encodeURIComponent()) ,0)03 ,0)03&:02 (&,)"#&. 9$&(&11&4 B@1$C-4 $"3-)@0+ ,)"*0.7 - 3)@?-0 #,0C-&.6170 #-8%".7 +&$-8 "*)&("8, :+"*7 "1- ,)&%-.61" ,0)03&%&.-#6 :0)0( WEB. S*)&*"+$& )0(@.6+&+"% (&,)"#& 10 ,"$&(&1&, "1& *@30+ )&(*-)&+6#4 1-/0.

G"3 PHP #+)&1-C7, "*)&*&+7%&=D02 (&,)"# ,)-%"3-+#4 1& .-#+-1?0 3-3.

<?PHP

header('Content-type: text/xml');

53

$name=htmlspecialchars($_GET['name']); $name=stripslashes($name); $age=htmlspecialchars($_GET['age']); $age=stripslashes($age);

echo('<?xml version="1.0" encoding="utf-8" ?>'); echo('<person name="'.$name.'" age="'.$age.'" />');

?>

+'*$'", 3-3. PHP #+)&1-C& 3.4 "*)&*"+$- (&,)"#& GET

9$&(&1172 $"3 3"./01 *7+6 #">)&101 % B&2.0 myPage.php. PHP #C01&)-2 % "+%0+ 1& (&,)"# ?010)-)@0+ XML 3"$@801+, %73&%&4 0?" *)&@(0)@ # ,"8"D6= $"8&13 echo. F0)03 1&:&."8 ,0)03&:- 10"*>"3-8" @#+&1"%-+6 mime +-, ,0)03&%&087> 3&117>. K+" 30.&0+#4 # ,"8"D6= B@1$C-- header(). AC01&)-2 ,".@:&0+ ,0)03&1170 08@ ,&)&80+)7, %"##+&1&%.-%&0+ 1&:&.61@= $"3-)"%$@ #-8%"."% # ,"8"D6= B@1$C-- htmlspecialchars() ,"#.0 :0?" #1-8&0+ «I$)&1-)"%&1-0» #,0C-&.617> #-8%"."% (+&$-> $&$ 3%"2170 -.- "3-1&)170 $&%7:$-, #-8%".7 ,0)01"#& #+)"$ - +.3.), -#,".6(@4 B@1$C-= stripslashes().

<-3 #+)&1-C7 ,"#.0 %7,".101-4 (&,)"#& ,"$&(&1 1& )-#. 3-2.

'-#. 3-2. <7,".101-0 (&,)"#& GET

< 3&11"8 ,)-80)0 % $&:0#+%0 )0(@.6+&+& %7,".101-4 (&,)"#& ,"$&(&1 +0$#+ #?010)-)"%&11"?" PHP #C01&)-08 XML 3"$@801+&. K+"+ +0$#+ %7%"3-+#4 # ,"8"D6= B@1$C-- alert().

D4':.4 2. !0+"3 POST 3.4 ,0)03&:- 3&117> 1& #0)%0).

A"*#+%011" $"3 HTML #+)&1-C7 "#+&0+#4 ,)0/1-8, -(80101& +".6$" B@1$C-4 requestData(). P)0*@0872 $"3 ,"$&(&1 1-/0 (L-#+-1? 3-4).

function requestData(){

var name = encodeURIComponent(document.getElementById("name").value);

var age = encodeURIComponent(document.getElementById("age").value);

54

myRequest.open("POST","myPage1.php",true); myRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

myRequest.onload=getContent;

myRequest.send('name='+name+'&age='+age);

}

+'*$'", 3-3. Q@1$C-4 requestData() 3.4 B")8-)"%&1-4 (&,)"#& POST

S+.-:-4 #"#+"4+ % #,"#"*0 ,0)03&:- ,&)&80+)"%(80+"3 send()), -(8010117> ,&)&80+)&> 80+"3& open - "*4(&+0.61"2 @#+&1"%$0 +-,& (&?"."%$& (80+"3 setRequestHeader()). J0(1&:-+0.6170 -(80101-4 +&$/0 %7,".1017 % +0.0 HTML 3"$@801+&. AC01&)-2 PHP #+)&1-C7 +&$/0 10(1&:-+0.61" -(80101 (L-#+-1? 3-4).

<?PHP

header('Content-type: text/xml'); $name=htmlspecialchars($_POST['name']); $name=stripslashes($name); $age=htmlspecialchars($_POST['age']); $age=stripslashes($age);

echo('<?xml version="1.0" encoding="utf-8" ?>'); echo('<person name="'.$name.'" age="'.$age.'" />'); ?>

L-#+-1? 3-4. PHP #C01&)-2 3.4 "*)&*"+$- (&,)"#& POST

M(80101-4 % #C01&)-- $"#1@.-#6 #,"#"*& ,".@:01-4 ,&)&80+)"%. S#+&%E-0#4 302#+%-4 10 -(801017.

<-3 #+)&1-C7 ,"#.0 ,".@:01-4 "+%0+& # #0)%0)& ,"$&(&1 1-/0.

'-#. 3-3. '0(@.6+&+7 "*)&*"+$- (&,)"#& POST

S*)&+-+0 %1-8&1-0 1& -(80101172 (&?"."%"$ #+)&1-C7. K+" 03-1#+%011"0 -(80101-0 %-3& #+)&1-C7.

3.5. 56/%6)42% /#.3*84%4% & 2*,#+402)$ (/,*)9#+,,

<0)108#4 $ )#8"+)01-= #,"#"*"% "*)&*"+$- )0(@.6+&+"% XML HTTP (&,)"#&. Q@1$C-4-"*)&*"+:-$ 8"/0+ %7,".14+6 )&(.-:170 302#+%-4. < ,)"#+02E08 #.@:&0 # 00 ,"8"D6= 8"/1" ,".@:-+6 #"*#+%011" "*R0$+ myResponseXML

55

myResponseXML=myRequest.responseXML;

M.- +0$#+ -#>"31"?" 3"$@801+& myResponseText.

myResponseText=myRequest.responseText;

L-#+-1? ,"$&(7%&0+ ,)"#+02E-2 %-3 B@1$C-- getContent();

var myResponseXML; var myResponseText;

function getContent(){ myResponseText=myRequest.responseText; myResponseXML=myRequest.responseXML;

}

+'*$'", 3.5. Q@1$C-4 getContent()

'0(@.6+&+7 ,)-80)"% 1 - 2 ,".@:017 +&$"2 B@1$C-02.

3.6. :)*+'; 4#204 (/)</%$$'

F)-%0308 ,)"?)&88@, #:-+7%&=D@= XML ",-#&1-0 ")?&1-(&C-- # #0)%0)& - ,"$&(7%&=D@= 0?" #"30)/-8"0 # ,"8"D6= alert() 1& I$)&10 (L-#+-1? 3-6).

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>test</title>

<script type='text/javascript'> <!--

var myResponseXML; var myResponseText;

var myRequest = new XMLHttpRequest();

function requestContent(){ myRequest.open("GET","department.xml"); myRequest.setRequestHeader("Cache-Control","no-cache"); myRequest.onload=getContent;

myRequest.send("");

}

function getContent(){ myResponseText=myRequest.responseText; myResponseXML=myRequest.responseXML; alert(myResponseText);

}

//--> </script> </head>

<body onload='requestContent()'> <h1>XML Examples</h1>

56

How to open or create XML object </body>

</html>

+'*$'", 3-6. HTML $"3 - JavaScript #C01&)-2. S*)&*"+$& XML 3"$@801+&

'0(@.6+&+ )&*"+7 ,)-."/01-4 ,"$&(&1 1& '-#. 3-4. Q@1$C-4 alert() %7%"3-+ ,".172 +0$#+ #:-+&11"?" 3"$@801+& % "$1".

)'*. 3-4. A:-+7%&1-0 3"$@801+& # #0)%0)&

F"$&(&1172 ,)-80) 308"1#+)-)@0+ #%"2#+%" responseText. H.4 +"?", :+"*7 -80+6 %"(8"/1"#+6 )&*"+&+6 I.0801+&8-, &+)-*@+&8- - 3&1178XML 3"$@801+&, 10"*>"3-8" #"(3&+6 XML "*R0$+.

3.8. :)*3=#+,# %4/,634)& , >%++'" ,. XML )67#24%

A"(3&3-8 $"1#+)@$+")7 3.4 )&*"+7 # "*R0$+&8-, 10"*>"3-8- % ,)"?)&880. P&$-0 "*R0$+7 -#,".6(@=+#4, 0#.- % ,)-."/01-- +)0*@0+#4 "*)&*"+$& 3&117>, -80=D-#4 % 3"$@801+0 XML. S*R0$+7 ,"$&(&17 1& .-#+-1?0 3-7.

function Organization(){ this.name="myOrg"; this.comment="myComment"; this.depts=new Array; return this;

}

function Department(){ this.title="myOrg"; this.comment="myComment";

57

this.employees=new Array; this.telno="123";

return this;

}

function Employee(){ this.name="P?5"; this.salary=1000; return this;

}

+'*$'",. 3-5. G"1#+)@$+")7 "*R0$+"%

G"1#+)@$+") Organization() #"(3&0+ "*R0$+ ",)030.4=D-2 ")?&1-(&C-=. S)?&1-(&C-4 -800+ #%"2#+%& name - comment. A,-#"$ "+30."% ")?&1-(&C-- 3"./01 #"30)/&+6#4 % 8#-%0 depts. G"1#+)@$+") Department() -800+ #%"2#+%& title, comment - telno. A,-#"$ )&*"+1-$"% #"30)/-+#4 % 8#-%0 emploees. G"1#+)@$+") Employee ",)030.40+ "+30.61"?" )&*"+1-$&. 9 $&/3"?" )&*"+1-$& -80=+#4 #%"2#+%& name - salary.

D#7/1."'. %$4'?/$#3 ' 0%"";@ '2 XML #?L.9$%

H.4 %7,".101-4 302#+%-2 % ,)-."/01-- "*R0$+ 10"*>"3-8" %%0#+- ?."*&.61@= ,0)08011@=

var MyOrg=new Organization;

F0)08011&4 MyOrg 3"./1& #"30)/&+6 ,".1"0 ",-#&1-0 ")?&1-(&C--, %$.=:&4 ",-#&1-0 "+30."% - $&/3"?" #"+)@31-$& % "+30.0. L-#+-1? 3-6 ,"$&(7%&0+ B@1$C-=, -#,".14=D@= I+- 302#+%-4.

function setOrgDataFromXMLObj(xmlObj){ //9#+&1"%-+6 ",-#&1-0 ")?&1-(&C--

var organization=xmlObj.getElementsByTagName("organization"); MyOrg.name=organization[0].getAttribute("name"); MyOrg.comment=organization[0].firstChild.data;

var depts=organization[0].getElementsByTagName("department"); var emps;

for(var i=0;i<depts.length;i++){ MyOrg.depts[i]=new Department;

MyOrg.depts[i].title=depts[i].getAttribute("title");

MyOrg.depts[i].telno=depts[i].getAttribute("telno");

MyOrg.depts[i].comment=depts[i].firstChild.data; emps = depts[i].getElementsByTagName("employee"); for(j=0;j<emps.length;j++){

MyOrg.depts[i].employees[j]=new Employee; MyOrg.depts[i].employees[j].name=emps[j].getAttribute("name"); MyOrg.depts[i].employees[j].salary= parseInt(emps[j].getAttribute("salary"));

}

}

pageSetFormFieldsFromOrg();

}

+'*$'",. 3-6. F".@:01-0 3&117> -( XML "*R0$+&

58

Q@1$C-4 setOrgDataFromXMLObj(xmlObj) ,)-1-8&0+ % $&:0#+%0 ,&)&80+)& XML "*R0$+. <#0 3&.6102E-0 302#+%-4 ,)03,".&?&=+, :+" % "*R0$+0 -80=+#4 %#0 10"*>"3-870 I.0801+7, %$.=:&4 &+)-*@+7 - +0$#+"%70 @(.7.

F0)%&4 #+)"$& B@1$C--

var organization=xmlObj.getElementsByTagName("organization");

#"(3&0+ 8#-% XML "*R0$+"% – ")?&1-(&C-2. F"#$".6$@ (+&$ 87 @?"%")-.-#6), % XML -800+#4 +".6$" "31& ")?&1-(&C-4, +" organization[0] *@30+ 03-1#+%01178 I.0801+"8 I+"?" 8#-%&.

5+"*7 ,".@:-+6 (1&:01-0 &+)-*@+& name, -#,".6(@0+#4 80+"3 getAttribute(). N?" -#,".6("%&1-0 %7?.43-+ +&$:

MyOrg.name=organization[0].getAttribute("name");

H.4 +"?", :+"*7 ,".@:-+6 (1&:01-0 ,0)%"?" +0$#+"%"?" @(.&, "+1"#4D0?"#4 $ ")?&1-(&C--, -#,".6(@0+#4 #%"2#+%" firstChild. A.03@=D&4 #+)"$& ,"$&(7%&0+ 0?" ,)-80101-0.

MyOrg.comment=organization[0].firstChild.data;

H&.00 1&:-1&0+#4 ",-#&1-0 30,&)+&801+"%. !#-% 30,&)+&801+"% «depts» #"(3&0+#4 +&$/0, $&$ 8#-% ")?&1-(&C-2. J", ,"#$".6$@, 30,&)+&801+"% 10#$".6$", -> ,)->"3-+#4 ",)030.4+6 % C-$.0. H.4 $&/3"?" 30,&)+&801+& ",)030.4=+#4 0?" #%"2#+%&, ",)030.40870 &+)-*@+&8- #""+%0+#+%@=D0?" "*R0$+&. G"8801+&)-2 ",)030.40+#4 $&$ 3&1170 ,0)%"?" +0$#+"%"?" @(.&. A"+)@31-$- 30,&)+&801+"% ",)030.4=+#4 &1&."?-:1", % #&8"8 %1@+)01108 C-$.0 B@1$C-- ,"$&(&17 10"*>"3-870 302#+%-4.

F"#.0 +"?", $&$ ,0)08011&4 MyOrg ,".1"#+6= (&3&1&, 10"*>"3-8" ,)03#+&%-+6 (1&:01-4 00 ,".02 1& #+)&1-C0.

G%='*8 2"%1."'H 3 =#7( I#4:; ' $%?7'&/ #$0.7#3

H.4 %7,".101-4 I+-> 302#+%-2 -#,".6(@0+#4 B@1$C-4, ,)03#+&%.011&4 .-#+-1?"8 3-7.

function pageSetFormFieldsFromOrg(){

var myTable=document.getElementById("DeptsTab"); document.getElementById("orgName").value=MyOrg.name; document.getElementById("myOrgComment").value=MyOrg.comment; var len=MyOrg.depts.length;

var str="";

for(var i=0;i<=len;i++){ str+="<tr><td>1</td><td>2</td><td>2</td><td>2</td></tr>";

}

myTable.border=1;

myTable.innerHTML=str; myTable.rows[0].cells[0].innerHTML="63(+$"; myTable.rows[0].cells[1].innerHTML="D-??+)3".0#"; myTable.rows[0].cells[2].innerHTML="H+$+!-)"; myTable.rows[0].cells[3].innerHTML="C".,$"3"(BA?)"; for(var i=0;i<len;i++){

myTable.rows[i+1].cells[0].innerHTML=MyOrg.depts[i].title;

myTable.rows[i+1].cells[1].innerHTML=MyOrg.depts[i].comment;

myTable.rows[i+1].cells[2].innerHTML=MyOrg.depts[i].telno;

myTable.rows[i+1].cells[3].innerHTML=salaryTotal(MyOrg.depts[i].employees);

}

}

59

+'*$'", 3-7. V&,-#6 3&117> % ,".4 B")87 - +&*.-C@ "+30."%

S+30.6178 .-#+-1?"8 (3-8) ,"$&/08 B@1$C-=, %7:-#.4=D@= #@88&)1@= (&),.&+@ #"+)@31-$"% "+30.&.

function salaryTotal(emps){ var len=emps.length;

var sum=0;

for(var i=0;i<len;i++){ sum+=emps[i].salary;

}

return sum;

}

+'*$'", 3-8. <7:-#.01-0 #@88&)1"2 (&),.&+7 #"+)@31-$"% "+30.&

K+& B@1$C-4 I.0801+&)1" ,)"#+&, ,"I+"8@ ,)-%"3-+#4 *0( "*#@/301-4. <10E1-2 %-3 #+)&1-C7, # (&,".101178- ,".48- ,"$&(&1 1& )-#. 3-5.

)'*. 3-5. A+)&1-C& # ",-#&1-08 ")?&1-(&C-- - #,-#$"8 "+30."%

3.9. :)*+'; 4#204 (/,*)9#+,-

< ,".172 +0$#+ ,)-."/01-4 10"*>"3-8" %10#+- %#0 #C01&)--, )#8"+)01170 % I+"8 )&(30.0. H.4 ,".1"+7 -(."/01-4 ,)-%0308 $"3 HTML #+)&1-C7, & "*D@= $"8,"1"%$@ "#+&%-8 % %-30 @,)&/101-4. L-#+-1? 3-9 #"30)/-+ +)0*@0872 HTML $"3.

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>test</title>

</head>

<body onload='requestContent()'> <h1>XML Examples</h1>

<h2>How to open or create XML object</h2>

F"&1")0+ -.I")0&">00 <input type="text" id="orgName"/> <br/>

<textarea id="myOrgComment" style="width:300px;height:70px"></textarea> <br/>

60

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]