Вы находитесь на странице: 1из 13

web 1 .

web 1 ......................................................................................1
........................................................................................................................1
.......................................................................................................................1
1. !..........................................................................................................2
2. ..........................6
3. ................................................................................10
jQuery jGrid.. 10


web 1 . 1' web
web 1 ,
Web 1. web 1
. Web .
. Web .
web web 8.1 javascript.
web javascript
. 8.2
, .
8.2 - .
8.2 .
web
, . , ,
. .
Web . XDTO
1. 2 3
. web
.
, 1
. ,
. web
.
1', 8.1. javascript ,
javascript.
web 1 v 8.1,
web .


1:
.cf. XDTO
web . .
web 1 web . , web
1 .rar, 2
.rar 3 .rar.

1. !
1 .
Hello world!, !.
1 web 1.
1 .
1.1 web
Web
.
.
web . ,
1' http://www.sample-package.org.
, XDTO .
, , preved.1cws.
web
.

web
. :
()
" , !"

1.2

web

file:///C:/Program%20Files/1cv81/AddDoc/RU/V8AddDoc81.htm#_Toc176167634

2 web . 1.
3 1.
, 1
.
4 web
4.1
html :
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> !</title>
<script type="text/javascript" src='preved.js'> </script>
<body>
<p>
<input id="MyButton" type="button" onclick="()" value=" web "/>
</p>
<p id=""></p>
</body>
</html>

html web , , preved.htm.


utf-8.
4.2 javasript , ,
.
javascript :
// browser
function (){
var userAgent = navigator.userAgent.toLowerCase();
//
browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
firefox3: /firefox\/3/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
firefox2: /firefox\/2/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
firefox1: /firefox\/1/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
}
}
// , /.
// , .
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {

try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
// , . FF 3.0 "m:".
function (){
if (browser.msie || browser.firefox3) return "m:" +
else return
}
//
function (xmlhttp){
if (xmlhttp.readyState == 4) {// .
if(xmlhttp.status != 200) {// -
alert(" . : " + xmlhttp.responseText)
}
else{/* . , ,
.
javaScript . http://javaScript.ru
responseXML xmlhttp
responseXML - DOM*/
var = xmlhttp.responseXML.getElementsByTagName(("return"))[0] // "m:return" -
IE, "return" - FF
var = .childNodes[0].data
document.getElementById("").appendChild(document.createTextNode())
}
// .
document.getElementById("MyButton").value = " web "
document.getElementById("MyButton").disabled = false
}
}
// .
function (){
()
var xmlhttp = getXmlHttp()
// POST, - , true ,
,
xmlhttp.open('POST', 'preved.1cws', true)// preved.1cws ,
preved.htm. , , : '/./ws/preved.1cws'
// - ()
xmlhttp.onreadystatechange = function() {(xmlhttp)}
// XML.
xmlhttp.send('<?xml version="1.0" encoding="UTF-8"?>' +
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/>' +
'<soap:Body> <m: xmlns:m="http://www.sample-package.org"/> </soap:Body>' +
'</soap:Envelope>')
// , . .
document.getElementById("MyButton").value = " ..."
document.getElementById("MyButton").disabled = true
}

preved.js preved.htm.
utf-8.
! xmlhttp.open('POST', 'preved.1cws', true)
preved.1cws. web
.

4.3

(),
http://localhost/preved.1cws :
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/>
<soap:Body> <m: xmlns:m="http://www.sample-package.org"/> </soap:Body>
</soap:Envelope>

4.4


.
xmlhttp xmlhttp.responseText
xmlhttp.responseXML xml.
:
(xmlhttp),

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header/>
<soap:Body> <m:Response xmlns:m="http://www.sample-package.org">
<m:return xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> , !</m:return>
</m:Response></soap:Body>
</soap:Envelope>


xmlhttp.responseXML .
javascript DOM. xml, 1,
Internet explorer' FireFox'3 m:,
FireFox'2

m:.

xmlhttp.responseXML.getElementsByTagName("return")[0] FireFox'2
. Internet Explorer' FireFox'3
xmlhttp.responseXML.getElementsByTagName("m:return")[0]
5 document.getElementById("").appendChild(document.createTextNode())
.
6 .
6.1 javascript FireBug FireFox'
http://www.getfirebug.com/ DOM
, web , , , ,
javascript.
6.2 web web
http://localhost/preved.1cws?wsdl,
, 1
web . .
1 web ,
javascript'.
, 1.
1 HttpAnalyzer IEInspector.

, 15
.
6.3 javascript html
SciTE http://scite.ruteam.ru

2.

. web
.
1 web 1
1.1
XDTO. XDTO
. ,
string, . ,
.
,
. web ,
, .

2 web . XDTO . Web



.
.

XDTO .
. web :
()

= ;
. = "
|
.,
|
.,
|
.. ,
|
.. ,
|
.. ,
|
..
|
|
.
|
|
. = &";
() <> ""
. = . + " ..
&";
.("", "%" + () + "%");
;
.("", );
. = . + "
| ";
= XDTO.("http://www.sample-package.org", "");
= XDTO.("http://www.sample-package.org", "");
= XDTO.();
= .().();
.()
= XDTO.();
. = .;
. = .;
. = .;
. = .;
. = (.);
. = (..());
..();
;

3 .
Web sotrudniki.html :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src='sotrudniki.js'></script>
</head>
<body>
<p> :
<input id="" type="text"/>
<input id="MyButton" type="button" onclick="()" value=" "/>
</p>
<TABLE id="" border="1" cellspacing="0">
<TBODY>
<TR>
<td id=""></TD>
<td id=""></TD>
<td id=""> </TD>
<td id=""></TD>
<td id=""></TD>
<td id=""></TD>
</TR>
</TBODY>
</TABLE>
</body>
</html>

javascript sotrudniki.js

// browser
function (){
var userAgent = navigator.userAgent.toLowerCase();
//
browser = {
version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [])[1],
safari: /webkit/.test( userAgent ),
opera: /opera/.test( userAgent ),
msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
firefox3: /firefox\/3/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
firefox2: /firefox\/2/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent ),
firefox1: /firefox\/1/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
}
}
// , /.
// , .
function getXmlHttp(){
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
// , . FF 3.0 "m:".
function (){
if (browser.msie || browser.firefox3) return "m:" +
else return
}
//
// - , , - , ,
- ,
function (, , ){
var = document.createElement("td")
var = .getElementsByTagName(())[0]
var = ""
if (.hasChildNodes()) = .childNodes[0].data
.appendChild(document.createTextNode())
.appendChild()
}
//
function (xmlhttp){
if (xmlhttp.readyState == 4) {// .
if(xmlhttp.status != 200) {// -
alert(" . : " + xmlhttp.responseText)
}
else{
//
var = xmlhttp.responseXML.getElementsByTagName((""))
//
var = document.getElementById("").getElementsByTagName("tbody")[0]
// tbody
// ,

while (.rows.length>1) .deleteRow(1)


for (var = 0; < .length; ++){
var = document.createElement("tr")
.appendChild()
(, [], "")
(, [], "")
(, [], "")
(, [], "")
(, [], "")
(, [], "")
}
}
// . .
document.getElementById("MyButton").value = " . " + + "
."
document.getElementById("MyButton").disabled = false
}
}
function (){
var xmlhttp = getXmlHttp()
()
// POST, - , true ,
,
xmlhttp.open('POST', 'sotrudniki.1cws', true) // , , : '/./ws/sotrudniki.1cws'
// - ()
xmlhttp.onreadystatechange = function() {(xmlhttp)}
// . .
xmlhttp.setRequestHeader("Content-Type", "text/xml") // Set some headers: the body of this POST request is XML
xmlhttp.setRequestHeader("SOAPAction", '""') // This header is a required part of the SOAP protocol
xmlhttp.send('<?xml version="1.0" encoding="UTF-8"?> ' +
'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> ' +
'<soap:Body> <m: xmlns:m="http://www.sample-package.org"> '+
'<m: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> '
+document.getElementById('').value+' </m:> '+
'</m:> </soap:Body> </soap:Envelope>')
// .
document.getElementById("MyButton").value = " ..."
document.getElementById("MyButton").disabled = true
}

sotrudniki.html, sotrudniki.js, sotrudniki.1cws


.
, web :

4
javascript http://javascript.ru

web . ,
, - . Web
, , .
web 1.

3.
javascript .

. jQuery
javascript. http://www.jquery.com.
,
. jQuery, jGrid,
. http://www.trirand.com/blog/. jGrid
web .
jQuery jGrid , .
. jGrid ,
jGrid , ,
, .


jQuery jGrid.
jQuery 1.2.3 jGrid 3.1.
.
jQuery Internet Explorer'
Firefox'3 xml, 1. m
, m\\:, Firefox'2
.
jGrid web 1 .

grid.base.js :

jGrid 3.1 xml, 1.


$(ts.p.xmlReader.root+">"+ts.p.xmlReader.row,xml).each( function( j )
> .
. , , .

jGrid web JSON . 1


XML. jGrid. $.ajax({url:
ts.p.url,type:ts.p.mtype,dataType:"xml",data: gdata, complete $.ajax({url:
ts.p.url,type:ts.p.mtype,dataType:"xml",data: ts.p.postData.request, complete . -

. ,
gdata XML ts.p.postData.request. , ,
, jQuery jGrid.

jGrid web . web


, . html , javascript
.
.
jGrid. jQuery .
. jGrid ,
, , ,
. :
javascript (JSON) XML.
jQuery , web 1:

,
. .
,
, , ,
. . 1

, 1,
web .
sotrudnikiJQ.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" media="screen" href="themes/basic/grid.css" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src='jquery-1.2.3.js'></script>
<script type="text/javascript" src='grid.base.js'></script>
<script type="text/javascript" src='sotrudnikiJQ.js'></script>
</head>
<body>
<p> :
<input id="" type="text"/>
<input id="MyButton" type="button" onclick="()" value=" "/>
</p>
<table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
</body>
</html>

sotrudnikiJQ.js
// , FF3. FF3 "m\\:".
// JQuery . FF3 "1.9". ,
.
function (){
if ($.browser.msie || ($.browser.mozilla && $.browser.version == "1.9")) return "m\\:" +
else return
}
function (){
// .
document.getElementById("MyButton").value = " ..."
document.getElementById("MyButton").disabled = true
if ($("tbody", "#list").children().length == 0){//
$("#list").jqGrid({
url: 'sotrudniki.1cws', // , , : '/./ws/sotrudniki.1cws'
datatype: 'xml',
mtype: 'POST',
postData:{request:'<?xml version="1.0" encoding="UTF-8"?> ' +
'<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> ' +
'<soap:Body> <m:
xmlns:m="http://www.sample-package.org"> '+
'<m: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
'+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> '+
document.getElementById('').value+'
</m:> '+
'</m:> </soap:Body> </soap:Envelope>'},
colNames:['','', ' ','','',''],
colModel :[
{name:'',index:'', width:55, xmlmap:('')},//xmlmap:'m\\:' IE
{name:'',index:'', width:180, align:'left',
xmlmap:('')},
{name:' ',index:'', width:90, datefmt:'Y-m-d',
xmlmap:('')},//xmlmap:'m\\:' IE
{name:'',index:'', width:80, align:'left', xmlmap:('')},
{name:'',index:'', width:40,align:'left', xmlmap:('')},
{name:'', width:150, xmlmap:(''), hidden:true} ],
rowNum:10,
sortname:'',
sortorder: "desc",
width:800,
height:400,

viewrecords: true,
imgpath:'themes/basic/images',
caption: ' ',
xmlReader : {
root: ("return"), //root: "m\\:return" IE
row: (""),//row: "m\\:" IE
repeatitems: false,
id: ""
},
loadComplete: function(){//
document.getElementById("MyButton").value = " "
document.getElementById("MyButton").disabled = false
}
})
}
else {//
$("#list").setGridParam({
postData:{request:'<?xml version="1.0" encoding="UTF-8"?> ' +
'<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> ' +
'<soap:Body> <m:
xmlns:m="http://www.sample-package.org"> '+
'<m: xmlns:xsd="http://www.w3.org/2001/XMLSchema"
'+
'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> '+
document.getElementById('').value+'
</m:> '+
'</m:> </soap:Body> </soap:Envelope>'}
})
$("#list").trigger("reloadGrid")
}
}
Copyright (c) 2008, , lyay@yandex.ru
Dual licensed under the MIT and GPL licenses:
http://www.opensource.org/licenses/mit-license.php
http://www.gnu.org/licenses/gpl.html
Date: 2008-06-29