In PHP, we can use the header() function to redirect the URL.
In HTML, we can use the meta tag to redirect the URL.
For more information, visit PHP/HTML – Redirect URL in Seconds
If the delayed function has input parameters, setTimeout() would fail when you simply add the parameters in the setTimeout() call.
<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.4.js"></script>
<script type="text/javascript">
$(document).ready(function() {
/* The call will fail and the alert box will display immediately */
setTimeout(delayedAlert("Hi Eureka!"), 3000);
});
function delayedAlert(str) {
alert(str);
}
</script>
So if the Javascript/JQuery is related to the layout and independent of the module, we should add it in the theme instead. For example, i want to have a alert box whenever a page is loaded, i should then add it to my current Drupal theme. The steps are listed below.
1. Open you current theme folder and add the following line in the theme.info.
In Drupal, you can add your Javascript to module or theme. If the javascript is related to the module logic and independent of the theme, we should add the .js file in the module. Moreover, Drupal already includes the JQuery library. So we can use the JQuery functions in the .js file.
When you are using jQuery with other Javascript libraries such as Prototype. There will be conflict on the $() function. There are 3 ways to bypass the conflict.
1. Only use jQuery() for the jQuery calls and revert the $() to Prototype
jQuery.noConflict();
// Use jQuery via jQuery(...)
jQuery(document).ready(function(){
jQuery("div").hide();
});
// Use Prototype with $(...), etc.
$('someid').hide();
i got an xsl_variable which can be retrieved by <xsl:value-of select=”./xsl_variable” /> in the .xsl. i would like to pass this variable to a Javascript function called popup() inside the <a href>. Continue reading XSLT – Using XSL Variable inside <a href>→