var form = document.getElementById('content-form');
var frame = document.getElementById('content-frame');
var backgrounds = {
space: 'https://images.unsplash.com/photo-1502134249126-9f3755a50d78?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxleHBsb3JlLWZlZWR8M3x8fGVufDB8fHx8&w=1000&q=80',
ponies: 'https://images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com/f/e3490199-0334-4ea5-89b4-d05970093cda/d4j9n4k-cd027684-5a65-47a1-80fe-c11575cb942a.png/v1/fill/w_1192,h_670,q_70,strp/my_little_pony_fim_six_mane_wallpaper_by_bluedragonhans_d4j9n4k-pre.jpg?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ1cm46YXBwOjdlMGQxODg5ODIyNjQzNzNhNWYwZDQxNWVhMGQyNmUwIiwiaXNzIjoidXJuOmFwcDo3ZTBkMTg4OTgyMjY0MzczYTVmMGQ0MTVlYTBkMjZlMCIsIm9iaiI6W1t7ImhlaWdodCI6Ijw9MTA4MCIsInBhdGgiOiJcL2ZcL2UzNDkwMTk5LTAzMzQtNGVhNS04OWI0LWQwNTk3MDA5M2NkYVwvZDRqOW40ay1jZDAyNzY4NC01YTY1LTQ3YTEtODBmZS1jMTE1NzVjYjk0MmEucG5nIiwid2lkdGgiOiI8PTE5MjAifV1dLCJhdWQiOlsidXJuOnNlcnZpY2U6aW1hZ2Uub3BlcmF0aW9ucyJdfQ.ldaFpCLZRjvQ02N2XiyVzpiiHUhsSLH8qq5Edyq-sts',
kittens: 'https://3diphonewallpaper.com/wp-content/uploads/2017/10/Cute-Two-Kittens-Wallpaper-iPhone.jpg'
}
var renderPage = (values) => {
var name = values.name || 'UNKNOWN';
var color = values.color || '#fff';
var background = backgrounds[
values.background || 'space'
]
frame.setAttribute(
'srcdoc',
/* html */`
<html>
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/darkly/bootstrap.min.css" />
<style>
body {
background-color: #000;
background-image: url("${background}");
color: ${color}
}
</style>
</head>
<body>
<h1>WELCOME, ${name}, WE HAVE BEEN WAITING AN ETERNITY FOR YOUR RETURN.</h1>
<p>NOW, LET US PARTAKE OF THE CAKE BEFORE WE RETURN THIS UNIVERSE TO THE VOID FROM WHICH WE SPAWNED IT.</p>
</body>
</html>
`
)
};
var handleSubmit = (event) => {
event.preventDefault();
var data = new FormData(event.target);
var value =...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.