Litestream Posted March 5, 2007 Share Posted March 5, 2007 We have an internal database of instructions generated by php. However, many people don't bother to read the critical information section and so errors are made on a daily basis. Would it be possible to open a popup window on loading the instruction page but only when the critical information section of the page contains text? The popup window could either contain the contents of the critical information section or just a visual warning that such information exists on the main page. I have a pretty good knowledge of VBA but sadly my knowledge of php and javascript is very limited. Any help would be greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/41346-open-popup-window-when-page-is-loaded-if-a-field-is-populated/ Share on other sites More sharing options...
warewolfe Posted March 6, 2007 Share Posted March 6, 2007 Hi, I know this is phpfreaks but javascript would probably be your best bet with this sort of problem and using alert boxes to warn/inform the user. Add this script in the head section of your page. <script language="javascript" type="text/javascript"> function warning() { if(criticalInformationCheck()) { alert("Warning! Warning! Warning!, you might want to change warning to something useful"); } function criticalInformationCheck() { var answer = true; //how this will work will depend on the DOM of the page you are generating. //eg if div exist then anwer is false // or if div is empty then answer is false return answer; } } </script> and add this to the body tag <body onload="warning()"> Link to comment https://forums.phpfreaks.com/topic/41346-open-popup-window-when-page-is-loaded-if-a-field-is-populated/#findComment-200393 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.