|
|
|
не могу построить XML с помощью each
|
|||
|---|---|---|---|
|
#18+
<html> <head> <meta http-equiv="Content-Type" content="text/html;"/> <style type="text/css"> ${CSS!".body {font-family:sans-serif;}"} </style> <script type="text/javascript" src=" http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script src=" http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script> <link href=" http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> </head> <body> <div id='block1' name='block1'> <ul id='list' name='list'> <div id='block2' name='block2'> <li>1.1 <input type='text' required name="addres" id="addres" value="${addres}" style="margin: 2px; width: 250;"></li> <li>1.2 <input type='text' required name="addres" id="addres" value="${addres}" style="margin: 2px; width: 250;"> <ul id='list3' name='list3'> <li>1.2.1 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> <li>1.2.2 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> <li>1.2.3 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> </ul> </li> </div> </ul> </div> <div id='block1' name='block1'> <ul id='list' name='list'> <div id='block2' name='block2'> <li>2.1 <input type='text' required name="addres" id="addres" value="${addres}" style="margin: 2px; width: 250;"></li> <li>2.2 <input type='text' required name="addres" id="addres" value="${addres}" style="margin: 2px; width: 250;"> <ul id='list3' name='list3'> <li>2.2.1 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> <li>2.2.2 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> </ul> </li> </div> </ul> </div> <div id='block1' name='block1'> <ul id='list' name='list'> <div id='block2' name='block2'> <li>3.1 <input type='text' required name="addres" id="addres" value="${addres}" style="margin: 2px; width: 250;"> <ul id='list3' name='list3'> <li>3.1.1 <input type='text' required name="home" id="home" value="${home}" style="margin: 2px; width: 250;"></li> </ul> </li> </div> </ul> </div> <button type='button' name='button222' id='button222'>сформировать XML</button> <textarea name='xml' id='xml' value='${xml}' style="margin: 2px; width: 250;"></textarea> </body> <script type="text/javascript"> $(document).ready(function () { $("#button222").live('click',function(event) { // $("#outcome").click(function () var str; var str_j; str="<objects>"; str_j=""; $('#list [name="block2"]').each(function (){ //$('#member').each(function (){ str=str+"<object>"; str=str + "<addres>" + $(this).find('[name="addres"]').val()+ "</addres>" ; //str=str + "<home>" + $(this).find('[name="home"]').val()+ "</home>" ; $('#block2 [name="list3"]').each(function (){ str_j=str_j + "<home>" + $(this).find('[name="home"]').val()+ "</home>"; }); str=str + str_j; str_j=""; str=str+"</object>"; $("#xml").val($("#xml").val() + str + " "); }); str=str+"</objects>"; $("#xml").val(str); }); }); </script> </html> ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:04 |
|
||
|
не могу построить XML с помощью each
|
|||
|---|---|---|---|
|
#18+
а задача-то какая? зачэм xml нужен? может, просто http://api.jquery.com/serialize/ заюзать? ЗЫ а дублировать id некрасиво ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:11 |
|
||
|
не могу построить XML с помощью each
|
|||
|---|---|---|---|
|
#18+
angel__2003не могу построить XML с помощью each Это сожаления достойно. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:13 |
|
||
|
не могу построить XML с помощью each
|
|||
|---|---|---|---|
|
#18+
а задача-то какая? зачэм xml нужен? может, просто http://api.jquery.com/serialize/ заюзать? ЗЫ а дублировать id некрасиво ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:39 |
|
||
|
не могу построить XML с помощью each
|
|||
|---|---|---|---|
|
#18+
автора задача-то какая? зачэм xml нужен? может, просто http://api.jquery.com/serialize/ заюзать? ЗЫ а дублировать id некрасиво просто эти id одинаковые создаются при помощи клонов на страницы ввода данных потом надо их собрать в xml ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.03.2013, 11:41 |
|
||
|
|

start [/forum/topic.php?fid=22&msg=38197047&tid=1448547]: |
0ms |
get settings: |
9ms |
get forum list: |
18ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
87ms |
get topic data: |
13ms |
get forum data: |
3ms |
get page messages: |
62ms |
get tp. blocked users: |
2ms |
| others: | 244ms |
| total: | 446ms |

| 0 / 0 |
