#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2003
    Posts
    2
    Rep Power
    0

    TidyCOM and Server Side Javascript Object


    Hi Folks...
    I am trying to instantiate the TidyCOM object, based on HTMLTidy, using server side Javascript. I have a working VBScript version, but am having trouble with a JS version... I get "Object does not support this property" errors on the last line.

    WORKING VB VERSION:
    <script language="VBScript" runat="server">
    Set TidyObj = CreateObject("TidyCOM.TidyObject")
    TidyObj.Options.Doctype = "strict"
    TidyObj.Options.DropFontTags = true
    TidyObj.Options.OutputXhtml = true
    TidyObj.Options.addXMLspace = true
    TidyObj.Options.word2000 = true
    TidyObj.Options.clean = true
    TidyObj.Options.Indent = 2
    TidyObj.Options.TabSize = 8
    theString = TidyObj.TidyMemToMem("<b>A BUNCH OF STUFF")
    response.write theString
    </script>

    NON-FUNCTIONING JAVASCRIPT VERSION:
    <SCRIPT LANGUAGE="JAVASCRIPT" RUNAT="SERVER">
    function TidyIt() {
    var TidyObj = new Object("TidyCOM.TidyObject");
    TidyObj.Options = "";
    TidyObj.Options.Doctype = "strict";
    TidyObj.Options.DropFontTags = "true";
    TidyObj.Options.OutputXhtml = "true";
    TidyObj.Options.addXMLspace = "true";
    TidyObj.Options.word2000 = "true";
    TidyObj.Options.clean = "true";
    TidyObj.Options.Indent = 2;
    TidyObj.Options.TabSize = 8;
    response.write(TidyObj.TidyMemToMem("<b><em>THE STUFF TO CLEAN</font>")); //ERROR HERE...
    }

    new TidyIt();
    </SCRIPT>

    Has anyone done this or know if it is possible. I need to covert user supplied HTML (that may or may not have come from MS Word) to XHTML inside an existing application written with server-side JS.

    Thanks!!
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2003
    Posts
    1
    Rep Power
    0

    Re Javascript and TidyCOM


    1. use "Server.CreateObject(...)" instead of "new Object(...)"
    2. remove the line TidyObj.Options = "";
    3. "Response.Write(...)" is case sensitive in JavaScript
    it will suddenly work...!

IMN logo majestic logo threadwatch logo seochat tools logo