I was mistaked on this. In the actual javascript alert function the \n will work to break the lines up. However I found that my problem is using it with php.
here is an example of what I am doing
function error_msg($msg){ <script>alert($msg);</script> }
if ($var1 == ""){ $error .= $var1." field\n"; }
if ($var2 == ""){ $error .= $var2." field\n"; }
if ($var3 == ""){ $error .= $var3." field\n"; }
if($error != "")
{
error_msg("fill out:\n".$error);
}
What is happening is it breaks the alert box so the code is reading the new line
but it is breaking the actual alert box so the page doesn't display it as an alert box.
Is there a way to force it so it is recognized in the string.
the newline (\n) works find when you use it directly in a javascript function without the php code. Any ideas on how to fix this would be great.
Thanks for your time.