学习无止境!

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

 <script language="javascript" type="text/javascript">

var divSelectMark;
var flag = 0;

function showSelectMark(id)
{
 var strFormApproveID = id.substring(3,id.length);
 //alert(strFormApproveID);
 divSelectMark = document.getElementById("divMark"+strFormApproveID);

 if(document.getElementById(id) == null )
 {
  return;
 }
 flag = 1;
 //if(divSelectMark.style.visibility == "hidden")
 //{
  divSelectMark.style.visibility = "visible";
  var distance = document.getElementById("contentList").getBoundingClientRect().bottom-document.getElementById(id).getBoundingClientRect().bottom
  if(distance<100)
  {
   divSelectMark.style.top = document.getElementById(id).getBoundingClientRect().top-100;
  }
  else
   divSelectMark.style.top = document.getElementById(id).getBoundingClientRect().bottom;
  divSelectMark.style.left = document.getElementById(id).getBoundingClientRect().left;
  
 /*}
 else
 {
  hideSelectMark();
 }*/
  
}


function hideSelectMark()
{
 if(flag!=0)
  divSelectMark.style.visibility = "hidden";
}

function selectImageMark(id,type)
{
 hideSelectMark();
 var strFormApproveID;
 
 if(document.getElementById(id) == null)
  return;
 var oldimage = document.getElementById(id).src;
 var newimage;
 var newflag ;
 var level1image =  "RedMark.gif";
 var level4image =  "NoneMark.gif";
 var level2image =  "YellowMark.gif";
 var level3image =  "GreenMark.gif";
 if(type == 0)
 {
  strFormApproveID = id.substring(3,id.length);
  
  if(oldimage.indexOf(level4image)>0)
  {
   newimage  =  level1image;
   newflag = 1;
  }
  else
  {
   newimage = level4image;
   newflag = 4;
  }
 }
 else
 {
  strFormApproveID = id.substring(6,id.length);
  if(oldimage.indexOf(level4image)>0)
  {
   newimage = level4image;
   newflag = 4;
  }
  else if(oldimage.indexOf(level1image)>0)
  {
   newimage = level1image;
   newflag = 1;
  }
  else if(oldimage.indexOf(level2image)>0)
  {
   newimage = level2image;
   newflag = 2;
  }
  else if(oldimage.indexOf(level3image)>0)
  {
   newimage =level3image;
   newflag = 3;
  }
 }
 //alert(strFormApproveID);
 document.getElementById("img"+strFormApproveID).src = "../image/"+newimage;
  
 var strData="<Data>";
 strData=strData+"<FormApproveID>"+strFormApproveID+"</FormApproveID>";
 strData=strData+"<NewMark>"+newflag+"</NewMark>";
 strData=strData+"</Data>";
 
 //var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
 //var xmlDoc=new ActiveXObject("Microsoft.XMLDom"); 
 var xmlhttp;
 var xmlDoc;
 
 try {
        // Internet Explorer   
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");

    }
    catch (e) {
        // Firefox, Opera 8.0+, Safari   
        try {
            xmlhttp = new XMLHttpRequest();
        }
        catch (e) {  
        }
    }
 
 try
 {
     xmlDoc = new ActiveXObject("Microsoft.XMLDom");   
 }
 catch(e){
     try{
        xmlDoc = document.implementation.createDocument("", "", null);
      
                    Document.prototype.loadXML = function(sXml) {
                        var oParser = new DOMParser();
                        var _xmlDom = oParser.parseFromString(sXml, "text/xml");

                        while (this.firstChild) {
                            this.removeChild(this.firstChild);
                        }

                        for (var i = 0; i < _xmlDom.childNodes.length; i++) {
                            var oNewNode = this.importNode(_xmlDom.childNodes[i], true);
                            this.appendChild(oNewNode);
                        }
                    }
                    Element.prototype.__defineGetter__("text", function() { return this.textContent; });     
     }
     catch(e){ 
     }
 }
 
  xmlDoc.async = false;
  xmlDoc.loadXML(strData);
    
 xmlhttp.open("POST", "Module/SelectMark.aspx", false);
 xmlhttp.send(xmlDoc);
 

     </script>

 

<img id="imgALI.FMAP.4009576" onclick="selectImageMark(this.id,0)" src="../image/RedMark.gif"
                                    style="border-width: 0px; cursor: pointer;" /><img id="imgarALI.FMAP.4009576" onclick="javascript:hideSelectMark();showSelectMark('imgALI.FMAP.4009576')"
                                        src="../image/arrow.gif" style="border-width: 0px; cursor: pointer;" />
                               
                                <div id='divMarkALI.FMAP.4009576' style='z-index: 20; left: 0px; visibility: hidden;
                                    position: absolute; top: 0px; width: 20px; height: 100px' class='DivMark' onmouseout="this.style.visibility='hidden';hidePopup();"
                                    onmouseover="this.style.visibility='visible'">
                                    <table cellspacing="0" cellpadding="0" width="20px" height="100px" border="0">
                                        <tr style="cursor: pointer">
                                            <td nowrap>
                                                <img src="../image/RedMark.gif" id="imgredALI.FMAP.4009576" onclick="selectImageMark(this.id,1)">
                                            </td>
                                        </tr>
                                        <tr style="cursor: pointer">
                                            <td nowrap>
                                                <img src="../image/YellowMark.gif" id="imgyelALI.FMAP.4009576" onclick="selectImageMark(this.id,1)">
                                            </td>
                                        </tr>
                                        <tr style="cursor: pointer">
                                            <td nowrap>
                                                <img src="../image/GreenMark.gif" id="imggreALI.FMAP.4009576" onclick="selectImageMark(this.id,1)">
                                            </td>
                                        </tr>
                                        <tr style="cursor: pointer">
                                            <td nowrap>
                                                <img src="../image/NoneMark.gif" id="imgnonALI.FMAP.4009576" onclick="selectImageMark(this.id,1)">
                                            </td>
                                        </tr>
                                    </table>
                                </div>

 

接收处理XML数据

 

protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                 XmlDocument xmldoc = new XmlDocument();
                 xmldoc.Load(Request.InputStream);
                 string xmlcontent = xmldoc.InnerXml;

                 #region xml格式
                 //var strData = "<Data>";
                 //strData = strData + "<FormApproveID>" + strFormApproveID + "</FormApproveID>";
                 //strData = strData + "<NewMark>" + newflag + "</NewMark>";
                 //strData = strData + "</Data>";
                 #endregion

                 string formApproveID = GetNodeValue(xmldoc, "Data/FormApproveID");
                 string newMark = GetNodeValue(xmldoc, "Data/NewMark");
                 if (!string.IsNullOrEmpty(formApproveID) && !string.IsNullOrEmpty(newMark))
                 {
                     BLL.BPMFormManager.UpdteFormMark(formApproveID, int.Parse(newMark),this.Passport);
                 }
            }
        }

        private static XmlNode GetNode(XmlDocument doc, string strXPath)
        {
            return doc.DocumentElement.SelectSingleNode(strXPath);
        }
        private static string GetNodeValue(XmlDocument doc, string strXPath)
        {
            XmlNode node = doc.SelectSingleNode(strXPath);
            if (node != null)
            {
                return node.InnerText;
            }
            return String.Empty;
        }

 

 

posted on 2012-12-05 11:26  钻石眼泪  阅读(327)  评论(0编辑  收藏  举报