Regular link posts string?

I think this requires javascript, but i dont know how to do it.

I can’t do:
<a href=“file.php?logged=1”>link</a>

is is there a way to do this:
<a onClick=“post something here”>link</a>
or
<a onClick=“function(true, file.php)”>link</a>

where i could get logged.

any help would be apprecieted. or if its not possible please tell me.