Q:

Insert a variable into a URL

I'm a newbie here.
I would like to insert a value from JS variable into a URL part of an  tag.
<script language="javascript" type="text/javascript">
  var scrt_var = "xyz_nt"; 
</script

For example, take the above value and insert/replace in the below img src where it reads 'insert value here'.
 <TD>
   <img src="https://test.com/?target=alias(keepLastValue(aggregates.*.servera_*.abc-insert value here.errors)%2C%20'Errors')&preventCache=25308886"  height="250" width="620" />
 </TD>

Any help would be really appreciated.

A:

You can add an ID to your img and do something like:
<script>
    var scrt_var = "xyz_nt";
    var mylink = "http://your_url?your_var=" + scrt_var;
    document.getElementById('image').src = mylink;
</script>

