AoPS Wiki:Sandbox

Revision as of 19:15, 21 July 2025 by Aoum (talk | contribs) (Experiment)
{{shortcut|[[A:SAND]]}} {{/header}} [[Category:AoPS Wiki]] <!-- Please do not delete this line -->

// Display an alert when the page loads
window.onload = function() {
    alert("Page content has loaded!");
    
    // Change the content of a specific element with ID 'example'
    var element = document.getElementById("example");
    if (element) {
        element.innerHTML = "This is dynamically updated content!";
    }
    
    // Add a new button to the page dynamically
    var newButton = document.createElement("button");
    newButton.innerHTML = "Click Me!";
    newButton.onclick = function() {
        alert("Button clicked!");
    };
    document.body.appendChild(newButton);
};