Click here to Skip to main content
12,762,900 members (37,083 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Samples » Downloads


41 bookmarked
Posted 4 Jul 2007

xLibrary - Using a custom IHttpHandler to access embedded JavaScript

, 28 Feb 2009 CPOL
This article covers how to make a custom IHttpHandler to use the X Library from embedded in an assembly.
<?xml version="1.0" encoding="ISO-8859-1"?>

<x_symbol id='xDisplay'>


<copyright>Copyright 2003-2007 Michael Foster (</copyright>
<license>Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL</license>

<description><![CDATA[A safe wrapper for]]></description>

<syntax>xDisplay(e[, sProp])</syntax>

    <note><![CDATA[id string or element reference]]></note>
    <note><![CDATA[One of the valid CSS strings for this property]]></note>

<return>string, if it exists else null</return>


    <note><![CDATA[Index of all X demos.]]></note>

  <comment><date>2Jul07</date><author>mf</author><note><![CDATA[Don't use this function, access the native property directly. This function is provided only for backwards-compatibility.]]></note></comment>
[code]function xDisplay(e,s)
  if(!(e=xGetElementById(e))) return null;
  if( && xDef( {
    if (xStr(s)) = s;
  return null;
Alternative 2:
[code]function xDisplay(e,s)
  if ((e=xGetElementById(e)) && && xDef( {
    if (xStr(s)) {
      if (s == 'block' && e.nodeName) { /////// ???
        var ie = 'block';
        switch (e.nodeName.toLowerCase()) {
          case 'table': s = 'table'; break;
          case 'tr': s = 'table-row'; break;
          case 'td': case 'th': s = 'table-cell'; break;
          case 'li': s = 'list-item'; break;
          case 'caption': s = 'table-caption'; ie = 'inline'; break; // inline (IE6dn)
          case 'tbody': s = 'table-row-group'; ie = ''; break; // not rendered
          case 'thead': s = 'table-header-group'; ie = ''; break; // not rendered
          case 'tfoot': s = 'table-footer-group'; ie = ''; break; // not rendered
          case 'col': s = 'table-column'; break;
          case 'colgroup': s = 'table-column-group'; break;
        try { = s; }
        catch (e) { = ie; }
      else = s;
  return null;

    <note><![CDATA[Using try/catch since IE6dn doesn't support the table css properties. Thanks very much to Edward Glowacki.]]></note>
    <note><![CDATA[Reduced 13 bytes]]></note>
    <note><![CDATA[put into its own file for XC]]></note>


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Rick Bassham
Software Developer (Senior)
United States United States
I have been a software developer since 2005, focusing on .Net applications with MS SQL backends, and recently, C++ applications in Linux, Mac OS X, and Windows.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170217.1 | Last Updated 28 Feb 2009
Article Copyright 2007 by Rick Bassham
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid