使用Javascript和PHP着色单个变量?

What am I doing wrong?

} else {
    $output = '<script type="text/javascript">jAlert("<font color="red">'$number1'</font>", "Alert Dialog Sample")</script>';
}

I am getting:

Parse error: syntax error, unexpected T_VARIABLE

You missed the dots around $number1 which is used for concatenation

    $output = '<script type="text/javascript">jAlert("<font color="red">'.$number1.'</font>", "Alert Dialog Sample")</script>';

You need to use the string concatenation operator.

} else {
    $output = '<script type="text/javascript">jAlert("<font color="red">' . $number1 . '</font>", "Alert Dialog Sample")</script>';
}

I would refrain from using the font tag though as it is deprecated.

it should be like this

$output = '<script type="text/javascript">jAlert("<font color="red">'.$number1.'</font>", "Alert Dialog Sample")</script>';

}