New javascript function : error_message which displays a error message into a div

This commit is contained in:
Dany De Bontridder 2013-09-17 17:24:46 +00:00
parent 7e78c8c9f9
commit 495ca05e2f
3 changed files with 43 additions and 2 deletions

View file

@ -1967,7 +1967,17 @@ function remove_bookmark() {
} }
); );
} catch (e) { } catch (e) {
info_message(e.getMessage); error_message(e.getMessage);
} }
}
/**
*@brief display the error message into the div error_content_div (included into error_div)
*@param message message to display
*@note there is no protection
*/
function error_message(message)
{
$('error_content_div').innerHTML=message;
$('error_div').style.visibility='visible';
} }

View file

@ -1316,4 +1316,27 @@ div#preference_div {
top:2em; top:2em;
left:20%; left:20%;
width:50%; width:50%;
}
#error_div{
position:absolute;
border:1px solid black;
background-color:whitesmoke;
padding-bottom: 2px;
padding-top: 2px;
padding-left: 2px;
padding-right: 2px;
color:red;
top:20%;left:25%;
visibility:hidden;
width:40em;
z-index:20;
}
#error_div h2 {
background: red;
}
div#error_content_div {
font-size: 1.2em;
color:error;
font-weight: bold;
text-align: center;
} }

View file

@ -310,7 +310,15 @@ function html_page_start($p_theme="", $p_script="", $p_script2="")
'; ';
echo "<BODY $p_script>"; echo "<BODY $p_script>";
echo '<div id="info_div"></div>'; echo '<div id="info_div"></div>';
echo '<div id="error_div">'.
HtmlInput::title_box("Erreur", 'error_div','hide').
'<div id="error_content_div">'.
'</div>'.
'<p style="text-align:center">'.
HtmlInput::button_action('Valider','$(\'error_div\').style.visibility=\'hidden\';$(\'error_content_div\').innerHTML=\'\';').
'</p>'.
'</div>';
// language // language
if (isset($_SESSION['g_lang'])) if (isset($_SESSION['g_lang']))
{ {