大约有 20,000 项符合查询结果(耗时:0.0122秒) [XML]
How to get and set the current web page scroll position?
...in hidden variables. Then in the html of the refreshed page I use <body onLoad="window.scrollTo(x,y), where x and y are those from the hidden values values!
– xyz
Nov 4 '10 at 14:32
...
Focus Input Box On Load
... might not be supported in all browsers, so we can use javascript.
window.onload = function() {
var input = document.getElementById("myinputbox").focus();
}
2) How to place cursor at the end of the input text?
Here's a non-jQuery solution with some borrowed code from another SO answer.
fun...
How to detect idle time in JavaScript elegantly?
...a JavaScript:
var inactivityTime = function () {
var time;
window.onload = resetTimer;
// DOM Events
document.onmousemove = resetTimer;
document.onkeypress = resetTimer;
function logout() {
alert("You are now logged out.")
//location.href = 'logout.html'
...
How do you automatically set the focus to a textbox when a web page loads?
...oad', function() {
$("Box1").focus();
});
or plain javascript:
window.onload = function() {
document.getElementById("Box1").focus();
};
though keep in mind that this will replace other on load handlers, so look up addLoadEvent() in google for a safe way to append onload handlers rather than...
Detect when an image fails to load in Javascript
...st that.
function testImage(URL) {
var tester=new Image();
tester.onload=imageFound;
tester.onerror=imageNotFound;
tester.src=URL;
}
function imageFound() {
alert('That image is found and loaded');
}
function imageNotFound() {
alert('That image was not found.');
}
testIma...
How to parse Excel (XLS) file in Javascript/HTML5
...rseExcel = function(file) {
var reader = new FileReader();
reader.onload = function(e) {
var data = e.target.result;
var workbook = XLSX.read(data, {
type: 'binary'
});
workbook.SheetNames.forEach(function(sheetName) {
// Here is your object
...
Cannot set property 'innerHTML' of null
...
If you use window.onload = function name(){} it doesn't matter if the div is before or after.
– Colyn1337
Aug 15 '13 at 14:05
...
Make iframe automatically adjust height according to the contents without using scrollbar? [duplicat
... your iframe to this:
<iframe src="..." frameborder="0" scrolling="no" onload="resizeIframe(this)" />
As found on sitepoint discussion.
share
|
improve this answer
|
...
Pure JavaScript equivalent of jQuery's $.ready() - how to call a function when the page/DOM is ready
...ll to your code at the end of the body. This is faster to execute than an onload handler because this waits only for the DOM to be ready, not for all images to load. And, this works in every browser.
<!doctype html>
<html>
<head>
</head>
<body>
Your HTML here
<sc...
How to change the opacity (alpha, transparency) of an element in a canvas element after it has been
...ctx.restore();
If you need img to be loaded:
var img = new Image();
img.onload = function() {
ctx.save();
ctx.globalAlpha = 0.4;
ctx.drawImage(img, x, y);
ctx.restore()
};
img.src = "http://...";
Notes:
Set the 'src' last, to guarantee that your onload handler is called on all...
