黑夜的狼

沮丧吗,那就是一种无病呻吟!留恋它就是一种高度近视!目光应该放得更远一点! 别不想飞,只是要一步跨过太平洋!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

  


   function sAlertForm(str,type,formH,formW){
   var msgw,msgh,bordercolor;
   msgw=formH;//提示窗口的宽度
   msgh=formW;//提示窗口的高度
   titleheight=25 //提示窗口标题高度
   bordercolor="#1B446D";//提示窗口的边框颜色
   titlecolor="#1B446D";//提示窗口的标题颜色
   
   var sWidth,sHeight;
   sWidth=screen.width-16;
   sHeight=screen.height;
   
  bgObj=document.createElement("div");
  bgObj.setAttribute('id','bgDiv');
  bgObj.style.position="absolute";
  bgObj.style.top="0";
  bgObj.style.background="#436E9A";
  bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity=80)";
  bgObj.style.opacity="0.6";
  bgObj.style.left="0";
  bgObj.style.width=sWidth + "px";
  bgObj.style.height=document.documentElement.scrollTop+sHeight + "px";
  bgObj.style.zIndex = "10000";
  document.body.appendChild(bgObj);
   
  msgObj=document.createElement("div")
  msgObj.setAttribute("id","msgDiv");
  msgObj.setAttribute("align","center");
  msgObj.style.background="#225588";
  msgObj.style.border="1px solid " + bordercolor;
  msgObj.style.position = "absolute";
  msgObj.style.left = "50%";
  msgObj.style.top = "50%";
  msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif";
  msgObj.style.marginLeft = "-225px" ;
  msgObj.style.marginTop = (document.documentElement.scrollTop-100)+"px";
  msgObj.style.width = msgw + "px";
  msgObj.style.height =msgh + "px";
  msgObj.style.textAlign = "center";
  msgObj.style.lineHeight ="25px";
  msgObj.style.zIndex = "10001";
       var selectobj=document.getElementsByTagName("select");
       if(selectobj.length!=0)
       {
           for(var i=0;i<selectobj.length;i++)
           {
               selectobj[i].style.visibility="hidden";
           }
       }
  
    var title=document.createElement("h4");
    title.setAttribute("id","msgTitle");
    title.setAttribute("align","right");
    title.style.margin="0";
    title.style.padding="3px";
    title.style.background=bordercolor;
    title.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=75,finishOpacity=100);";
    title.style.opacity="0.75";
    title.style.border="1px solid " + bordercolor;
    title.style.height="18px";
    title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif";
    title.style.color="white";
    title.style.cursor="pointer";
    title.innerHTML="关闭";
    title.onclick=function(){
          document.body.removeChild(bgObj);
                document.getElementById("msgDiv").removeChild(title);
                document.body.removeChild(msgObj);
              if(selectobj.length!=0)
                   {
                       for(var i=0;i<selectobj.length;i++)
                       {
                           selectobj[i].style.visibility="visible";
                       }
                   }
                   if(type=="url")
                   {
                       //location=location;
                       location.reload();
             }
                }
     document.body.appendChild(msgObj);
     document.getElementById("msgDiv").appendChild(title);
    

    if(type=="")
    {
            txt(str);
  }
    else if(type=="singleform")
    {
        createUpdateSingleForm();
    }
    else if(type=="loginform")
    {
       createLoginForm();
    }
    else if(type=="RecommendToFriend")
    {
        RecommendToFriend();
    }
    else if(type=="SendMessage")
    {
        SendMessage(str);
    }     
      }
   function txt(str)
   {
     var txt=document.createElement("div");
     txt.style.margin="2em 0"
     txt.setAttribute("id","divTxt");
     txt.style.color="white";
        txt.style.font="15px Verdana, Geneva, Arial, Helvetica, sans-serif";
     txt.innerHTML=str;
           document.getElementById("msgDiv").appendChild(txt);  
   }
   function SendMessage(str)
   {
       var form=document.createElement("form");
       form.setAttribute("method","post");
       form.setAttribute("action","/user/inc/SendMessage.aspx");
       form.setAttribute("name","SendMessage");
       form.setAttribute("id","SendMessage");
      
       form.innerHTML="<table width='280' border='0' cellpadding='0' cellspacing='0'>";
       form.innerHTML+="<tr><td width='120px'><input type=hidden name=ToUsername value="+str+" /></td><td><textarea class='update_area' rows=4 name=Content style='width:250px'></textarea></td></tr><p>";
       form.innerHTML+="<tr><td align=center><input type=submit class=btn_mouseout onmouseover=this.className='btn_mouseover' onmouseout=this.className='btn_mouseout' value=发送 />&nbsp;&nbsp;&nbsp;</td><td align=center>&nbsp;&nbsp;&nbsp;<input type=reset class=btn_mouseout onmouseover=this.className='btn_mouseover' onmouseout=this.className='btn_mouseout' value=重置 /></td></tr>";
      
       form.innerHTML+="</table>";
       document.getElementById("msgDiv").appendChild(form);
   }
   function RecommendToFriend()
   {
       var form=document.createElement("form");
       form.setAttribute("method","post");
       form.setAttribute("action","/user/inc/RecommendToFriend.aspx");
       form.setAttribute("name","RecommendToFriend");
       form.setAttribute("id","RecommendToFriend");
      
       form.innerHTML="<table width='280' height='25' border='0' cellpadding='10' cellspacing='10'>";
       form.innerHTML+="<tr><td width='120px'><font color=white>&nbsp;&nbsp;好友姓名:</font></td><td><input class='update_text' name='username' /><font color=white>(真实姓名)</font></td></tr><br>";
       form.innerHTML+="<tr><td width='120px'>&nbsp;&nbsp;<font color=white>好友Email:</font></td><td><input class='update_text' type='text' name='email' /><font color=white>(不支持sina)</font></td></tr><br>";
       form.innerHTML+="<tr><td width='120px'><font color=white>想说的话:</font></td><td><textarea class='update_area' rows=4 name=Content style='width:250px'></textarea></td></tr><p>";
       form.innerHTML+="<tr><td align=center><input type=submit class=btn_mouseout onmouseover=this.className='btn_mouseover' onmouseout=this.className='btn_mouseout' value=发送 />&nbsp;&nbsp;&nbsp;</td><td align=center>&nbsp;&nbsp;&nbsp;<input type=reset class=btn_mouseout onmouseover=this.className='btn_mouseover' onmouseout=this.className='btn_mouseout' value=重置 /></td></tr>";
      
       form.innerHTML+="</table>";
       document.getElementById("msgDiv").appendChild(form);
   }
   function createUpdateSingleForm()
   {
       var form=document.createElement("form");
       form.setAttribute("method","post");
       form.setAttribute("action","/Include/JS_BlogName.aspx");
       form.setAttribute("name","form1");
       form.setAttribute("id","form1");
       form.innerHTML="<table width='280' height='25' border='0' cellpadding='0' cellspacing='0'>";
       form.innerHTML+="<tr align='right'><td width='210' colspan=2><font color=white>输入博客签名:</font></td></tr>";
       form.innerHTML+='<tr align="right"><td width="210"><input class="update_text" type="text" name="Homepy" id="Homepy" /></td><td width="70">&nbsp;&nbsp;<button class="btn_mouseout" type="button" onclick="javascript:if(document.getElementById(\'Homepy\').value==\'\'){return false;}else{form1.submit();}" onmouseover="this.className=\'btn_mouseover\'" onmouseout="this.className=\'btn_mouseout\'">修改</button></td></tr></table>';
       document.getElementById("msgDiv").appendChild(form);
   }
   function createLoginForm()
   {  
       var form=document.createElement("form");
       form.setAttribute("method","post");
       form.setAttribute("action","/Include/Js_Login.aspx");
       form.setAttribute("name","loginform");
       form.setAttribute("id","loginform");
      
       form.innerHTML="<table width='180' height='25' border='0' cellpadding='10' cellspacing='10'>";
    form.innerHTML+='<tr><td height="20">&nbsp;</td></tr>';
       form.innerHTML+="<tr><td width='210'><font color=white>用户名:</font></td><td><input id='username' class='update_text' type='text' name='username' /></td></tr><br>";
       form.innerHTML+="<tr><td width='210'><font color=white>密&nbsp;&nbsp;&nbsp;码:</font></td><td><input type=password class='update_text' type='text' name='password' /></td></tr><p>";
       form.innerHTML+='<tr><td align=center><input type=button class=btn_mouseout onmouseover="this.className=\'btn_mouseover\'" onmouseout="this.className=\'btn_mouseout\'" value="登陆" onclick="javascript:if(document.getElementById(\'username\').value==\'\'){return false;}else{loginform.submit();}" />&nbsp;&nbsp;&nbsp;</td><td align=center>&nbsp;&nbsp;&nbsp;<input type=reset class=btn_mouseout onmouseover="javascript:this.className=\'btn_mouseover\'" onmouseout="javascript:this.className=\'btn_mouseout\'" value=重置 /></td></tr>';
      
       form.innerHTML+="</table>";
       document.getElementById("msgDiv").appendChild(form);
   }

  功能还不够完整,马马乎乎,当材料看看吧

posted on 2007-10-16 17:00  anncesky  阅读(740)  评论(0)    收藏  举报