Thursday, 4 June 2015
Validating the HTML form
The only thing left to do is to return to the validate function. After all the other four functions have been executed, the four variables will either be true or false. We only want to send the form if all four variables are true. If they are not then the user has made an error and we need to keep them on the same page. Here's the rest of the code for the validate function:
Checkboxes
The final function we need is for the checkbox. You can have 1 or more checkboxes on a form. We only have 1, so checking it is fairly straightforward. If you have more than checkbox, though, you do the testing in exactly the same way as for radio buttons.
But here's the code for the checkCheckbox function:
Dropdown Lists
The code to check the dropdown list is more or less the same as for radio buttons. Here it is:
Radio Buttons
Checking radio buttons on a form is a little trickier. You have to loop through each button, testing for a value of checked, which means it was selected. Only one radio button in a group can be selected, so if you find a value of checked you can break out of the loop.
If no radio button was checked then you can return a value of false. If any one of them is checked then you can return a value of true. Here's the code for your radio button function:
Javascript Form Validation - the email function
We'll start with the function that checks the email address text box. We'll only check if the text box has had anything typed into it. Checking for a correct email address is notoriously difficult, so we're just trying to keep things simple here.
Add the following function to your code (you won't be able to copy and paste because ours is an image - you'll learn more if you type it out for yourself):
Wednesday, 3 June 2015
Javascript and HTML Forms
You can use Javascript to check that form elements have been filled in correctly. If not, you can keep your users on the same page and display an error message. If everything is OK then you can submit the form. You'll see how that works now.
SEE CODE BELLOW...
SEE CODE BELLOW...
Javascript Dates and Time
The first thing you need to do is to create a new Date object:
var the_date = new Date();
Note the use of the keyword new. After a space you type the word Date (capital "D"). This is followed by a pair of round brackets. This is enough to create a new date object, which we've assign to a variable called the_date. To see what this prints out, add the following
Function Arguments in Javascript
You can pass values over to your functions. These values are called arguments, and they go between the round brackets of the function. If you have more than one value to pass over, you separated them with commas. Let's look at an example.
Javascript Functions
The scripts we have at the moment are set to run as soon as the page loads in the browser. But they don't have to. A better way is to put the code inside something called a function. A function is just a separate code segment that you call into action. In fact, they don't do anything unless you do call them into action. Let's see how they work.
A function without any code looks like this:
A function without any code looks like this:
function myFunction() {
Javascript Arrays
A normalJavascript variable like var age = 18 holds a single piece of data. An array is a way to hold more than one piece of data under the same name. There's a few ways to set up an array but the simplest looks like this:
var my_array = [10, "ten", true];
Javascript while loops
While loops (lowercase "w") are another programming tool you can add to your armoury. Here's the structure of a while loop:
while ( condition_to_test ) {
}
Instead of the word "for" this time type while.
Javascript Programming Loops
One programming tool common to all languages is the loop. Normally, a programme is executed from top to bottom, with each line of code getting processed in turn. If you want to go back up and not down, you can use a loop. Loops are a great way to execute lines of code again and again. There are many reasons why you want to do this. But take the following sum as an example:
var total;
total = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
total = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10;
Javascript Switch Statements
Sometimes, you'll have more than one value to check for your variables. You can do the checking with a lot of if ... else statements. Or you can use something called a switch statement. Here's an example:
var age = 17;
switch (age) {
case 17:
document.write("under 18");
break;
case 24:
Javascript Logical Operators
Operators you will want to use with your IF Statements are the logical ones. The logical operators give you more options for your IF statements. There are only three to get the hang of:
&& Two ampersands mean AND
|| Two pipe characters mean OR
! One exclamation mark/point means NOT
As an example, create the following code for a web page
Javascript Comparison Operators
They have used the double equal sign (== ). But there are other operators you can use besides the double equal sign. These are known as comparison operators. Here are some more of them. Remember, all these evaluate to either true or false.
!= Is not equal to
> Greater Than
< Less Than
>= Greater Than or equal to
<= Less Than or equal to
Javascript IF ... ELSE
This lesson continue from the previous one
You can also add an else part to your IF statements. This is for when you want to say what should happen if your IF Statement evaluates to false. As an example, change your code to this:
var first_name = "Benny";
if ( first_name == "Kenny" ) {
document.write("First Name is " + first_name);
}
else {
Javascript and IF Statements
Javascript is what's known as a sequential programming language. This means that each and every line of code is executed from top to bottom. Quite often, however, you don't want every line to execute - you'll want more control over the way your programmes work.
One way to control the flow of your code is with conditional logic. Conditional logic is all about what happens IF a condition is met or not met. For example, you may have an email text box on a form that you want your users to fill in. You don't want this text box to be empty when the user click the SUBMIT button. So you need a way to say "IF the email address is missing THEN don't send the form". You do this with IF Statement.
Mathematical Operators
You can use the mathematical operators with variables. This allows you to add up, multiply, subtract, and divide. The mathematical operators are these:
- The plus symbol ( + ) is used for addition
- The minus symbol ( - ) is used for subtraction
- The asterisk symbol ( * ) is used for multiplication
- The forward slash symbol ( / ) is used for division
- The percentage symbol ( % ) is used for modulus calculations
Javascript Variables
In programming terminology, a variable is a storage area. You store things in variables so that you can retrieve them later. Think of variables as small boxes. You can write a number on a piece of paper then place that piece of paper in a box. Write a label on the box, such as "Mom's phone number", and you'll have a quick way to identify what kind of information you have stored in the box. One day, you might even decide to phone Mom. If so, you can
A First Javascript
Fire up whatever text editor you're comfortable with. For us, we're going to be using Notepad on a Windows machine. Add the simple HTML you see below:
Tuesday, 2 June 2015
EFCC detains ex-Adamawa governor, Nyako
A former governor of Adamawa State, Murtala Nyako, who returned to Nigeria after nearly a year on self-imposed exile, has been detained by the Economic and Financial Crimes Commission, EFCC.
Mr. Nyako was still at the commission’s office in Abuja by 5 p.m. Monday. He was said to have surrendered himself to the commission Monday afternoon.
Monday, 1 June 2015
FROM THE ARCHIVE: Buhari’s First Speech As Nigeria’s Military Head of State In December 1983
In pursuance of the primary objective of saving our great nation from total collapse, I, Major-General Muhammadu Buhari of the Nigerian army have, after due consultation amongst the services of the armed forces, been formally invested with the authority of the Head of the Federal Military Government and the Commander-in-Chief of the armed forces of the Feder
Buhari warns airport officials, others, against stopping ex-Ministers from travelling
President Muhammadu Buhari says officials of past administrations including ministers are entitled to their full rights and privileges under the constitution, and must not be subjected to any undue harassment and intimidation at the airports or at other points of entry and exit.
“We have not banned anyone from travelling,” Mr. Buhari said in a statement Saturday.
PDP raises alarm over fresh plot to remove Fayose; begs Buhari to intervene
The Peoples Democratic Party has raised the alarm over what it called an illegal plot by some members of the ruling All Progressives Congress, to oust Ekiti State governor, Ayodele Fayose.
Mr. Fayose, who has been having a running battle with the members of the State House of Assembly, had obtained a court order restricting the members from proceeding with the impeachment process.
MTN UNLIMITED NIGHT FREE BROWSING
MTN UNLIMITED NIGHT FREE BROWSING
“Free internet browsing all night long every day when you spend at least N200 during the day! Unlimited data available btw 1:00am – 5:00am. Only on MTN iPulse!”
How to increase AdSense Revenue
There is a great deal more to making money from AdSense than just putting up a
site and putting Google AdSense ad code on those pages. In fact, successful
AdSense publishers spend several hours per week – after the site is built and the
ads are running – ensuring that they are getting the absolute most possible
site and putting Google AdSense ad code on those pages. In fact, successful
AdSense publishers spend several hours per week – after the site is built and the
ads are running – ensuring that they are getting the absolute most possible
Common mistakes by webmaster to Low trafic in Website and Blog
“Help! Google banned me from the AdSense program!”
This is a common cry that you will hear on AdSense related forums. Yet another
person who failed to read and adhere tothe Google AdSense program policies. It
happens every single day.Will it happen to you?
The worst mistake you can possibly make in the Google AdSense program is not
This is a common cry that you will hear on AdSense related forums. Yet another
person who failed to read and adhere tothe Google AdSense program policies. It
happens every single day.Will it happen to you?
The worst mistake you can possibly make in the Google AdSense program is not
Key to success in Website Trafic
Keys To Success
There are numerous factors that will determine your success in the Google
AdSense program. There is no luck to it. You can be the most unlucky person
in the world, and still succeed with Google AdSense. It’s all about understanding
exactly how to run your Google AdSense Empire.
AdSense program. There is no luck to it. You can be the most unlucky person
in the world, and still succeed with Google AdSense. It’s all about understanding
exactly how to run your Google AdSense Empire.
Website Traffic generation
Traffic Generation - Methods To Avoid
There are many ways to get traffic to a site. You will most likely do research to
find out about those traffic generation methods.
Methods such as article marketing, forum marketing, pay-per-click advertising,
social networking, blogging, and social bookmarking all work very well. But in the
world of Internet Marketing, there are also traffic techniques that you should
avoid, for various reasons.
find out about those traffic generation methods.
Methods such as article marketing, forum marketing, pay-per-click advertising,
social networking, blogging, and social bookmarking all work very well. But in the
world of Internet Marketing, there are also traffic techniques that you should
avoid, for various reasons.
How to apply for Google Adsense
Applying For Your Adsense Account
Once you are prepared to apply for a Google AdSense account, it’s as simple as
filling out a form. But there are some aspects of that form that can be a bit
confusing.
In this section, I’ll go over filling out the form, so that Google will approve you
without any problems. You can find the form to apply for an AdSense account at:
http://www.google.com/adsense/g-app-single-1.
Once you are prepared to apply for a Google AdSense account, it’s as simple as
filling out a form. But there are some aspects of that form that can be a bit
confusing.
In this section, I’ll go over filling out the form, so that Google will approve you
without any problems. You can find the form to apply for an AdSense account at:
http://www.google.com/adsense/g-app-single-1.
Google Adsense
Preparing For Your Adsense Account
The hardest part of getting started with AdSense is getting Google to approve
your website. In fact, for many, it is easier to get a $100,000 bank loan than it is
to get a free Google AdSense account. The key is to be prepared before you apply.
You can’t start using Google AdSense on your pages until you are approved. This
means that you must prepare to open an account, before you apply for an
account.
The hardest part of getting started with AdSense is getting Google to approve
your website. In fact, for many, it is easier to get a $100,000 bank loan than it is
to get a free Google AdSense account. The key is to be prepared before you apply.
You can’t start using Google AdSense on your pages until you are approved. This
means that you must prepare to open an account, before you apply for an
account.