I have a jsp page that has buttons, and when i click the button a modal will open, and whatever happens inside that modal is linked with a js file (no more jsp). So here is my table inside modal (js file) :

```
html = '<table style="width:400px;height:250px;">'

    + '<tr><td title="grp"><img id="groupBtn" src="group.png"></td>'

            +'<td title="1st"><img id="1stBtn" src="1st.png""></td>'

```

as you can see, it's html code in js file and not normal code from jsp. (I don't know the exact term.)

Therefor I can't write the `<style></style>` tag for that table made in js file.

What I want to do: 
change the image while I'm clicking the button; not mouse enter, not image change, but `a:active`.

My problem:
it's in `img` tag and not `a` tag 

so i tried

```
+ '<tr><td title="그룹"><a id="test1><img id="groupBtn" src="group.png"></a></td>'

```

this but the problem is i don't know where to put

```css
#test1:active{
    background-image : url('clicked.png');
}

```

while googling i found out this won't work because this is not how you change the src in img tag. 

```
html = '<table style="width:400px;height:250px;">'

    + '<tr><td title="grp"><img id="groupBtn" src="group.png"></td>'

            +'<td title="1st"><img id="1stBtn" src="1st.png""></td>'

```

^ How should I reform this `<img id=>` to something that could work with `a:active` tag? Or, should i never even use a tag and just change the whole tag into something else? plus, if i want to give style to elements that were created in js file by html, where should i add the style tag?

---

To save your precious time helping me, i want to summarize a bit,
I want the image on my button to change only when my mouse is clicked (pressed more precisely) and then my mouse is no more pressed, i want my button image to return to original image. Thats why I said i want something that works like `a:active` tag cause it only changes your css when the mouse is pressed and changes back when mouse isnt pressed anymore !