Here are some good practices to follow for Javascript. Remember that when you are using any programing language or scripting language when you define variables try to use a meaningful name, remember to put some internal documentation like I did to help explain to you what the code is doing, becuase 6 months later it save you a heck of allot of time when you are trying to remember or figure out how everything works. When you develop other projects or your own and you leave them to develop other things you loose track and having internal documentation will help.
Remember to close your variables with a semicolon. Declatartions like statements, end with a semicolon and ca be split over several lines with each vfariable in the declaration separated by a comma. To declare multiple Variables in javascript try this:
<script type = "text/javascript">
<!--
var super, slick, and, lots, of, diff, names;
// -->
<script />
</script>
August 30th, 2005
Prompt and alert boxes can be used in Webpages to add input from users. This turtorial and script builds upon knowleadge which you would of got if you read all the javascript articles This script uses another predefined dialog box from the window object which is in this case the prompt dialog box which allows the user to input a value that the script can use. The program in this cases asks the user to input a name, the name is stored as a variable, it then echos or prints the name out using Javascript.
You can learn more about this by clicking here or here
For this we are going to be using a XHTML Strict Doc Type
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="UTF-8" />
<title>Fabio DRN tutorial on Prompt and Alert Boxes</title>
<script type="text/javascript">
<!--
var username //username is a variable set by the user
// this will make username variable equal to whatever the window prompt box input value
username = window.prompt("Please type in your name, "")
// try this
// username = window.prompt("Please type in your name, "and this will equal the default field so it will say something")
// javascript will then write it in, it works top to bottom sequentially
document.writein("<h1>" + username + " welcome to FabioDRN< /h1>"
// -->
</script>
</head>
<body>
</body>
</html>
August 30th, 2005
Splash, introduction pages, agreement pages, and just about anything else that stops you from getting to the content fast should be stripped from your website. Believe it or not, some people don’t care about how much money, or your skills in flash introductions, they actually come to your website not for the introduction but the actual content.
The initial use of the internet is to communicate. Communication can mean anything from sharing your files to chatting to your buddy on an IM application. Websites are like a document online, with hyperlinks and have transformed to be visually appealing. Even though we have added fancy text, text with shadows, and frogs which talk, the initial purpose of the webpage has not changed.
When you start your website there is many questions to ask your self like the title of the site, but the most important question is; ‘What is your website about?’, and ‘What is its purpose?’
I am going to do this with this website so you can see how planning works. This website is about Website Development and technologies. Its purpose is to educate and deliver content to the user about this. The key words – again this is debatable but for this paragraph – are deliver and content. Other sites may want to deliver another type of format of information, such as music, PDFs, applications and what ever else exists on the internet. Since our main priority is to deliver this content, delaying it is just contradicting the sites purpose.
The problems…
Remember that websites are not a movie; people do not need to be introduced through an animation which usually has nothing to do with what they are looking for. In fact if I was to put a Splash page on this site, and introduce other content on this site how long would it take to go through the whole splash? Even just the content from just last month would take a while to go through.
Many people create Splash pages with out putting a skip introduction link, which makes it impossible to get the content with out waiting. Or if they do put a link to skip the introduction, they incorporate it in their presentation which is usually a third-party plug-in, or Active-X control which many users (including me) disable it because it wastes to much – bandwidth (mine and theirs), time, processing power, security and space – so if some one doesn’t have flash enabled what are they going to see, a blank page with a Download Plug-in message in the middle.
I intentionally come late to movies at cinemas to miss opening titles and all the crap. Imagine a user coming back to your website again and again, and having to click skip all the time.
Haven’t I ever heard of the cookie?
You’re probably wondering “but you can prevent users from seeing the same message over and over by using a cookie?” The con’s is to this;
most some of the user’s browsers reject cookies a
- anti-spy ware software deletes cookies
- cookies expire –there’s ways out of this.
So no matter what you cannot cover the whole community of users, because not all users have cookies, have them enabled or keep them.
Imagine going to Google to search and you had to go through a presentation of what Google is, or its new features. There are better ways to illustrate content with out having a splash screen. Remember your initial purpose of your site.
Not convinced?
If you use Active-X, a third party application or a client side scripted script application, make sure that there is away around this to get to your content or your site. If your site is completely in Java, Flash or another plug-in Active X object
always provide an alternative, for accessibility purposes and search engine optimization.
Use cookies to redirect users after they have seen the presentation once, make sure the skip intro link always visible. If you are using flash, put the non-html page first and then use flash to redirect the user on the first frame. The purpose of this is so that you do not need to use a Client Side Script to check if the user has Flash, flash will redirect the user to your full flash object/page/movie/splash and if there is no flash then it cannot redirect, and you do need to put of search engines and other users because they be at the feet of the content.
I spent ages or allot of money to get this intro done… I don’t want to get rid of it
If you wish to show off your skills, I’m sure that 100% your audience or your future audience (which isn’t able to view your website due to its poor accessibility) doesn’t care or appreciate of your skills or wants to know or see how much money you spent creating this intro, or that it looks really good. If you must put a link on webpage to a splash page – this defeats the purpose of it to be the first thing but I don’t see a need for it at all.
I Agree/Disagree
If you need users to agree to content for what ever reason it is, you can get around this with disclaimers which are still visible to the user. If your site needs to have an I agree or Disagree chances are its not going to help you at all in court, and if you’re providing that sort of content you are probably using the internet for all the wrong reasons. Another alternative to this is making the page per membership so the user agrees once they log-in, the agreement is agreed through a contract which they accepted when they joined your site.
More Incorrect uses of the Splash Page
A splash page is not an about page, or an about us page, and it is nether a
FAQ pages or a privacy policy. These all have their right full places, and because you are using the splash page incorrectly – though I just stated there is no correct uses, the questions are still going to be asked, people will not know what your on about, and the people who do know what it’s about get frustrated because their wasting there time bandwidth etc. on junk that they have seen before.
Your opinions on this are appreciated comment below – even comment if you think their good I would like to know why.
Other
a I said this because when you are using Internet Explorer, which allot of users use because of x reasons, it blocks cookies with its ‘Privacy Report’ this site you may of noticed picks up cookies for one of the external stats programs
August 29th, 2005