जावास्क्रिप्ट में बैकग्राउंड इमेज की प्रारंभिक स्थिति सेट करने के लिए, backgroundPosition प्रॉपर्टी का उपयोग करें। यह आपको इमेज की स्थिति सेट करने की अनुमति देता है।
उदाहरण
जावास्क्रिप्ट के साथ बैकग्राउंड इमेज की सभी स्थितियों को सेट करना सीखने के लिए निम्न कोड चलाकर देखें:
<!DOCTYPE html> <html> <head> <style> body { background-repeat: no-repeat; } </style> </head> <body> <button onclick="display()">बैकग्राउंड इमेज सेट करने के लिए क्लिक करें</button> <script> function display() { document.body.style.backgroundImage = "url('https://www.tutorialspoint.com/html5/images/html5-mini-logo.jpg')"; document.body.style.backgroundPosition="top right"; } </script> </body> </html>