<!DOCTYPE HTML>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body> <p id="bamForm"></p>
<script type="text/javascript">
function pipa() {
alert("Скрипт работает");
}
var wos = document.getElementById("bamForm");
wos.innerHTML = "<a href='#' onClick='pipa()'>testik</a>";
</script>
</body>
</html>