Log in / Sign Up Create a free W3Schools Account to Improve Your Learning Experience My Learning Track your learning progress at W3Schools and collect rewards Upgrade Become a PLUS user and unlock powerful features (ad-free, hosting, support,..) Where To Start Not sure where you want to ...
window.open("https://www.w3schools.com/"); Try it Yourself » Open a new window. Use close() to close the new window: functionopenWin() { myWindow = window.open("","myWindow","width=200,height=100");// Opens a new window ...
functionopenWin() { myWindow = window.open("https://www.w3schools.com","_blank","width=200, height=100"); } functioncloseWin() { myWindow.close(); } Try it Yourself » Browser Support close()is supported in all browsers:
Open a new window, and move it to position 500 x 100: function openWin() { myWindow = window.open('', '', 'width=400, height=200'); } function moveWin() { myWindow.moveTo(500, 100); } Try it Yourself » More examples below.Description...
myFunction(mmObj); // Add the match function as a listener for state changes mmObj.addEventListener("change",function() { myFunction(mmObj); }); Try it Yourself » Browser Support matchMedia()is supported in all modern browsers:
functionstartCount() { if(!timer_on) { timer_on =1; timedCount(); } } functionstopCount() { clearTimeout(timeout); timer_on =0; } Try it Yourself » Browser Support clearTimeout()is supported in all browsers: ChromeEdgeFirefox...
functionnewDoc() { window.location.assign("https://www.w3schools.com") } Try it Yourself » Track your progress - it's free! Log inSign Up
The new window width, in pixels heightRequired. The new window height, in pixels Return Value NONE More Examples Using resizeTo() with resizeBy(): functionresizeWinTo() { myWindow.resizeTo(800,600); } functionresizeWinBy() { myWindow.resizeBy(-100, -50); ...
functionstartTime() { constdate =newDate(); document.getElementById("txt").innerHTML= date.toLocaleTimeString(); setTimeout(function() {startTime()},1000); } Try it Yourself » Pass parameters to the function (does not work in IE9 and earlier): ...
functionframe() { if(width ==100) { clearInterval(id); }else{ width++; element.style.width= width +'%'; } } } Try it Yourself » Browser Support clearInterval()is supported in all browsers: ChromeEdgeFirefoxSafariOperaIE YesYesYesYesYesYes ...