PDA

View Full Version : یک تغییر کوچک در یک کد جاوا



parandweb
دوشنبه 17 تیر 1392, 19:59 عصر
با سلام به کد زیر توجه کنید:



<!doctype html> <html lang="en"><head> <meta charset="utf-8" /> <title>jQuery UI Selectable - Serialize</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <style> #feedback { font-size: 1.4em; } #selectable .ui-selecting { background: #FECA40; } #selectable .ui-selected { background: #F39814; color: white; } #selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; } #selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; } </style> <script> $(function() { $( "#selectable" ).selectable({ stop: function() { var result = $( "#select-result" ).empty(); $( ".ui-selected", this ).each(function() { var index = $( "#selectable li" ).index( this ); result.append( " #" + ( index + 1 ) ); }); } }); }); </script></head><body> <p id="feedback"><span>You've selected:</span> <span id="select-result">none</span>.</p> <ol id="selectable"> <li class="ui-widget-content">Item 1</li> <li class="ui-widget-content">Item 2</li> <li class="ui-widget-content">Item 3</li> <li class="ui-widget-content">Item 4</li> <li class="ui-widget-content">Item 5</li> <li class="ui-widget-content">Item 6</li></ol> </body></html>

همانطور که می دانید این کد شماره جدول های انتخاب شده را نشان می دهد من می خوام برای هر کدام از li ها آی دی تعریف کنم و زمانی که آن li انتخاب شد مقدار آی دی اون به خروجی ارسال شود

در ضمن آیا می شود خروجی که این کد در


<span id="select-result">none</span>

می دهد را به:

<script>id="shenase ha inja nemayesh dade shavad";</script>

از لطفتون سپاسگذارم