JavaScript Tutorials
- What is Javascript?
- What is BOM?
- What is DOM?
- Variable
- check variable value is empty
- JavaScript Output
- Functions
- Javascript Events
- Input Events
- onchange Event
- Javascript Output methods
- If else statement
- Arrays
- Pattern Validation
- Form Validation
- Inner Html Form Validation
- Inline Form Validation
- Checkbox Validation
- Inline Inner Html Form Validation
- Server side php Validation
- Validate a HTML Form with PHP
- window and window location
- Get Text Value
- Get hidden field value
- JavaScript & PHP
- Date Format
- get php value in javascript
- Redirect page & Autoredirect page
- Auto Refresh page & Div
- How to get select text value from Dropdown box
- How to clear browser history in javascript
- Checkbox Problems
- Select option problems
- Popup Contact Form
- Sidebar Contact Form
- How to use a multistep Form or Form wizard
- Auto Calculate Price
- print Application Form
- Auto Calculate GST in Javascript by select price
- Calculate GST by input value in text box Jquery
- Calculate Discount
- onClick Checkbox
- autofil form data click on checkbox
- Show subcategory list
- Show city list as per state
- Show district list as per country and state
- Show good morning good night wish
- image upload with preview image
- Print Div Content
- Show modal popup on page load
- filter table data usign javascript.
- Character Limit Validation.
- Validate File 5MB Upload
- Validate Special character
- More File Upload
- Call JavaScript Function After Page Load
- Drop Down First option Value Disabled --- Please Select ---
- How to Disable Submit Button After Form Submission
- How to disable browser back button using Jquery?
- How to Remove selected item from second & third dropdown list?
- Interview Questions of JavaScript.
Important Link
How to auto redirect page ?
File name : index.php
<!-- <script>
setTimeout(function () {
window.location.href = 'http://google.com/'; // the redirect goes here
},300);
</script>
//-->
<script type="text/javascript">
/* if(error == true){
// Your application has indicated there's an error
window.setTimeout(function(){
// Move to a new location or you can do something else
window.location.href = "https://www.google.co.in";
}, 5000);
//} */
</script>
<script type="text/javascript">
function Redirect()
{
window.location="http://www.google.com";
}
document.write("You will be redirected to a new page in 5 seconds");
setTimeout('Redirect()', 300);
</script>
<script type="text/javascript">
$(document).ready(function () {
// Handler for .ready() called.
window.setTimeout(function () {
location.href = "https://www.google.co.in";
}, 200);
});
</script>
<html>
<head>
<script type="text/javascript">
function Redirect() {
window.location="http://www.tutorialspoint.com";
}
</script>
</head>
<body>
<p>Click the following button, you will be redirected to home page.</p>
<form>
<input type="button" value="Redirect Me" onclick="Redirect();" />
</form>
</body>
</html>
How to redirect page using jscript.
File name : index.php
<select id = "pricingOptions" name = "pricingOptions">
<option value = "500">Option A</option>
<option value = "1000">Option B</option>
</select>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type = "text/javascript" language = "javascript">
jQuery(document).ready(function() {
jQuery("#pricingOptions").change(function() {
if(this.options[this.selectedIndex].value == "500") {
window.location = "http://itechtuto.com";
//window.location = "http://example.com/hi.php?option=500";
}
else if(this.options[this.selectedIndex].value == "1000") {
window.location = "http://google.com";
}
});
});
</script>
<input type="button" onclick="document.location.href = 'http://itechtuto.com'" value="Go to itechtuto">
<input type="button" onclick="document.location.href = 'your_page.php?var1=value1&var2=value2';" value="Go">
<button onclick="setTimeout(myFunction, 3000);">Try it</button>
<script>
function myFunction() {
alert('Hello');
}
</script>
How to redirect url using page load
<script language=javascript>
function redirect(){
window.location = "http://itechtuto.com";
}
</script>
<body onload="redirect()">
</body>
Redirect page when click on button
<script>
// onclick event is assigned to the #button element.
document.getElementById("button").onclick = function() {
window.location.href = "http://www.example.com";
};
</script>
The above code will do the redirection when the user clicks the #button element.
<