예제 #1
0
        public static string CreateURL(string url, string title, string text)
        {
            ElementBuilder a = new ElementBuilder("a");
            a.AddAtributes("href", url);
            a.AddAtributes("title", title);
            a.AddContent(text);

            return a.ToString();
        }
예제 #2
0
        public static string CreateImage(string source, string alt, string title)
        {
            ElementBuilder image = new ElementBuilder("image");
            image.AddAtributes("src", source);
            image.AddAtributes("alt", alt);
            image.AddAtributes("title", title);

            return image.ToString();
        }
예제 #3
0
        public static string CreateInput(string type, string name, string value)
        {
            ElementBuilder input = new ElementBuilder("input");
            input.AddAtributes("type", type);
            input.AddAtributes("name", name);
            input.AddAtributes("value", value);

            return input.ToString();
        }
예제 #4
0
        static void Main(string[] args)
        {
            ElementBuilder div = new ElementBuilder("div");
            ElementBuilder a = new ElementBuilder("a");
            ElementBuilder li = new ElementBuilder("li");

            div.AddAtributes("class", "softuni");
            div.AddAtributes("onclick", "highlight();");

            a.AddAtributes("href", "http://softuni.bg");
            a.AddContent("Software University");
            div.AddContent(a.ToString());

            Console.WriteLine(div);

            Console.WriteLine(li * 2);

            Console.WriteLine(HTMLDispatcher.CreateImage("http://softuni.bg/img/logo.png", "softuni-logo", "logo"));
            Console.WriteLine(HTMLDispatcher.CreateURL("http://softuni.bg", "Software University", "The best university in Bulgaria"));
            Console.WriteLine(HTMLDispatcher.CreateInput("text", "address", "Sofia bul. Vasil Kynchew 26"));
        }