public static ElementBuilder CreateURL(string url, string title, string text) { ElementBuilder link = new ElementBuilder("a"); link.AddAttribute("href", url); link.AddAttribute("title", title); link.AddContent(text); return link; }
public static ElementBuilder CreateImage(string src, string alt, string title) { ElementBuilder img = new ElementBuilder("img"); img.AddAttribute("src", src); img.AddAttribute("alt", alt); img.AddAttribute("title", title); img.SelfClosing(true); return img; }
public static ElementBuilder CreateInput(string type, string name, string value) { ElementBuilder input = new ElementBuilder("input"); input.AddAttribute("type", type); input.AddAttribute("name", name); input.AddAttribute("value", value); input.SelfClosing(true); return input; }
public static void Main() { ElementBuilder a = new ElementBuilder("a"); a.AddAttribute("href", "#"); a.AddAttribute("class", "link"); a.AddContent("abv.bg"); Console.WriteLine(a); Console.WriteLine(a * 2); Console.WriteLine(); ElementBuilder img = HTMLDispatcher.CreateImage("image1.jpg", "test image", "test image"); Console.WriteLine(img.ToString()); ElementBuilder input = HTMLDispatcher.CreateInput("submit", "submit", "Submit"); Console.WriteLine(input.ToString()); }