cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

Code Indentation


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.

<html lang="en">
<meta charset="UTF-8">
<script type="text/javascript" src="Cities.js">

<select id="Countries" name="countries" onchange="populate('Countries','Cities')">
    <option value="">Country</option>
    <option value="Ireland">Ireland</option>
    <option value="Romania">Romania</option>
    <option value="England">England</option>
    <option value="Spain">Spain</option>
    <option value="Germany">Germany</option>

<select id="Cities" name="cities">
    <option value="">Cities</option>


              //Populates Countries and Cities select form elements

function populate(s1,s2)


var s1 = document.getElementById(s1);//s1==Countries

var s2 = document.getElementById(s2);//s2==Cities


 * if s1==Ireland print Dublin
    var optionArray = ["|", "dublin|Dublin"];
 * If s1==Romania print Bucharest
else if (s1.value=="Romania"){
        var optionArray=["|", "bucharest|Bucharest"];

 * if s1==England print Liverpool
else if (s1.value=="England"){
        var optionArray=["|", "liverpool|Liverpool"];

 * if s1==Spain print Madrid
else if (s1.value=="Spain") {
        var optionArray=["|", "madrid|Madrid"];

 * if s1==Germany print Munich
else if (s1.value=="Germany"){
    var optionArray=["|","munich|Munich"];

for(var option in optionArray){
    var pair = optionArray[option].split("|");
    var newOption = document.createElement("option");
    newOption.value = pair[0];

Loading ..................