Does anyone know what is the maximum number of characters you can display in an alert box?
I'm returning an error alert to the user with details for each of the errors and warnings but apparently the box just don't show up anymore when there is too much data. Here's some of my code:
<?php
//Two arrays are created in php, one with the errors, one with the warnings.
?>
<script type="text/javascript">
alert("<?php
if(count($err) != 0){
$errorfound = True;
echo 'Error:
';
foreach($err as $message){
echo '' . $message . '
';
}
}
if(count($warn) != 0){
echo '
Warning:
';
foreach($warn as $mess){
echo '' . $mess . '
';
}
}?>");
</script>
<?php
//app continues if no error was found
?>
After investigation, my problem didn't come from the capacity of the alert box but was in fact that I needed to addslashes()
to my messages (that's why I thought it was working with fewer values, but in fact I was just lucky because they weren't characters that needed to be escaped).
I'll definitely change that alert box for something more appropriated, just wanted to say that there is no problem with the alert box.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…