dimanche 24 juillet 2016

unable to call a JavaScript function of custom alert in PHP

i have create a custom Alert Dialog Box but i am not able to call it in php

below is the code of alert dialog box

<script>
function CustomAlert(){
this.render = function(dialog){
    var winW = window.innerWidth;
    var winH = window.innerHeight;
    var dialogoverlay = document.getElementById('dialogoverlay');
    var dialogbox = document.getElementById('dialogbox');
    dialogoverlay.style.display = "block";
    dialogoverlay.style.height = winH+"px";
    dialogbox.style.left = (winW/2) - (550 * .5)+"px";//position of dialog box 
    dialogbox.style.top = "200px"; //height of the box 
    dialogbox.style.display = "block";
    document.getElementById('dialogboxhead').innerHTML = "Registraion Succesfull";
    document.getElementById('dialogboxbody').innerHTML = dialog;
    document.getElementById('dialogboxfoot').innerHTML = '<button onclick="Alert.ok()">OK</button>';
}
this.ok = function(){
     window.open("employer/personal","_self");
}
}var Alert = new CustomAlert();

below is the php code

<?php 
echo "<script> CustomAlert(Alert.render('You look very pretty today.'));        </script>";
?>

Aucun commentaire:

Enregistrer un commentaire