How to write for loop in javascript?

Example:
Code:


var a=1;
for (a=1;a<=10;a++)
{
document.write("The number is " + a);
document.write("
"); }

Output:

The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
The number is 10 [...] more>>

...

How to declare a variable in javascript?

You can create JavaScript variables with the var keyword, as follows:

<script type="text/javascript">
var a;
var name;
</script>

After the declaration , the variables are empty (they have no values).
you can also assign values to the variables when you declare them,as follows:

<script type="text/javascript">
var a=10;
var name="John";
</script>

Note: [...] more>>

...

How to add string and number in javascript?

Example:
Code:

<html>
<body>
<script type="text/javascript">
var a;
a=10+10;
document.write(a);
document.write("
"); a="10"+"10"; document.write(a); document.write("
"); a=10+"10"; document.write(a); document.write("
"); a="10"+10; document.write(a); document.write("
"); </script> </body> </html>

Output:

2 [...] more>>

...

How to print in Javascript ?

<html>
 <body>
 <script type="text/javascript"> 
{
 document.write("<h1>This is a heading</h1>");
 document.write("<p>Hello.</p>");
document.write("<p>World.</p>");
 }
 </script>
 </body> 
</html>
 

OutPut:

This is a heading

Hello.

World. [...] more>>

...

Display date in inner html

Example:
Code:

<html>
<head>
<script type="text/javascript">
function displayDate()
{
document.getElementById("idname").innerHTML=Date();
}
</script>
</head>
<body>

<h1>The First  Page</h1>
<p id="idname">This is a first paragraph.</p>

<button type="button" onclick="displayDate()">Display Date</button>

</body>
</htm [...]  more>>

...

What is view state?

The web is stateless. But in ASP.NET, the state of a page is maintained in the in the page itself automatically. How? The values are encrypted and saved in hidden controls. this is done automatically by the ASP.NET. This can be switched off / on for a single control [...] more>>

...

How do I eliminate the blue border around linked images?


in your CSS, you can specify the border property for linked images:

a img { border: none ; }
However, note that removing the border that indicates an image is a link makes it harder for users to distinguish quickly and easily which images on a web page are clickable. [...] more>>

...

file_put_contents()

This function writes a string to a file.

Syntax: file_put_contents(file,data,mode,context)

Description:

The Parameter “file” is Required. It Specifies the file to write to. If the file does not exist, this function will create one.

The second Parameter “data” is Required. The data to write to the file. Can be a string, an array or a data stream.

The third Parameter “mode” is Optional.It [...] more>>

...

fileatime()

This function returns the last access time of the specified file.

Syntax: fileatime(filename)

Description:

The Parameter filename is Required. It Specifies the file to check.

This function returns the last access time as a Unix timestamp on success, FALSE on failure.

Example:
Code:

echo fileatime("test.txt");
echo "
"; echo "Last visit: ".da [...] more>>

...

file_get_contents()

The function reads a file into a string.

Syntax: file_get_contents(path,include_path,context,start,max_length)
Description:

The first parameter “path” is Required. It specifies the file to read.

The second parameter include_path is Optional. It Set this parameter to ‘1’ if you want to search for the file in the include_path (in php.ini) as well.

The third parameter “context” is Optional. I [...] more>>

...

is_readable()

The is_readable() function checks whether the specified file is readable.

Syntax: is_readable(file)

Description:

The parameter “file” is Required. It specifies the file to check.

This function returns TRUE if the file is readable.

Example:
Code:

$file = "test.txt";
if(is_readable($file))
 echo ("$file is readable");
  }
else
  {
  e [...]  more>>

...

Filesize()

This function returns the size of the specified file.

Syntax: filesize(filename)

Description:

The argument “filename” is Required. It specifies the file to check.

This function returns the file size in bytes on success or FALSE on failure.

Example:
Code:

echo filesize("test.txt");

Output:

34 [...] more>>

...