Page 1 of 1

Going mental- Trying to get Scriptaculous to work!!

Posted: Sun Dec 27, 2009 2:20 pm
by Flashart
Hi

I'd like to think I am relatively savvy but every now and then along comes something to make me feel really dumb!

Ok so I am coding a php page. In the <Head> section I have:

Code: Select all

<head><link rel="stylesheet" type="text/css" href="local_adgroup_calc.css" />
<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
  <script type="text/javascript">
            function mouse_event(obj, newClass) {
                obj.className = newClass; }
        </script>
        <script language="JavaScript" src="javascripts/calendar_db.js"></script>
    <link rel="stylesheet" href="javascripts/calendar.css">
    
<script type="text/javascript">
Effect.BlindUp('kpi_selection');
Effect.BlindUp('kpi_selection', { duration: 3.0 });
There are some elements that I wish to initially hide which are these:

this link sits on top of the div


Code: Select all

 
echo "<a href='#' onclick='Effect.BlindDown('kpi_selection'); return false;'>Kpi Selection</a>";
 
echo "<div id='kpi_selection' style='none'>";
 
 
echo "<label for='clicks_btn' class='checkbox_label'>Clicks</label>";
echo "<input type='checkbox' name='clicks_btn' id='clicks_btn'</input>";
    
echo "<label for='impressions_btn' class='checkbox_label'>Impressions</label>";
echo "<input type='checkbox' name='impressions_btn' id='impressions_btn'</input>";
    
echo "<label for='ctr_btn' class='checkbox_label'>CTR</label>";
echo "<input type='checkbox' name='ctr_btn' id='ctr_btn'</input>";
    
echo "<label for='cpc_btn' class='checkbox_label'>CPC</label>";
echo "<input type='checkbox' name='cpc_btn' id='cpc_btn'</input><BR>";
    
echo "<label for='conv_btn' class='checkbox_label'>Conv</label>";
echo "<input type='checkbox' name='conv_btn' id='conv_btn'</input>";
    
echo "<label for='conv_mpc_btn' class='checkbox_label'>Conv_mpc</label>";
echo "<input type='checkbox' name='conv_mpc_btn' id='conv_mpc_btn'</input>";
 
echo "<label for='cost_btn' class='checkbox_label'>Cost</label>";
echo "<input type='checkbox' name='cost_btn' id='cost_btn'</input>";
echo "<label for='avg_pos_btn' class='checkbox_label'>Avg_Position</label>";
echo "<input type='checkbox' name='avg_pos_btn' id='avg_pos_btn'</input>";
echo "<input type='submit' class='kpi_apply' name='kpi_apply_btn' value='Apply'/>";
    
echo "</div>";


Basically it doesn't work. Clicking on the link does nothing. Am I missing something simple and important? (obviously...)

I have read and re-read the scriptaculous wiki page for this effect, looked at their source code, searched google but I am no closer to an answer.

Please let their be someone more savvy than me who is gracious enough to point out my error?!

Many thanks
Peter

Re: Going mental- Trying to get Scriptaculous to work!!

Posted: Sun Dec 27, 2009 4:28 pm
by Flashart
OK so yes i had been a bit dumb.

After scrabbling around on the web for a few more hours (and having a coffee) I now have this

Code: Select all

<head><script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
   // <![CDATA[
   function action(element){
    new Effect.BlindDown(element, 
        { duration: 2
        });
   }
   // ]]>
   </script></head>
and then on the elements i want to hide i have

Code: Select all

echo "<div id='id' onclick'action(this);'>";
 
echo "click here";
 
echo "<label for='clicks_btn' class='checkbox_label'>Clicks</label>";
echo "<input type='checkbox' name='clicks_btn' id='clicks_btn'</input>";
    
echo "<label for='impressions_btn' class='checkbox_label'>Impressions</label>";
echo "<input type='checkbox' name='impressions_btn' id='impressions_btn'</input>";
    
echo "<label for='ctr_btn' class='checkbox_label'>CTR</label>";
echo "<input type='checkbox' name='ctr_btn' id='ctr_btn'</input>";
    
echo "<label for='cpc_btn' class='checkbox_label'>CPC</label>";
echo "<input type='checkbox' name='cpc_btn' id='cpc_btn'</input><BR>";
    
echo "<label for='conv_btn' class='checkbox_label'>Conv</label>";
echo "<input type='checkbox' name='conv_btn' id='conv_btn'</input>";
    
echo "<label for='conv_mpc_btn' class='checkbox_label'>Conv_mpc</label>";
echo "<input type='checkbox' name='conv_mpc_btn' id='conv_mpc_btn'</input>";
 
echo "<label for='cost_btn' class='checkbox_label'>Cost</label>";
echo "<input type='checkbox' name='cost_btn' id='cost_btn'</input>";
echo "<label for='avg_pos_btn' class='checkbox_label'>Avg_Position</label>";
echo "<input type='checkbox' name='avg_pos_btn' id='avg_pos_btn'</input>";
echo "<input type='submit' class='kpi_apply' name='kpi_apply_btn' value='Apply'/>";
    
echo "</div>";
 
 
But still no dice.

It's driving me mad!

Re: Going mental- Trying to get Scriptaculous to work!!

Posted: Sun Dec 27, 2009 4:55 pm
by Flashart
Further development but still no joy

now i have

Code: Select all

<script src="javascripts/prototype.js" type="text/javascript"></script>
<script src="javascripts/scriptaculous.js" type="text/javascript"></script>
 
 <script type="text/javascript">
   function BUDEffect(element){
       new Effect.toggle(element,'Blind', {duration:3});
   }
    </script>
in the head and:

Code: Select all

echo "<div onclick='BUDEffect('kpi_selection')'>";
  echo "Click me to Blind Up and Blind Down";
echo "</div>";
 
 
 
echo "<div id='kpi_selection' onclick='AppearEffect(this)'>";
 
echo "<label for='clicks_btn' class='checkbox_label'>Clicks</label>";
echo "<input type='checkbox' name='clicks_btn' id='clicks_btn'</input>";
    
echo "<label for='impressions_btn' class='checkbox_label'>Impressions</label>";
echo "<input type='checkbox' name='impressions_btn' id='impressions_btn'</input>";
    
echo "<label for='ctr_btn' class='checkbox_label'>CTR</label>";
echo "<input type='checkbox' name='ctr_btn' id='ctr_btn'</input>";
    
echo "<label for='cpc_btn' class='checkbox_label'>CPC</label>";
echo "<input type='checkbox' name='cpc_btn' id='cpc_btn'</input><BR>";
    
echo "<label for='conv_btn' class='checkbox_label'>Conv</label>";
echo "<input type='checkbox' name='conv_btn' id='conv_btn'</input>";
    
echo "<label for='conv_mpc_btn' class='checkbox_label'>Conv_mpc</label>";
echo "<input type='checkbox' name='conv_mpc_btn' id='conv_mpc_btn'</input>";
 
echo "<label for='cost_btn' class='checkbox_label'>Cost</label>";
echo "<input type='checkbox' name='cost_btn' id='cost_btn'</input>";
echo "<label for='avg_pos_btn' class='checkbox_label'>Avg_Position</label>";
echo "<input type='checkbox' name='avg_pos_btn' id='avg_pos_btn'</input>";
echo "<input type='submit' class='kpi_apply' name='kpi_apply_btn' value='Apply'/>";
    
echo "</div>";
 
again it works on the online tutorial but not in my code! Gonna go back to potato picking i think..