Define a function to accept the string value
<html> <head> <title>My First Page</title> <script type = "text/javascript"> function myFunc(textToAlert) { alert(textToAlert); } myFunc("This is a test"); </script> </head> <body> </body> </html>