home *** CD-ROM | disk | FTP | other *** search
/ PC Home 119 / PC Home issue 119.iso / Software / Essentials / Useful / MDAC261.exe / sqlodbc.cab / sqlsodbc.chm / basics / samplestable.js < prev    next >
Encoding:
Text File  |  2001-02-19  |  3.2 KB  |  120 lines

  1. var g_TechArray = new Array();
  2. var g_SelectedTech = 0;
  3. var g_AllTechnologyText = "All";
  4. var g_selected = "selected";
  5.  
  6. function MouseOver()
  7. {
  8.     var FuncLabel;
  9.     
  10.     FuncLabel=window.event.srcElement;
  11.     FuncLabel.className = "clsHI";
  12. }
  13.  
  14. function MouseOut()
  15. {
  16.     var FuncLabel;
  17.     
  18.     FuncLabel=window.event.srcElement;
  19.     FuncLabel.className="clsNORM";
  20. }
  21.  
  22. function sortFBData(skey)
  23. {
  24.   try
  25.   {
  26.     var oNode = filters.XMLDocument.selectSingleNode("/xsl:stylesheet/xsl:template[@match=\"/TableEntries\"]/xsl:copy/xsl:apply-templates");
  27.     if (oNode)
  28.     {
  29.         oNode.attributes(1).value = skey ;
  30.         var vReturn = SampleTable.transformNodeToObject(filters.XMLDocument, SampleTableView.XMLDocument);
  31.     } 
  32.   } catch(exception)
  33.   {
  34.     window.alert("Quick sort not supported on client\n must install msxml3.dll to enable this feature");
  35.   }
  36. }
  37.  
  38. function WriteColumnHeaders()
  39. {
  40.     document.write("<th width=10><A href onclick=\"sortFBData('Technology')\" onmouseover='MouseOver()' onmouseout='MouseOut()'><Label title='Sort by : Technology'>Technology</Label></A></th>");
  41.     document.write("<th width=10><A href onclick=\"sortFBData('SampleName')\" onmouseover='MouseOver()' onmouseout='MouseOut()'><Label title='Sort by : Sample'>Sample</Label></A></th>");
  42.     document.write("<th width=10><A href onclick=\"sortFBData('Language')\" onmouseover='MouseOver()' onmouseout='MouseOut()'><Label title='Sort by : Language'>Language</Label></A></th>");
  43.     document.write("<th><A href onclick=\"sortFBData('Description')\" onmouseover='MouseOver()' onmouseout='MouseOut()'><Center><Label title='Sort by : Description'>Description</Label></Center></A></th>");
  44. }
  45.  
  46. function IsInArray(SrcArray, Value)
  47. {
  48.     var ArrayLength = SrcArray.length - 1;
  49.     
  50.     while(ArrayLength >= 0)
  51.     {
  52.         if(SrcArray[ArrayLength--] == Value)
  53.             return true;
  54.     }
  55.     return false;
  56. }
  57.  
  58. function CalculateTechnologies()
  59. {
  60.     try
  61.     {
  62.         var oNodeList = SampleTable.XMLDocument.selectNodes("/TableEntries/TableRow/Technology");
  63.         var ii = 0;
  64.         var jj = 0;
  65.         var oNode;
  66.         
  67.         oNodeList.reset();
  68.         g_TechArray[jj++] = g_AllTechnologyText;
  69.         while(ii < oNodeList.length)
  70.         {
  71.             oNode = oNodeList.nextNode();
  72.             if(!IsInArray(g_TechArray, oNode.text))
  73.                 g_TechArray[jj++] = oNode.text;
  74.             ii++;                
  75.         }
  76.     } catch(exception)
  77.     {
  78.     }
  79. }
  80. function FillInTechnologies()
  81. {
  82.     CalculateTechnologies();
  83.     var ArrayLength = 0;
  84.     var varSelected = " ";
  85.  
  86.     while(ArrayLength < g_TechArray.length )
  87.     {
  88.         if(ArrayLength == 0)
  89.             varSelected = g_selected;
  90.         else    
  91.             varSelected = " ";
  92.         document.write("<OPTION VALUE=" + ArrayLength + " " + varSelected + ">" + g_TechArray[ArrayLength]);
  93.         ArrayLength++;
  94.     }
  95.     g_SelectedTech = 0;
  96. }
  97.  
  98. var g_strTechnology="Technology";
  99.  
  100. function FilterMembers(oTechnology)
  101. {
  102.     try
  103.     {
  104.         g_SelectedTech = oTechnology.value;
  105.     
  106.         var oNode = filters.XMLDocument.selectSingleNode("/xsl:stylesheet/xsl:template[@match=\"/TableEntries\"]/xsl:copy/xsl:apply-templates[@select $ige$ \"TableRow\"]");
  107.         if (oNode)
  108.         {
  109.             if(g_SelectedTech == 0)
  110.                 oNode.attributes(0).value = "TableRow";
  111.             else
  112.                 oNode.attributes(0).value = "TableRow[Technology=\"" + g_TechArray[g_SelectedTech] + "\"]";
  113.             sortFBData(oNode.attributes(1).value);
  114.         }
  115.     } catch(exception)
  116.     {
  117.     }
  118. }
  119.  
  120.