Author Topic: Calling widget via javascript function for image button - needs help  (Read 957 times)

laurenell

  • Newbie
  • *
  • Posts: 15
Okay, I'm not great at javascript and would love some help.

What I'd like:

Graphic button on webpage.  Click it and it turns on a relay.

What I did, in the head I have:

function on()
{
    widgetSetState('ID', 1);

}  

This works fine, what doesn't work is the following.  It's quite strange, sometimes it actually works, but the next time it won't.

<FORM>
  <p>
    <INPUT TYPE="image" src="yes.jpg" name="yes" onclick="yes()" >
  </p>

I'm sure I've done something stupid - so any help?
</FORM>
« Last Edit: January 27, 2010, 01:10:45 PM by laurenell »

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 668
    • ioBridge Support
Re: Calling widget via javascript function for image button
« Reply #1 on: January 27, 2010, 01:06:05 PM »
Try:

onClick

Also, do you mean...?

onClick="on()"



ioBridge Support
Community Team

laurenell

  • Newbie
  • *
  • Posts: 15
Re: Calling widget via javascript function for image button - needs help
« Reply #2 on: January 27, 2010, 05:57:09 PM »
well, still no luck - you were right though I did mean 'on', thanks for the help, I think I'll just not use a form, since I got this to work fine:



<a href="#" onclick="on()"><img src="on.jpg" border="" /></a>

« Last Edit: January 27, 2010, 06:07:13 PM by laurenell »