Webmaster Forumu | web Teknik |  

Go Back   Webmaster Forumu | web Teknik | > Server Side Programlama > Java & JSP Programlama

Cevapla
 
LinkBack Seçenekler Stil
Alt 30-07-2008, 20:38   #1
Moderator
 
Üyelik tarihi: 28-07-2008
Mesajlar: 1.000
Standart Pagination Combo Box

<style type="text/css">

.paginateselect{ /*CSS for select element*/
}

.paginatenext{ /*CSS for "Next" link*/
border:1px solid gray;
text-decoration: none;
background-color: lightyellow;
padding: 1px 2px;
margin-left: 5px;
}

.paginatenext:hover{
background-color: yellow;
}

.paginatestatusdiv{ /*CSS for DIV containing link to the next page*/
padding-top: 6px;
font-size: 14px;
}


</style>

<script type="text/javascript">

/***********************************************
* Pagination Combo Box- by JavaScript Kit (JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop)
* This notice must stay intact for usage
* Visit JavaScript Kit at JavaScript Kit- Your comprehensive JavaScript, DHTML, CSS, and Ajax stop for this script and 100s more
***********************************************/

var paginationcombo={
statusdivprefix: "<b>Next Page:</b> ", //Customize prefix text showing what the next link within combo will be
navigateonSelect: true, //Should combo go to URL as soon as a selection has been made within combo? True/false

////////Stop editing past here///////////////////

pcomboforms: [], //array to store references to forms containing paginate combos

navigate:function(selectobj){
window.location=selectobj.options[selectobj.selectedIndex].value
return false
},

hasClass:function(el, classname){
return (new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i").test(el.className))
},

init:function(){
var allforms=document.getElementsByTagName("form")
for (var i=0; i<allforms.length; i++){
if (this.hasClass(allforms[i], "paginateform"))
this.pcomboforms[this.pcomboforms.length]=allforms[i]
}
for (var i=0; i<this.pcomboforms.length; i++){ //form loop
var alltags=this.pcomboforms[i].getElementsByTagName("*")
for (t=0; t<alltags.length; t++){
if (this.hasClass(alltags[t], "paginateselect")){
this.pcomboforms[i].pselect=alltags[t] //store ref to <select class="paginateselect"> element
var selectobjindex=t //remember its index position within form
if (this.navigateonSelect)
this.pcomboforms[i].pselect.onchange=function(){paginationcombo.navig ate(this)}
}
else if (this.hasClass(alltags[t], "paginatenext")){
var pcomboform=allforms[i]
this.pcomboforms[i].pnext=alltags[t]
}
else if (this.hasClass(alltags[t], "paginatestatusdiv"))
this.pcomboforms[i].pstatus=alltags[t]
else if (alltags[t].tagName=="OPTION" && alltags[t].defaultSelected){
var selectedoptionindex=t-selectobjindex-1 //calculate default selected OPTION's index within SELECT element
this.pcomboforms[i].pselect.dfselected=selectedoptionindex //persist this index info inside custom property
}
}
if (this.pcomboforms[i].pstatus && typeof selectedoptionindex!="undefined"){
this.pcomboforms[i].pselect.selectedIndex=selectedoptionindex
var nextOption=this.pcomboforms[i].pselect.options[selectedoptionindex+1]
if (nextOption!=null){
this.pcomboforms[i].pnext.setAttribute("href", nextOption.value)
this.pcomboforms[i].pstatus.innerHTML=this.statusdivprefix+'<a href="'+nextOption.value+'">'+nextOption.text+'</a>'
}
else
this.pcomboforms[i].pnext.style.display="none"
}
} //END form loop
},

addEvent:function(target, functionref, tasktype){ //assign a function to execute to an event handler (ie: onunload)
var tasktype=(window.addEventListener)? tasktype : "on"+tasktype
if (target.addEventListener)
target.addEventListener(tasktype, functionref, false)
else if (target.attachEvent)
target.attachEvent(tasktype, functionref)
}

}

paginationcombo.addEvent(window, function(){paginationcombo.init()}, "load")

</script>

<form class="paginateform">

<select size="1" class="paginateselect">
<option value="http://www.google.com" selected="true">Build Your Own Rocket Article Page 1 </option>
<option value="http://images.google.com/">Build Your Own Rocket Article Page 2 </option>
<option value="http://groups.google.com">Build Your Own Rocket Article Page 3 </option>
<option value="http://news.google.com">Build Your Own Rocket Article Page 4 </option>
<option value="http://labs.google.com">Build Your Own Rocket Article Page 5 </option>
</select> <a href="#" class="paginatenext">Next</a>

<div class="paginatestatusdiv"></div>

</form>
Cw_Ozkan isimli Üye şimdilik offline konumundadır   Alıntı ile Cevapla
Cevapla

Seçenekler
Stil

Yetkileriniz
Konu Acma Yetkiniz Yok
Cevap Yazma Yetkiniz Yok
Eklenti Yükleme Yetkiniz Yok
Mesajınızı Değiştirme Yetkiniz Yok

BB code is Açık
Smileler Açık
[IMG] Kodları Açık
HTML-Kodu Kapalı
Trackbacks are Açık
Pingbacks are Açık
Refbacks are Açık
Hizli Erisim


Tüm Zamanlar GMT +3 Olarak Ayarlanmış. Şuanki Zaman: 16:25.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
WebTeknik - Webmaster Forumu - 2007 - 2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98