Witam znalazłem taki oto skrypt: http://www.dynami...input2.htm
i połączyłem go z Tinychat.
1. Kopiujemy
<style type="text/css">
.progress{
width: 1px;
height: 14px;
color: white;
font-size: 12px;
overflow: hidden;
background-color: navy;
padding-left: 5px;
}
</style>
<script type="text/JavaScript">
/***********************************************
* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/
* Modified by Dynamic Drive for minor changes
* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com
* Please keep this notice intact
***********************************************/
function textCounter(field,counter,maxlimit,linecounter) {
// text width//
var fieldWidth = parseInt(field.offsetWidth);
var charcnt = field.value.length;
// trim the extra text
if (charcnt > maxlimit) {
field.value = field.value.substring(0, maxlimit);
}
else {
// progress bar percentage
var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
document.getElementById(counter).style.width = parseInt((fieldWidth*percentage)/100)+"px";
document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
// color correction on style from CCFFF -> CC0000
setcolor(document.getElementById(counter),percentage,"background-color");
}
}
function setcolor(obj,percentage,prop){
obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}
</script>
do bannerów
2. W infusions/ls_tinychat_panel/ls_tinychat.php zamieniamy
echo "<input name='chat_message' class='textbox' style='width:100%;'>
na
<input rows='5' cols='40' name='chat_message' id='maxcharfield'
onKeyDown=textCounter(this,'progressbar1',20)
onKeyUp='textCounter(this,'progressbar1',20)'
onFocus='textCounter(this,'progressbar1',20)' ><br />
<div id='progressbar1' class='progress'></div>
<script>textCounter(document.getElementById('maxcharfield'),'progressbar1',20)</script>
I już!
Proszę o przeniesienie tematu do działu modyfikacje skryptów.
Edytowane przez kowarufubu dnia 09.04.2010 10:40:09
|