Aklımda Kalası Kelimeler

* давайте работать вместе
* Zarf ve Mazruf, Zerafet(xHoyratlık) ile aynı kökten(za-ra-fe) gelir
* Bedesten
* Suç subuta ermiştir - Suç sabit olmuştur
SELECT etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
SELECT etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

9 Mart 2010 Salı

Javascript ile Select içindeki seçili option elementinin sırasını değiştirmek



<html>
<head>
<script>

function moveItem(i){
var b,o=document.getElementById("s1"),p,q;
if(i==0 && o.selectedIndex > 0){
p = o.options[o.selectedIndex];
q = o.options[o.selectedIndex - 1]
o.removeChild(p);
o.insertBefore(p,q);
}
if(i==1 && o.selectedIndex < o.options.length-1){
b = o.selectedIndex < o.options.length - 2;
p = o.options[o.selectedIndex];
if(b) q = o.options[o.selectedIndex + 2]
o.removeChild(p);
if(b) o.insertBefore(p,q); else o.appendChild(p);
}
}

</script>
</head>
<body>
<table>
<tr>
<td rowspan=2>
<select id="s1" size=3>
<option>One
<option>Two
<option>Three
</select>
</td>
<td>
</tr>
<tr>
<td>
</tr>
</table>
</body>
<script>
</script>
</html>

27 Şubat 2009 Cuma

Birazda benden JQUERY

JQUERY
input tipi text olan elementleri 0. formda bulacak ve her birisi için dönecek.

function donFonksiyon() {
$.each($("input:text", document.forms[0]), function() {
alert(this.id);
}, null);
}


Select değişti seçili olanın text ve value sunu yazalım.

$("select").change(
function()
{
var SelectIdsi = this.id;
var selectedIndex = this.selectedIndex;
var seciliText = this.options[this.selectedIndex].text;
var seciliValue = this.value;
});

Select içinde bir option seçmek:

$('#select').selectOptions('secilecekOptionValue');


Seçili elementin değeri (bir kenarda dursun, Ref:JQUERY)

/* get the value from a dropdown select */
$('select#foo option:selected').val();

/* get the value from a checked checkbox */
$('input:checkbox:checked').val();

/* get the value from a set of radio */
$('input:radio[name=bar]:checked').val(); buttons



/* CheckBox ya da Radio seçiliyse değerini getir:
$("#rbCB:checked").val()

/* Radio seçilmiş mi?
$("#rbCB").is(":checked");

/* Using Name for selector */
$("input[@name='chkBox']").click(function(){
// your code here
});

/* Using ID for selector */
$("#chkBox").change(function(){
// your code here
});



Sayfanın Adresi: http://www.techiegyan.com/?p=112

Radio Button:

<input name="rdio" value="a" checked="checked" type="radio">
<input name="rdio" value="b" type="radio">
<input name="rdio" value="c" type="radio">

Handling change event for Radio buttons:
Click event can be handled similarly. ID can not be used here because Radio buttons are used for single selection from a group where all input fields of group should have same name.


$("input[@name='rdio']").change(function(){
if ($("input[@name='rdio']:checked").val() == 'a')
// Code for handling value 'a'
else if ($("input[@name='rdio']:checked").val() == 'b')
// Code for handling value 'b'
else
// Code for handling 'c'
});

Ayrıca eburhan.com da harika anlatımla JQUERY ziyafeti var duyrulur.