Table of Contents
Introduction
JavaScript browser windows के लिए popups create करने और उन्हें manipulating करने के लिए different methods provides करता है!.
window.open(url, name, features)
यह method एक new browser window opens करती है specified URL, name, and features के साथ!.
Example:
// Open a new window with Google as the URL, named 'google', and with specified features var googleWindow = window.open('https://www.google.com', 'google', 'width=600,height=400');
window.close()
ये method current window या window.open() का इस्तेमाल करके open की गई window को close करती है!.
Example:
<script> // Close the current window window.close(); </script>
window.alert(message)
ये method alert dialog box display करता है specified message के साथ!.
Example:
<script> // Display an alert with a custom message window.alert('Hello, World!'); </script>
window.prompt(message, defaultText)
यह method प्रांप्ट ( पूछताछ ) dialog box displays करता है जिसमे specified message और एक optional default text input value होता है!. यह user के द्वारा enter किये गई text को return करेगा या canceled करने पर null return करेगा!.
Example:
<script> // Display a prompt with a custom message and default text var name = window.prompt('What is your name?', 'John Doe'); if (name) { console.log('Hello, ' + name + '!'); } else { console.log('No name entered.'); } </script>
window.confirm(message)
यह method एक confirmation dialog box displays करती है जिसमे specified message और OK/Cancel buttons होते है। यह users के द्वारा OK (true) और Cancel (false) button पर click किया गया है यह देखा रहा है!.
Example:
<script> // Display a confirmation dialog and show a message based on user's choice var result = window.confirm('Are you sure you want to delete this item?'); if (result) { console.log('Item deleted successfully.'); } else { console.log('Deletion canceled.'); } </script>
ये कुछ example है जो javascript के window methods के है जो popup create करने और browser window को manipulating करने के लिए है!.