Saturday, February 13, 2010

FCKeditor-Javascript and Codeigniter integration

here is the script for your view:
<script src="<?php echo base_url()?>javascripts/fck/fckeditor.js" type="text/javascript">
</script>
<script type="text/javascript">
  window.onload = function(){
    var oFCKeditor = new FCKeditor('isi','100%','300','noUpload');
    oFCKeditor.BasePath = 'javascripts/fck/';
    oFCKeditor.Config['CustomConfigurationsPath'] = oFCKeditor.BasePath+'fckconfig.js?';
    oFCKeditor.Config['SkinPath'] = oFCKeditor.BasePath+'editor/skins/silver/';
    oFCKeditor.ReplaceTextarea();
  }
</script>
........
<form action="<?php echo site_url('admin/post/');?>" method="post">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr><td>
      <textarea cols="70" name="content" rows="15"><?php echo $content;?></textarea>
    </td></tr>
    <tr><th><input type="submit" value="Simpan" /></th></tr>
  </tbody></table>
</form>

thats only simple way

Thursday, February 4, 2010

Javascript Countdown Timer

<div style="float: right;">
   Time Remaining 
   <b id="min">0</b> minute(s) 
   <b id="sec">0</b> second(s)
</div>
<script>
dm=0;dd=5;

function remaining(){
   if(dd>=0){

      if(dm<0){
         alert('time is out');
      }else{
         document.getElementById('min').innerHTML=dm;
         document.getElementById('sec').innerHTML=dd;
         if(dd<=0){
            dd=60;
            dm--;
         }
         dd--;
         setTimeout('remaining()',1000);
      }
   }
}
remaining(); </script>