Latest web development tutorials

Fokus jendela () metode

Jendela Referensi Obyek objek jendela

Definisi dan Penggunaan

() Metode fokus untuk memberikan keyboard fokus jendela.

tatabahasa

window.focus()


Dukungan Browser

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Semua browser utama mendukung fokus () metode


contoh

contoh

Pastikan bahwa jendela baru menerima fokus (sebelum mengirim jendela baru):

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> Tutorial ini (w3big.com) </ title>
<Script>
berfungsi openWin () {
MyWindow = window.open ( '', '', 'width = 200, height = 100');
myWindow.document.write ( "<p> Ini adalah 'jendela' </ p>");
myWindow.focus ();
}
</ Script>
</ Kepala>
<Body>

<Input type = "button" value = "jendela yang terbuka" onclick = "openWin ()" />

</ Body>
</ Html>

Coba »


contoh

contoh yang lebih

Pastikan bahwa jendela baru tidak mendapatkan fokus


Jendela Referensi Obyek objek jendela