views:

216

answers:

1

I have almost done it.. but there is something wrong:

function doAlert(title,text) {
  var alrt='<div onclick="this.parentNode.removeChild(this);" id="alert" style="background-attachment: scroll !important;background-clip: border-box !important;background-color: black !important;background-image: none !important;background-origin: padding-box !important;background: black !important;border-bottom-left-radius: 20px 20px !important;border-bottom-right-radius: 20px 20px !important;border-top-left-radius: 20px 20px !important;border-top-right-radius: 20px 20px !important;color: white !important;display: block !important;height: 480 !important;left: 50% !important;margin-bottom: 0 !important;margin-left: -360px !important;margin-right: 0 !important;margin-top: -260 !important;opacity: 0.8 !important;overflow-x: auto !important;overflow-y: auto !important;overflow: auto !important;padding-bottom: 20px !important;padding-left: 20px !important;padding-right: 20px !important;padding-top: 20px !important;position: absolute !important;text-align: center !important;top: 50% !important;width: 640 !important;z-index: 99999999 !important;font-size:3em !important;">';
       alrt+=title;
       alrt+='<div id=alertbody style="text-align: justify;font-size:.5em;">';
       alrt+=text;
       alrt+='</div>';
       alrt+='</div>';
       var zalert=document.createElement("div");
       zalert.innerHTML=alrt;
       document.body.insertBefore(zalert.firstChild,document.body.firstElementChild)
      }

This function works pretty well on normal pages.
It doesn't on heavy styled pages.
I tried to add "!important" to my styles, but it didn't help.
If you try this code in pages like: http://www.zibri.org (for example)
the requester is not of the right size nor in the right position.

What's the problem?

A: 

The problem was "px" missing from some width and heigth..

here you go:

   function doAlert(title,text) {
            var alrt='<div onclick="this.parentNode.removeChild(this);" id="alert" style="background-attachment: scroll !important;background-clip: border-box !important;background-color: black !important;background-image: none !important;background-origin: padding-box !important;background: black !important;border-bottom-left-radius: 20px 20px !important;border-bottom-right-radius: 20px 20px !important;border-top-left-radius: 20px 20px !important;border-top-right-radius: 20px 20px !important;color: white !important;display: block !important;height: 480px !important;left: 50% !important;margin-bottom: 0 !important;margin-left: -360px !important;margin-right: 0 !important;margin-top: -260px !important;opacity: 0.8 !important;overflow-x: auto !important;overflow-y: auto !important;overflow: auto !important;padding-bottom: 20px !important;padding-left: 20px !important;padding-right: 20px !important;padding-top: 20px !important;position: fixed !important;text-align: center !important;top: 50% !important;width: 640px !important;z-index: 99999999 !important;font-size:3em !important;">';
            alrt+=title;
            alrt+='<div id=alertbody style="text-align: justify;font-size:.5em;">';
            alrt+=text;
            alrt+='</div>';
            alrt+='</div>';
            var zalert=document.createElement("div");
            zalert.innerHTML=alrt;
            document.body.insertBefore(zalert.firstChild,document.body.firstElementChild)
     }

Feel free to improve it.. but post the results here! :)

Zibri