How to convert this "PROMPT" code to take input from an "IFRAME/POPUP" instead?

This is the js code:


u= prompt(" Enter a http:// image path ");
if( u.substring(0,3)=="htt" ){
text= "[image]" + u.trim() + "[/image]";
}
//update main webpage here using "text"
Code (markup):

Instead of asking user to type a URL of image, I was thinking of showing them a webpage, either in iframe or in popup, where they can select an image from a dropbox.
That will be much easier than typing URL...
I'll make...

How to convert this "PROMPT" code to take input from an "IFRAME/POPUP" instead?

from JavaScript https://ift.tt/2AI2wr0
via IFTTT