Dynamic image on page where img src changes based on parameter in url

I was wondering if it was possible to change an image source on a page based on a url parameter? Perhaps using Javascript?

For example, if we have the default image with an ID?

The scenario would be, http://example.com/page-name/?image-id=specifiedimg

and this would load the image as what the source is set for “specifiedimg”

Hoping that makes sense?