Practical tips for making 13 JavaScript Web sites

Source: Internet
Author: User
Javascript| Skill 1. Will completely screen the right mouse button oncontextmenu= "Window.event.returnvalue=false"

<table border Oncontextmenu=return (false) ><td>no</table> available for table

2. Deselect, prevent replication
<body onselectstart= "return false" >

3. No pasting onpaste= "return false"

4. Prevent copy oncopy= "return false;" oncut= "return false;"

5. IE address bar before replacing their own icon <link rel= "shortcut icon" href= "Favicon.ico" >

6. You can display your icon in the Favorites folder <link rel= "Bookmark" href= "Favicon.ico" >

7. Close the Input method <input style= "ime-mode:disabled" >

8. Always with the frame

<script language= "JavaScript" ><!--
if (window = top) Top.location.href = "frames.htm"; Frames.htm for frames page
--></script>

9. Prevent a person from being frame

<script language=javascript><!--
if (top.location!= self.location) top.location=self.location;
--></script>

10. Web pages will not be saved as

<noscript><iframe src=*.html></iframe></noscript>

11. View Web page source code

<input type=button value= View Web page source code
View-source: "+" http://www.pconline.com.cn "" >

12. Confirm upon deletion

<a href= "Javascript:if (" Are you sure you want to delete it? ") location= "boos.asp?&areyou= Delete &page=1" "> Delete </a>

13. Get the absolute position of the control

Javascript
<script language= "Javascript" >
function Getie (e) {
var t=e.offsettop;
var l=e.offsetleft;
while (e=e.offsetparent) {
T+=e.offsettop;
L+=e.offsetleft;
}
Alert ("top=" +t+ "/nleft=" +l);
}
</script>

VBScript
<script language= "VBScript" ><!--
function Getie ()
Dim t,l,a,b
Set A=DOCUMENT.ALL.IMG1
T=document.all.img1.offsettop
L=document.all.img1.offsetleft
While a.tagname<> "Body"
Set a = A.offsetparent
T=t+a.offsettop
L=l+a.offsetleft
Wend
MsgBox "Top=" &AMP;T&AMP;CHR & "left=" &l,64, "get position of control"
End Function
--></script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.