I am trying make some div for message when is showing just when i call him. I need to call javascript to change div style (style="display:block;") but i don't know how.
I try call with echo, but now work.
I am try add in HTML file <script type="text/javascript">openmsgpF();</script>
and that not work too.
Some other way how can i call javascript funtion?
MY PHP FILE:
if (isset($_POST['newsletter'])){
$message='Thanks for signig up on our newsletter!';
echo '<script type="text/javascript">openmsgpF();</script>';
}
MY MESSAGE DIV:
<div id="message-p" style="display:none;background-color: green;color: rgb(255, 255, 255);text-align: center;position: fixed;top: 0px;left: 0px;z-index: 999999;width: 100%; font-size: 25px; font-style: normal;letter-spacing: 1px;height: 100px;padding-top: 30px;letter-spacing: 1px;">
<?php echo $message;?>
<div id="close_msg" style="position: absolute;top: 0;right: 10px;">
<a style="color: #c6c6c6;" href="javascript:void(0);" onclick="closemsgF()">X</a>
</div>
</div>
MY SCRIPT:
<script>
function closemsgF()
{
document.getElementById("message-p").style.display = "none";
document.getElementById("message-n").style.display = "none";
}
function openmsgpF()
{
document.getElementById("message-p").style.display = "block";
}
function openmsgnF()
{
document.getElementById("message-n").style.display = "block";
}
</script>