public static string CreateURL(string url, string title, string text) { ElementBuilder a = new ElementBuilder("a"); a.addAttribute("href", url); a.addAttribute("title", title); a.addAttribute("", text); return a.ToString(); }
public static string CreateInput(string type, string name, string value) { ElementBuilder input = new ElementBuilder("input"); input.addAttribute("type", type); input.addAttribute("name", name); input.addAttribute("value", value); return input.ToString(); }
public static string CreateImage(string src, string alt, string title) { ElementBuilder image = new ElementBuilder("img"); image.addAttribute("src", src); image.addAttribute("alt", alt); image.addAttribute("title", title); image.closingTags(true); return image.ToString(); }
static void Main(string[] args) { ElementBuilder div = new ElementBuilder("div"); div.addAttribute("id", "page"); div.addAttribute("class", "big"); div.addContent("<p>Hello!</p>"); Console.WriteLine(div * 2); Console.WriteLine(HTML_Dispatcher.CreateImage("image.png", "picture", "picture title")); Console.WriteLine(HTML_Dispatcher.CreateURL("../../url.url", "url title", "Click here!")); Console.WriteLine(HTML_Dispatcher.CreateInput("input", "input_text", "null")); }