如何永久传递javascript函数的参数

How would I make this function work so that whenever the element I created is clicked it uses the parameters from the function in the actual click event.

 function createLink(text, parentElement) {
        var a = document.createElement('p');
        var linkText = document.createTextNode(text);
        a.appendChild(linkText);
        temp1 = text.replace("/","-");
        temp2 = res1.replace("/","-");
        a.onClick = goSpecificPrev(temp2,linkText);
        parentElement.appendChild(a);
        var br = document.createElement('br');
        parentElement.appendChild(br);
    }

The parameters in questions are in the line:

a.onClick = goSpecificPrev(temp2,linkText);

being temp2 and linkText.