-1

I have a gallery section in my website, and I want to upload an image that's injected with JavaScript.

I need the JavaScript to run when it's opened and enlarged by a modal box. How can I do that?

Ja͢ck
  • 170,779
  • 38
  • 263
  • 309

1 Answers1

2

Nope. Injection is not possible. To execute JavaScript when an image is loaded you can do

i = new Image();
i.onload = function() {}
i.src = '...';
Ja͢ck
  • 170,779
  • 38
  • 263
  • 309