Place your text ad here.
World class data recovery software and renowned raid recovery services
WestNIC provides reliable web hosting services
Free software downloads and drivers download resources
Ahosting.biz reseller hosting, managed dedicated server with 24/7 support
This FAQ is part of the Code Style Help and FAQ section. Use the help request form below if your question is not answered here, but make sure you are asking the right question first.
A: You are strongly recommended to use CSS to achieve your print requirements, it is much better suited to this task and is more likely to be enabled in the users' browser. See the Media dependent style sheets FAQ for full details.
A: The answer to this question depends on the medium you use for your text output. If you want to raise a Javascript alert, confirm or prompt containing Arabic, you must use a Unicode escape sequence: a back slash followed by a lower case letter u and a 4 digit hexadecimal number for the Unicode code point, as in the example below:
More details available to subscribers:
How can I write Arabic characters in my Javascript?
A: To create robust logical redirection for the Web you should use server side techniques; a simple, functionally transparent example is used in the noscript version of this demonstration. If confirmation is only intended as a gimmick and is not critical for navigation purposes, you can redirect the user using the window.location property.
More details available to subscribers:
How can I redirect based on a confirm response?
A: Generally, it is better to use server side redirection using the HTTP 301 (moved permanently), 302 (found) or 303 (see other) status codes. These mechanisms should maintain appropriate back navigation with most common browsers.
More details available to subscribers:
How do I make sure redirects have the right "back" page?
A: This really depends how you have set the quiz up in the first place, but you could redirect the contestant to a results page and append the cumulative score variable to the query part of the URL...
More details available to subscribers:
How can I generate a quiz results page?
A: The URL of the current page is represented by the Javascript window.location object. There are several components to the location object that represent parts of the URL. The relative URL of the page is given by the location.pathname property, plus any query or "search" part and fragment identifier or "hash". Not all URLs include a query and fragment identifier, so these properties may be null and need to be checked, as below.
More details available to subscribers:
How can I get the relative URL of a page?
A: The usual way to invoke a script without a direct user action is to attach a function to the browser window's onload event handler. This event occurs when an HTML document is fully loaded and will automatically call your function. There are two ways to declare an onload event handler: add an onload attribute to the body element of the HTML, or assign the function in your Javascript, as below.
... <body onload="myFunction();"> ...
window.onload = myFunction;
Either approach will be sufficient. Don't use both or one will override the other.
A: The most important thing about using timeouts is to create a global variable, a "handle", by which you can clear the timeout if you need to.
More details available to subscribers:
How should I write a script using timeouts?
A: Since Perl code is executed on the server side, you need to submit an HTTP request to your Perl script that indicates whether Javascript is enabled on the client side. You could do this by dynamically writing the variable to a hyperlink URL, or perhaps a hidden form field, as below.
More details available to subscribers:
How can I check if Javascript is enabled in my Perl script?
A: If you are the author of the HTML code, then you control whether there is any Javascript in the document in the first place. If you want Javascript to run to start with, then stop functions from working later, you can set a boolean property that controls whether the functions execute or not, as below.
More details available to subscribers:
Is there a way to turn Javascript off in the HTML code?
A: This script sets a simple boolean variable called enabled when the page loads. A function called disable() is attached to an onclick event handler on the first image button, and an enable() function is attached to the second. The script includes alerts that notify the state of the system.
More details available to subscribers:
How can I toggle button images to enable and disable them?
A: It is possible to check for Latin 1 characters using Javascript, though the usual conditions apply; if Javascript is not enabled, no check will be made, so it is better to do this kind of thing on the server side, or double-up with both.
One relatively simple way to check for non-Latin characters would be to define a single string that contains all valid Latin 1 characters. Loop through each character in the input string and check it is in the reference string. See the example that follows.
More details available to subscribers:
Is it possible to filter non-Latin 1 characters?
A: Client side Javascript cannot be used to provide secure authentication for Web sites because all the code would be accessible to users. Anyone with a reasonable knowledge of Javascript could use the source code to decrypt the authentication details and gain access.
A robust authentication system can only be implemented using server side techniques. Methods vary according to the Web server you use, but lots of pointers are available from Google, search for HTTP authentication.
| Front-end FAQs | Back-end FAQs | Learning Java |
|---|---|---|
See site help for questions about this site, our text ads and sponsored links services.