Welcome Guest, Not a member yet? Register   Sign In
Missing Javascript Function??
#1

[eluser]dhall[/eluser]
I am passing the following code from my Controller to my View:

Code:
$data['hrzone_button'] = array (
     'name' => 'hrzones',
     'type' => 'button',
     'class' => 'next',
     'value' => 'Calculate Heart Rate Zones',
     'onclick' => 'hrzones();'
   );

In my View I have the button to call the function:

Code:
echo form_submit($hrzone_button).br(2);

And at the bottom of my View I have the function:

Code:
[removed]  
function hrzones()
{
  var a = document.getElementById('fthr');  
  var b = document.getElementById('mhr');  
  var c = document.getElementById('hr1_min');
  c.value = parseInt(a.value) + parseInt(b.value);
}  
[removed]

When I run the page and click on the button nothing happens. I checked for an error in Firebug and it says this:

"hrzones is not a function"

What am I missing? I am sure it is something silly.
Thanks for the help!




Theme © iAndrew 2016 - Forum software by © MyBB