Php and Javascript

I just found a new way of calling a php file
You have heard about this
<script type=”text/javascript” src=”java2.js”>
</script>
The good thing is that you can also call a php file using this SRC attribute javascript just replace “java2.js” with “java2.php” like this
<script type=”text/javascript” src=”java2.php”>
</script>
The good thing is you do n’t have to mess with the design of [...]



Javascript prompt box

Here is a simple javascript for a prompt box

<html>
<head>
<script type=”text/javascript”>
function disp()
{
var name=prompt(”Please enter your name”);
if (name==”ramanean”&&name=”Ramanean”)
{
document.write(”Hello ” + name + “Are you fine?”);
}
}
</script>
</head>
<body>
<input type=”button” onclick=”disp” value=”Display a prompt box” />
</body>
</html>

The above code will display a prompt box “Hello Ramanean Are you fine?” when display prompt box is clicked



Adding a new line in Javascript alert box- line break in alert box

here is a simple javascript for an alert box
<script type=”text/javascript”>
alert(”My name is ramanean”);
</script>
When the above javascript is executed , a alert box will appear with the text “My name is Ramanean”

<script type=”text/javascript”>
alert(”My name is ramanean,My blog is www.ramanean.com,It has useful resources”);
</script>
When the above javascript is executed , a alert box will appear [...]



Simple javascript redirection

here is a simple javascript that can be used for redirecting a user to a fresh page or another web page
<script type=”text/javascript”>
window.location=”http://www.livepr.info/internal-pages-page-rank3.php”;
</script>

When this script is executed the page will be redirected to http://www.livepr.info/internal-pages-rank3.php
Most webmasters user javascript for redirection as it works on all kind of browsers



Simple Javascript

Here is a simple Javascript
<script type=”text/javascript”> document.write(”Hello World!”); </script>
Output:
Hello world
Also you can test this in your browser also
Just Copy this code and paste it in your browser
javascript: document.write(”Hello World!”);
Paste this in your address bar