How to Avoid Javascript Void
The "javascript:void(0);" statement is often when a link has no URL attached to it but is used to reference a JavaScript function. If there is no URL attached to the link, the browser does not know what to do and returns you to the top of the page. Using "javascript:void(0)" in this instance can cause certain browsers to present your web page in unusual ways. Instead, you should use the "return false;" statement to tell the browser not to look for the URL.
Difficulty: Easy
Instructions
Things You'll Need:
· Text editor
1. Step 1
Open the document in any text editor.
2. Step 2
Locate the "javascript:void(0)" references within the document.
3. Step 3
Replace the links with the pound symbol (#) with the syntax "<a href="#"'>."
4. Step 4
Add the "return false" declaration to the statement. The entire link reference would look like:
<a href="a" onClick="callFunction();return false;">Link</a>
Replace "callFunction()" with the name of your function.
5. Step 5
Save and close the file.
Please do not print this email unless it is absolutely necessary.
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
0 comments:
Post a Comment