in reply to Re^3: Mouse action using SVG
in thread Mouse action using SVG

It doesn't seem to work for me. I want to show the message which is stored in $message when I click the rectangle. I modified the code this way.
$svg->rectangle( x =>$x1, y =>$y1, width => $x2, height => $y2, style => { 'fill' => 'rgb(0, 0, 128)', 'stroke' => 'black', 'stroke-width' => 1, 'stroke-opacity' => 1, 'fill-opacity' => 1, }, ); $rectangle->attrib(onclick=>q{alert($message);});
Please correct me if I am wrong

Replies are listed 'Best First'.
Re^5: Mouse action using SVG (troubleshooting)
by tye (Sage) on Jul 30, 2016 at 19:26 UTC

    Of course that doesn't work. Did you look at the debug "console" of your browser to check for javascript errors? Why not? Did you look at the HTML that was produced/sent? Why not?

    After you've done that, you might also want to read the subtread at Re^7: perl dancer route template hashref pass complex json file to server issue (escape/filter).

    I'm not going to post code that I think will work for this case yet, as I think it is important for you to think more about this aspect of the problem before being handed code.

    - tye