Home  >  Article  >  Web Front-end  >  Script collection iframe_javascript skills

Script collection iframe_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:27:55795browse

1. Close the window without prompting


2. Prevent being iframed
if (top.location != self.location)
{
top.location.href ="http://www.34do.net";
}

3. Determine whether an object exists
document.all("a")==null (does not exist)

4. Pop-up sub-window
window.open ('default.asp', 'newwindow', 'height=100, width=400, top=0, left=0, toolbar=no, menubar= no, scrollbars=no, resizable=no,location=no, status=no')

5. Open the modal window
window.showModalDialog('default.asp',window,'help: No ; resizable: No; status: No;scrollbars:No;center: Yes;dialogWidth:width;dialogHeight:height;')

6. The pop-up child window refreshes the parent window
window.parent.location .reload();

7. The modal window refreshes the parent window
window.parent.dialogArguments.document.execCommand('Refresh');

8. A js file contains another A js file
document.write('<script></script>');

9. Let the text be written vertically

Florent

10. iframe references itself
window.parent.document.getElementById("iframe_dg")
so that it can operate itself in the iframe file, for example: window.parent.document.getElementById("iframe_dg").height=200

11. Automatically adjust the IFrame height according to the content
function autoSetIframeSize()
{
var obj=self.parent.parent.document.all[self.name];
if (obj!=null)
{
self.parent.parent.document.all[self.name].style.pixelHeight=self.document.body.scrollHeight 5;
}
}
The name attribute of iframe must be defined

Modify the of a.asp to:


12. Add gradients to cells Color effect (supported by ie, not supported by firefox)
.bg3
{
FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr=#842B00, EndColorStr=#FFFFFF);
}
The effect is as shown in the figure


13. Scheduled task execution
Specifies that a task should be executed within a certain period of time: delayID=setTimeout(vCode, iMilliSeconds). When necessary, it can be forced Stop the task: clearTimeout(delayID)

14. Automatically select and copy
Select me and copy me

15. Generate random numbers
Rnd of VB The random number generated by the function ranges from 0-1. If you want to randomly select a number from the range of (min, max), the specific formula is as follows: Random number = (max - min) * Rnd() min, min and max can be any integer, but min
16. Limit the text box to only positive integers
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn