var button = document.createElement("Button"); button.innerHTML = "💪🗿Gigachad Calculator🗿💪"; button.style = "top:80px;left:825px;position:absolute;z-index:99999;padding:15px;margin-top:80px;border:5px solid black;border-radius:16px;font-size:15px;cursor:pointer;"; document.body.appendChild(button); button.onclick = function(){ var options = ["1. Procent af et givent tal (fx. 20% af 100)", "2. Find originale tal efter en stigning (fx. tallet et 120 efter en stigning på 20%, hvad var det originale tal?)", "3. Hvor meget har jeg sparet? (fx. et produkt koster 80kr, fordi der er et tilbud på 20 procent. Hvor meget sparer jeg, hvis jeg køber produktet?)", "option 4", "option 5", "option 6", "option 7", "option 8", "option 9", "option 10", "option 11", "option 12", "option 13", "option 14", "option 15", "option 16", "option 17", "option 18", "option 19", "option 20"]; // Create a string of options separated by newlines var optionsString = options.join("\n\n"); // Show a prompt with the options and ask for a choice var choice = prompt("Vælg en af de følgende valg muligheder:\n\n" + optionsString); // Convert the choice to a number var choiceNumber = Number(choice); // Check if the choice is valid if (choiceNumber >= 1 && choiceNumber <= 20) { // Execute the code for the chosen option switch (choiceNumber) { case 1: // Ask for a number and a percentage var number = prompt("Skriv tallet du vil tage en procent af:"); var percentage = prompt("Skriv den procentdel, der skal tages af tallet:"); // Calculate the certain percentage of the number var answer = number * (percentage / 100); // Display the answer in an alert alert(percentage + "% af " + number + " er: " + answer + "."); break; case 2: // Ask for the value of rise in percent and number var rise = prompt("Skriv stigningen i procent (uden % tegn):"); var number = prompt("Skriv tallet:"); // Calculate the original number before the rise var original = number / (1 + rise / 100); // Display the answer in an alert alert("Det originale tal er: " + original); break; case 3: var currentPrice = prompt("Skriv den nuværende pris på varen:"); var offerPercentage = prompt("Skriv hvor stort tilbudet er i procent (uden % tegn):"); // Calculate the original price before the offer var originalPrice = currentPrice / (1 - offerPercentage / 100); // Calculate the amount of money saved var moneySaved = originalPrice - currentPrice; // Display the money saved in an alert alert("Du sparer: " + moneySaved + " på produktet"); break; // ... and so on for the rest of the options default: break; } // Show an alert with the chosen option alert("Du valgte: " + options[choiceNumber - 1]); } else { // Show an alert with an invalid choice alert("Vælg venligst et tal imellem 1 og 20."); } }; // Create a search field and a button var searchField = document.createElement("input"); searchField.type = "text"; searchField.placeholder = "Skriv dit regnestykke her!"; // Add some CSS to the search field searchField.style.border = "2px solid black"; // Give it a black border searchField.style.borderRadius = "10px"; // Make it have rounded edges searchField.style.padding = "5px"; // Add some space inside the field var searchButton = document.createElement("button"); searchButton.textContent = "Udregn"; searchButton.onclick = function() { // Get the value of the search field var query = searchField.value; // Replace spaces with "+" to make the query more accurate query = query.replace(/\s/g, "+"); // Encode the query to prevent special characters from being deleted query = encodeURIComponent(query); // Create a Google window inside the current window var googleWindow = window.open("https://www.google.com/search?q=" + query, "Google", "width=800, height=600"); }; // Add some CSS to the button searchButton.style.border = "2px solid black"; // Give it a black border searchButton.style.borderRadius = "10px"; // Make it have rounded edges searchButton.style.padding = "5px"; // Add some space inside the button searchButton.style.marginLeft = "10px"; // Add some space between the button and the field // Create a div element to wrap the search field and the button var searchDiv = document.createElement("div"); // Add some CSS to the div element searchDiv.style.position = "fixed"; // Make it fixed on the screen searchDiv.style.top = "70px"; // Position it 10 pixels from the top searchDiv.style.right = "675px"; // Position it 10 pixels from the right // Append the search field and the button to the div element searchDiv.appendChild(searchField); searchDiv.appendChild(searchButton); // Append the div element to the document body document.body.appendChild(searchDiv);