| 
     
  
/* 
JavaScript Bible, Fourth Edition 
by Danny Goodman  
 
John Wiley & Sons CopyRight 2001 
*/ 
 
 
<HTML> 
<HEAD> 
<TITLE>userProfile Object</TITLE> 
<SCRIPT LANGUAGE="JavaScript"> 
var attrs = ["Business.City","Business.Country","Business.Fax", 
             "Business.Phone","Business.State","Business.StreetAddress", 
             "Business.URL","Business.Zipcode","Cellular","Company", 
             "Department","DisplayName","Email","FirstName", 
             "Gender","Home.City","Home.Country","Home.Fax", 
             "Home.Phone","Home.State","Home.StreetAddress", 
             "Home.Zipcode","Homepage","JobTitle","LastName", 
             "MiddleName","Notes","Office","Pager"] 
function loadTable() { 
    // make sure this executes only in IE4+ for Windows 
    if ((navigator.userAgent.indexOf("Win") != -1) && navigator.userProfile) { 
        var newRow, newCell, attrValue 
        // queue up requests for every vCard attribute 
        for (var i = 0; i < attrs.length; i++) { 
            navigator.userProfile.addReadRequest("vCard." + attrs[i]) 
        } 
        // dispatch the request to let user accept or deny access 
 
navigator.userProfile.doReadRequest(1, "JavaScript Bible") 
        // append rows to the table with attribute/value pairs 
        for (var j = 0; j < attrs.length; j++) { 
            newRow = document.all.attrTable.insertRow(-1) 
            newRow.bgColor = "#FFFF99" 
            newCell = newRow.insertCell(0) 
            newCell.innerText = "vCard." + attrs[j] 
            newCell = newRow.insertCell(1) 
            // get the actual value 
            attrValue = navigator.userProfile.getAttribute("vCard." + attrs[j]) 
            newCell.innerHTML = (attrValue) ? attrValue : " " 
        } 
        // clean up after ourselves 
        navigator.userProfile.clearRequest() 
    } else { 
        alert("This example requires IE4+ for Windows.") 
    } 
} 
</SCRIPT> 
</HEAD> 
<BODY onLoad="loadTable()"> 
<H1>userProfile Object</H1> 
<HR> 
<TABLE ID="attrTable" BORDER=1 CELLPADDING=5> 
<TR BGCOLOR="#CCFFFF"> 
    <TH>vCard Property<TH>Value 
</TR> 
</TABLE> 
</BODY> 
</HTML> 
 
            
          
   
    
    |