Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,048
    Thanks
    0
    Thanked 251 Times in 247 Posts
    I don't understand what you're saying. I just copied DaveyErwin's code which you said you're using and then modified alertBox to make it reusable.

  2. #17
    New Coder
    Join Date
    Jul 2013
    Posts
    48
    Thanks
    9
    Thanked 1 Time in 1 Post
    Ok its clear to me. Have to put all the code in one place, not in two script tags. The second is these strings with ERROR and text in text fiels has to be a params who is send by another function to current function.
    Code:
    changeText: function(paramError,paramText){
    		document.getElementById("header_error").innerHTML = paramError;
    		document.getElementById("text_msg").innerHTML = paramText;
    Somethink like this.
    And the last think is to use queryselector method by class not by ID.

  3. #18
    Regular Coder
    Join Date
    Aug 2010
    Posts
    972
    Thanks
    19
    Thanked 212 Times in 210 Posts
    Code:
     
    <!DOCTYPE html>
    <html>
    <head>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <title></title>
     <style type="text/css">
      #divmsg {
       position: absolute;
       top: 50%;
       left: 50%;
       width:302px;
       height:181px;
       margin-left: -150px;
       margin-top: -90px;
       background:#f8f8f8;
       text-align:center;
       -webkit-user-select: none;  
       -moz-user-select: none;    
       -ms-user-select: none;      
       user-select: none;      
      }
     
      #header{
       text-align:left; 
       background: #F0F0F0;
       height: 50px;
      }
     
      #header_error{
       margin:14px 0 0 20px;
       float:left;
       COLOR:7f8488;
       font-family:arial;
       font-size: 15px;
      }
     
      #header_x{
       margin:-14px 0px;
       float:right;
       font-weight:bold;
       COLOR:CECECE;
       font-family:arial;
      }
     
      div.ok{
       width:95px;
       line-height: 36px;
       margin:20px 0 20px 98px;
       background:#c8c8c8;
       -webkit-user-select: none;  
       -moz-user-select: none;    
       -ms-user-select: none;      
       user-select: none;
      }
     </style>
     <script type="text/javascript">
      var alertBox = {
       fclick: function(tm,he){
        var div = document.getElementById("top");
        div.style.display = "block";
        text_msg.innerHTML = tm;
        header_error.innerHTML = he;
     
       },
       fclose: function(){
        var div = document.getElementById("top");
        div.style.display = "none";
       }
      }
     </script>
    </head>
    <body>
     <div id="divbody">
      <input type="button" value="OK" onclick="alertBox.fclick('not a prob','AOK')" />
      <input type="button" value="NoGood" onclick="alertBox.fclick('big prob','FAILURE')" />
     </div>
     
     
     
     
     
     
     
     
    <script>
    topDiv=document.createElement("DIV");
    topDiv.id="top";
    topDiv.style.cssText="display:none;position: absolute;width: 100%;height: 100%; background: url('background.jpg');";
    divmsg=document.createElement("DIV");
    divmsg.id="divmsg";
    header=document.createElement("DIV");
    header.id="header";
    header_error=document.createElement("DIV");
    header_error.id="header_error";
    header_error.cssText="white-space:nowrap;width:6em;overflow:hidden;text-overflow:ellipsis;";
    header_error.innerHTML="ERROR";
    header_x=document.createElement("DIV");
    header_x.id="header_x"; 
    header_x.onclick=function(){alertBox.fclose()};
    p1=document.createElement("P");
    img1=document.createElement("IMG");
    img1.src="X.jpg";
    text_msg=document.createElement("P");
    text_msg.id="text_msg";
    text_msg.innerHTML="Client not specified !";
    text_msg.cssText="white-space:nowrap;width:15em;overflow:hidden;text-overflow:ellipsis;font-size:14px; margin:35px ; font-family:arial";
    div1=document.createElement("DIV");
    div1.className="ok";
    div1.onclick=function(){alertBox.fclose()};
    div1.cssText="font-size:14px; font-family:arial; font-weight:bold; color:7f8488";
    div1.innerHTML="OK";
    document.body.appendChild(topDiv)
    topDiv.appendChild(divmsg)
    divmsg.appendChild(header)
    divmsg.appendChild(text_msg)
    divmsg.appendChild(div1)
    header.appendChild(header_error)
    header.appendChild(header_x)
    header_x.appendChild(p1)
    p1.appendChild(img1)
    </script>
    </body>
    </html>
    http://codingforums.daveyerwin.com/val10/
    Last edited by DaveyErwin; 09-29-2013 at 12:20 PM.

  4. #19
    New Coder
    Join Date
    Jul 2013
    Posts
    48
    Thanks
    9
    Thanked 1 Time in 1 Post
    http://pastebin.com/f0cAk1Js

    Just want to tell you that im finish. This is my latest code.
    Last edited by val10; 09-27-2013 at 04:10 PM.


 
Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •