编写简单的javascript函数并调用它

I have bootstrap on my site and I want to use a different alertbox when I communicate with the users....

I only use this one: http://bootboxjs.com/documentation.html#bb-alert-dialog

It is defined like this (I always use the large one, and always title "rsite") and I only change the message. I have tried to write a funcion that takes userMessage as argument and outputs this but with no luck. Can you see what I do wrong?

 ReClamVersion = "0.4";

 DEFINE
 bootbox.alert({ 
 size: "large",
 title: ReClamversion,
 message: "Your message here…", 
 })

 My non working function
 function rAlert(userMessage)
 {
 return "bootbox.alert({ message:'" + userMessage + "',size: 'large',¨title:" + ReClamVersion+ '});'
 ;}

I try to invoke it by rAlert("hi") but it doesnt work. Where should I put my script so I can use it on all my pages? I use php and include my header.php. Should I put the script there?

You don't need quotes if you just want display the alert, using variables as parameters. Moreover the way you put the quotes is incorrect. Try rewriting the function as follows

function rAlert(userMessage)
 {
 bootbox.alert({ message: userMessage ,size: 'large', title:  ReClamVersion });
 }

It's ok to put the function in the header.