Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


  <img src="" class="ski">
  <div class="text">
      <h2>Quick Purchase</h2><br>
      <h3>Buy your ticket now for</h3>
      <h3 id="cost"></h3>
    <button type="button" class="btn btn-primary btn-lg">Buy Now</button>
    <h2>Pre-Buy Lift Tickets Here</h2><br>
    <h3>What time will you be going?</h3>
  <form name="prebuy">
    <div id="times">
      <input type="radio" name="timerange" value="morning" checked="checked"> Morning
      <input type="radio" name="timerange" value="afternoon"> Afternoon
      <input type="radio" name="timerange" value="evening"> Evening
      <h3>Resident State:</h3>
      <select id="states">
      <button type="button" class="btn btn-info btn-lg" onclick="preBuy()">Pre-Buy Now</button>
    <h3 id="preBuyPrice"></h3>


                body {
  color: black;

.ski {
  position: fixed; 
  top: 0; 
  left: 0; 
  min-width: 100%;
  min-height: 100%;
  z-index: -1;
  opacity: 0.4;


                var now = new Date();
var hour = now.getHours();

var stateList = [
  "American Samoa",
  "District of Columbia",
  "Federated States of Micronesia",
  "Marshall Islands",
  "New Hampshire",
  "New Jersey",
  "New Mexico",
  "New York",
  "North Carolina",
  "North Dakota",
  "Northern Mariana Islands",
  "Puerto Rico",
  "Rhode Island",
  "South Carolina",
  "South Dakota",
  "Virgin Island",
  "West Virginia",

//This function will allow the customer to purchase a ticket NOW without filling out any information. I mean, why pre-buy when you can buy it now like all other first-world things!
(function cost() {
  if (hour <= 12) {
    var cost = 20.0 * 0.08 + 20.0;
  } else if (hour <= 18) {
    var cost = 25.0 * 0.08 + 25.0;
  } else {
    var cost = 15.0 * 0.08 + 15.0;
  document.getElementById("cost").innerHTML = "$" + cost.toFixed(2);

//for loop over an array to populate the resident state select list
var sel = document.getElementById("states");
for (var i = 0; i < stateList.length; i++) {
  var opt = document.createElement("option");
  opt.innerHTML = stateList[i];
  opt.value = stateList[i];

//form conditionals if/else for pricing
function preBuy() {
  //store the selected Time Range
  var t = document.getElementsByName("timerange");
  var selectedTime;
  for (var i = 0; i < t.length; i++) {
    if (t[i].checked) {
      selectedTime = t[i].value;
  //store the selected State
  var e = document.getElementById("states");
  var selectedState = e.options[e.selectedIndex].value;
  //store the tax amount
  if (selectedState == "California") {
    var taxAmount = 0.06;
  } else {
    var taxAmount = 0.08;
  //conditional for figuring out and displaying the price
  if (selectedTime == "morning") {
    var preCost = 20.0 * taxAmount + 20.0;
    document.getElementById("preBuyPrice").innerHTML = "$" + preCost.toFixed(2);
  } else if (selectedTime == "afternoon") {
    var preCost = 25.0 * taxAmount + 25.0;
    document.getElementById("preBuyPrice").innerHTML = "$" + preCost.toFixed(2);
  } else if (selectedTime == "evening") {
    var preCost = 15.0 * taxAmount + 15.0;
    document.getElementById("preBuyPrice").innerHTML = "$" + preCost.toFixed(2);