PDA

Zobacz pełną wersję : Obrazek ładowania



thc
22-05-2013, 15:24
Witam,
chcę zrobić coś takiego, żeby po kliknięciu 'dodaj ogłoszenie" (gdy trzeba chwile zaczekać, aż się doda) osoba dodająca widziała co się dzieje, że musi chwilę zaczekać, czyli żeby wyświetlił jej się jakiś .gif loader.. przypuszczam, że ten urywek kodu za to odpowiada


<button class="button2" type="button" id="submit_b" onclick="submit_checkt();"><?php echo JText::_('Dodaj ogłoszenie'); ?></button>
<input type="hidden" name="option" value="<?php echo $option;?>" />

<?php
if(JRequest::getVar('id', 0, '', 'int' )>0){
echo '<input type="hidden" name="view" value="saveEditItem" />';
echo '<input type="hidden" name="id" value="'.$this->nl->id.'" />';
echo '<input type="hidden" name="cat_id" value="'.$this->nl->cat_id.'" />';
}else{
echo '<input type="hidden" name="view" value="saveItem" />';
}
?>
<input type="hidden" name="boxchecked" value="0" />
</form>
</div>
</div>
<script type="text/javascript">

function addImage(imglimit){

lim=document.djForm['image[]'].length;
if(!lim){
lim=1;
}

if(document.djForm['usun[]']){
lim_old=document.djForm['usun[]'].length;
if(!lim_old){
lim_old=1;
}
lim = lim + lim_old;
}


if(lim==imglimit){
alert('<?php echo JText::_('Maximum number of images is');?> '+imglimit);
}else{
var inputdiv = document.createElement('input');
inputdiv.setAttribute('name','image[]');
inputdiv.setAttribute('type','file');

var ni = $('uploader');

ni.appendChild(document.createElement('br'))
ni.appendChild(inputdiv);
}

}

function submit_checkt(){

if(document.getElementById("name").value==''){
alert("<?php echo JText::_('Please enter title');?>");
}else if(document.getElementById("cat_id").value=='0'){
alert("<?php echo JText::_('Please select category');?>");
}else if(document.getElementById("intro_desc").value==''){
alert("<?php echo JText::_('Please enter description intro');?>");
}else if(document.getElementById("description").value==''){
alert("<?php echo JText::_('Please enter description');?>");
}else if(document.getElementById("contact").value==''){
alert("<?php echo Jtext::_('Please enter contact');?>");
}else{
document.djForm.submit();
}


function checkt(){
if(document.djForm.name.value.length<=40)
{
a=document.djForm.name.value.length;
b=40;
c=b-a;
document.getElementById('ile').innerHTML= ''+c+'';
}
else
{
document.djForm.name.value = document.djForm.name.value.substring (0, 40);
}
}
checkt();

</script>

ale nie wiem jaką komendę muszę wpisać, żeby zadziałało. Jest to urywek kodu DJClassifieds. Proszę o pomoc.
Adres strony gdyby był potrzebny w podpisie