troubleshooting Question

Javascript - set variable value from onMouseOver event

Avatar of sabecs
sabecs asked on
JavaScript
2 Comments1 Solution1245 ViewsLast Modified:
Can someone please show me how to set a variable via a onMouseOver event and then pass this value to a function via a Buy button.  

  onMouseOver='image.src="<?php echo $image2; ?>"; color = 1;'
  onMouseOver='image.src="<?php echo $image2; ?>"; color = 2;'

Buy Button  
onClick="location.href='javascript:AddItem(<?php echo $rs_prods['PID']?>,1,color)'"

function AddItem($PID, $qty, color)
      {
            var item = $PID;
            var qty = $qty;
            var color = color;

            self.location = "addtocart.php?action=add_item&id="+item+"&qty="+qty+"&color="+color;
            }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 2 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros