web-standards

Why can't I have a numeric value as the ID of an element?

▼魔方 西西 提交于 2019-11-26 03:20:54
问题 Working on a project, nearly finished and just tidying up the HTML and I find out that you\'re not really allowed to have an ID that is just a number- < a> attribute \"id\" has invalid value \"567\" The attribute ID is of type ID. As described above, it should begin with a letter and have no spaces Good <a id=\"567\" href=\"/index.html\"> Good <a id=\"n567\" href=\"/index.html\"> I can go through my code and add a letter then strip it when the value is used in my jQuery but it would be

Is a DIV inside a TD a bad idea?

我的未来我决定 提交于 2019-11-26 02:34:34
问题 It seems like I heard/read somewhere that a <div> inside of a <td> was a no-no. Not that it won\'t work, just something about them not being really compatible based on their display type. Can\'t find any evidence to back up my hunch, so I may be totally wrong. 回答1: Using a div instide a td is not worse than any other way of using tables for layout. (Some people never use tables for layout though, and I happen to be one of them.) If you use a div in a td you will however get in a situation

What is the proper way to URL encode Unicode characters?

断了今生、忘了曾经 提交于 2019-11-26 01:58:33
问题 I know of the non-standard %uxxxx scheme but that doesn\'t seem like a wise choice since the scheme has been rejected by the W3C. Some interesting examples: The heart character. If I type this into my browser: http://www.google.com/search?q=♥ Then copy and paste it, I see this URL http://www.google.com/search?q=%E2%99%A5 which makes it seem like Firefox (or Safari) is doing this. urllib.quote_plus(x.encode(\"latin-1\")) \'%E2%99%A5\' which makes sense, except for things that can\'t be encoded

Is there a query language for JSON?

浪子不回头ぞ 提交于 2019-11-26 01:55:48
问题 Is there a (roughly) SQL or XQuery-like language for querying JSON? I\'m thinking of very small datasets that map nicely to JSON where it would be nice to easily answer queries such as \"what are all the values of X where Y > 3\" or to do the usual SUM / COUNT type operations. As completely made-up example, something like this: [{\"x\": 2, \"y\": 0}}, {\"x\": 3, \"y\": 1}, {\"x\": 4, \"y\": 1}] SUM(X) WHERE Y > 0 (would equate to 7) LIST(X) WHERE Y > 0 (would equate to [3,4]) I\'m thinking

Is it valid to have a html form inside another html form?

做~自己de王妃 提交于 2019-11-25 22:47:31
问题 Is it valid html to have the following: <form action=\"a\"> <input.../> <form action=\"b\"> <input.../> <input.../> <input.../> </form> <input.../> </form> So when you submit \"b\" you only get the fields within the inner form. When you submit \"a\" you get all fields minus those within \"b\". If it isn\'t possible, what workarounds for this situation are available? 回答1: A. It is not valid HTML nor XHTML In the official W3C XHTML specification, Section B. "Element Prohibitions", states that:

Is it a good practice to use an empty URL for a HTML form&#39;s action attribute? (action=“”)

删除回忆录丶 提交于 2019-11-25 22:32:33
问题 I am wondering if anyone can give a \"best practices\" response to using blank HTML form actions to post back to the current page. There is a post asking what a blank HTML form action does here and some pages like this one suggest it is fine but I\'d like to know what people think. 回答1: The best thing you can do is leave out the action attribute altogether. If you leave it out, the form will be submitted to the document's address, i.e. the same page. It is also possible to leave it empty, and