Correct img format for browser widget.

hh hh at hyperhh.de
Sun Jul 16 10:21:20 EDT 2017


An option for James could be to put ONE html-file in the images folder
with content:

<html><body><img id='jh' src=''></body></html>

And then set any image of that images folder by changing the HTML by
javascript:

on mouseUp
  put "flower2.png" into nn -- give the name directly
  put line 42 of myImages into nn -- a list containing the image names
  setImage nn,400,300
end mouseUp

on setImage iName,iWidth,iHeight
  put  "var jh = document.getElementById('jh');" & \
       "jh.setAttribute('src','" & iName & "');" & \
       "jh.setAttribute('width','" & iWidth & "');" & \
       "jh.setAttribute('height','" & iHeight & "');" & \
       "jh.setAttribute('alt','"&iName&"');" into js
  do js in widget "browser"
end setImage

(If there are several images to be displayed at once then simply replicate
the id in the html and correspondingly the js in the handler.)





More information about the use-livecode mailing list