• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
migrate prototype to jquery

#1
[eluser]alexaaaaaaaaaa[/eluser]
Ok, first of all i'm very very sorry that i use this forum for something about javascript but i really need it.
Here's what i have done.
I have created a drop down with categories and subcategories (cascading drop down) and i use prototype for that, and the problem is that when i put prototype side by side with jquery doesn't work.
So what i want is to migrate or convert prototype code into jquery
Here's my prototype code
Code:
document.getElementById('test')[removed] = '<img src="&lt;?php echo image_url('load3.gif');?&gt;" alt="loading" />' + 'Loading'
function getCat(id,count,catid){

    document.getElementById('catInner')[removed] = '<img src="&lt;?php echo image_url('load.gif');?&gt;" alt="loading" />' + ' Loading'
    
    for(i=0;i<count;i++)
  {
    
    if(i == id)
      {
           document.getElementById("gr"+i).setAttribute("class", "selected");        
        document.getElementById("gr"+i).setAttribute("className", "selected");        
      }    
      else
      {
          document.getElementById("gr"+i).setAttribute("className", "");
        document.getElementById("gr"+i).setAttribute("class", "");
      }
  }
    
    new Ajax.Request('&lt;?php echo $base_url.'/home/getCate/'; ?&gt;'+catid,


  {

    method:'get',

    onSuccess: function(transport){

      var response = transport.responseText || "no response text";

      document.getElementById('catInner')[removed] = response

    },

    onFailure: function(){ alert('Something went wrong...') }



  });



}



&lt;?php

if($groups->num_rows()>0)
{
    $row_count=$groups->num_rows();
    $i=0;
    foreach ($groups->result() as $catarray)
    {
        if($i==0)
        {
        $firstcatid=$catarray->id;
          $i++;
        }
    }    
}

?&gt;

&lt;?php if($groups_num > 0){?&gt;
getCat('0','&lt;?php echo $row_count; ?&gt;','&lt;?php echo $firstcatid; ?&gt;');
&lt;?php } ?&gt;
Thanks in advance and sorry again.
ps. i have checked jquery forum.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.