Larry Aronson

Author
+ Follow
since Dec 08, 2010
Larry likes ...
MySQL Database PHP
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
3
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Larry Aronson

The word "Release" is not applicable. HTML5 is not software, it is a proposed standard for web software developers which will be submitted to international standards organizations in the next couple of years. Their adoption of HTML5 as the official standard is expected around 2020.

That said, all major browser makers strongly support HTML5 and have added many of the new HTML5 features to their current browser versions, or to their public betas. Since HTML5 is backwards compatible with previous versions of HTML and designed to fail gracefully in non-compliant browsers, you don't have to change any code you either have or will write in the future. If, however, you want to build better web sites, you should learn about HTML5's new features and begin using them today.

Please see my blog post: 15 HTML5 FAQs for more information.

Larry

Joe Harry wrote:Guys,

If I need to open a pop up window upon click of a link on my page, do I have to use the jQuery plugin or is there a simpler way to do it?



No jQuery or plugins are needed, Joe. At the very simplest:

<a href="javascript:void window.open('http://www.example.com');">Click Me</a>

This duplicates the behavior of adding target="_blank" to a link.
Search your favorite JavaScript resource site for "window.open" to learn about the optional arguments for setting height, width, scrolling and other features.

Larry
The correct CSS to hide an element (as if it never existed) is:

display: none;

Your CSS:


Without actually running the code, it looks to me like you've got too much inside of the central for loop, so that it generates something like:

<html>
<body>
<form>
<input ... value='User' name='user' />Tom</input>
</form>
</body>
</html>
<html>
<body>
<form>
<input ... value='User[i]' name='user' />Dick</input>
</form>
</body>
</html>
<html>
<body>
<form>
<input ... value='User[i]' name='user' />Harry</input>
</form>
</body>
</html>


and so on. This is clearly wrong.

An HTML document should have only one html element and only one body element. Anything else is undefined. Note that input elements do not have closing tags, but that doesn't matter here because there's no connection between the checkbox input elements and the form that contains the submit buttons. You should add a input statement to that form, something like:

<input type="hidden" name="username" value="" />


Then, your checkboxes can look something like this (without the extra, html, body and form tags):

out.println("<input type='checkbox' value='"+User[i]+"' onclick='document.add.username.value+=this.value+\',\';' /> "+User[i]);

When a submit button is clicked, the hidden value should be a list of comma separated list of user names (possibly with duplicates) and a trailing comma.

Also note that, with the exception of radio buttons, input elements should have unique names. Yet, I don't see why there's a need to name the input statements at all in your code since the necessary info is passed by using the [i]this
variable.

hth - Larry

Congratulations Shashank, Bear, nirjari and Lance.

I hope you find the HTML Manual of Style helpful and enjoyable.

Larry
Yes. It is in the interests of Apple, Google and other smartphone makers to provide APIs to their device drivers so that others can write apps, however, I don't think that such features will be specifically incorporated into the HTML5 specs.

Let me rephrase and narrow your question with an example:

Is it possible to build a web page using HTML and JavaScript that, upon detecting that your browser is running on a device equipped with a camera, will enable the user to take a picture as an alternative to uploading an image file?

I don't know the answer to this question. I've not had a chance yet to explore writing smartphone apps in HTML and JS so I don't know the details of how Google Goggles, for example, controls the camera. Does anyone know what Goggles is written in?

This does bring up the distinctions between web pages and apps. An app uses all the technologies of a web site but packages it to run independently (no browser required) on a target device. Also, an app asks for permission to connect to your device's camera when you install it. Do we really want a web page to be able to snap a photo without first asking permission? Suppose that the camera is accessed not by code under the control of the site's webmaster but from code embedded in a ad served up by a third party service?

Smile and say "Cheese".

Larry
As Bear said, "They are not interchangeable". However, the name attribute is used outside of form elements. It is used is some meta tags and it is also used in the map element. Note that an id attribute can also be used in a map element but must have the same value as the name attribute if both are used.

The name attribute does not have the same restrictions that the id attribute has. Two forms on the same page can both have sub-elements with the same name attribute value. For example:

<form id="form-A" onsubmit="validate(this)"><input name="fullname"/><input type="submit"/></form>
<form id="form-B" onsubmit="validate(this)"><input name="fullname"/><input type="submit"/></form>


And using the same name value binds a bunch of radio buttons into a group. Neither of these uses is possible with the id attribute.

Larry
I don't consider myself a PHP programmer although I write a lot of it building and customizing WordPress sites. I'm not familiar enough with the internals of session management in PHP to comment on how you can modify what it does.

My advice is to take what you need and give up what you want. Having an HTML5 DOCTYPE at the start of a page doesn't buy you any extra features or capabilities and, if the page depends on specific XML namespaces, you probably should stick with what is generated for you.

Larry
Modernizr is a wonderful piece of software. I'm not familiar with HTML5 Boilerplate.

Fact of life — IE6 and IE7 are not going away anytime soon (IE6 still has greater usage worldwide than IE7.) Modernizer does reliable testing for specific feature support and makes the information available in an easy, systematic way to your CSS styles and JavaScript code. This is way better than using conditional IE comments and CSS hacks for dealing with IE6,7's incomplete and, for some properties, broken CSS.

Modernizer includes the Google HTML5 shim. This means that right now you can start using the new HTML5 semantic elements: section, article, aside, header, footer, nav and hgroup, without worrying about fallbacks for legacy browsers.

And, while it's nice to be able to test for specific CSS3 properties like border-radius, drop-shadow and transitions, I take care in my code that the page will still look good and work well without these presentation details.

On a side note, it's very encouraging to see the major browser makers focusing on improving their JavaScript performance and reliability. Google set the bar higher with Chrome. Firefox 4 beta feels 4 or 5 times faster than FF 3.6.

Larry
If a browser recognizes an element it will try to render it as best is can no matter whether the !DOCTYPE includes that element or not. !DOCTYPE is more for validation services, editors, search robots and other automated user agents. !DOCTYPE does matter to IE6 which will go into "quirks" mode if the !DOCTYPE is missing. Here's Microsoft's expanation.

In other words, you probably don't have to do anything.

hth -- Larry
Yes, pages 166 - 171 including example 3.19 illustrating how positioning affects width and height; and example 3.20 which shows how positioning is used to create drop-menus.

Larry
Hmm — float works against you in cases like this.

Try using positioning instead:



Might need some adjustments for IE6 and IE7.

Larry
I agree with Bear, but would add Content Editable and Web storage to the list of "big ticket" items. (Oh, and I just happened to have written a post about these — link wink: )

Also, don't forget CSS3 enhancements that will make life so much easier for designers — rounded corners, drop shadows, transitions and transformations — to name a few.

Larry
I second what Eric wrote. Remember that PHP is a server-side technology that dynamically generates the HTML that will be sent to the browser. Check the source of the loaded page and make sure that you don't end up with two DOCTYPEs - one from the session_start() function and the one that you entered.

Larry
Good Question, Kurt.

The answer is: the canvas element.

It provides a 2-D, bit-mapped, drawing environment upon which you can create and manipulate text, images and video. Because the canvas is just like any other HTML element, it can be styled with CSS and can interact with other elements on the page (including other canvases) using JavaScript. I wrote an Introduction to the HTML5 Canvas article on InformIT.com a couple of weeks ago that you might find informative. You can also just use your favorite search engine to look for "HTML5 Canvas Demo" and you'll find dozens of nifty examples.

Larry