cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <div style="width:900px; text-align:left; margin: 0px auto 0px auto; padding:20px;">

<span class="navpart">Java Script 1</span>

<br />

<div class="left">

<script>

var plusvar = 0; function numplus() { plusvar++; document.getElementById("plus").value=plusvar; }

var minusvar = 5; function numminus() { minusvar--; document.getElementById("minus").value=minusvar; }

</script>

<div class="showbor" style="float:right; margin:0px 0px 10px 20px; display:inline-block; padding:7px;">
<table><tr>

<td style="text-align:left;" colspan="3">
Declare variable: &nbsp; var variablename;
<br />
Increase variable: &nbsp; variable++
<br />
Decrease variable: &nbsp; variable--
<br /><br />
</td>

</tr><tr>

<td> <form action="#">
<input type="text" id="plus" class="showbor" style="width:30px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="0" readonly="readonly" />
&nbsp; <span class="textlink" style="font-size:18px;" onclick="numplus();">+</span> </form> </td>

<td style="width:50px;"></td>

<td> <form action="#">
<input type="text" id="minus" class="showbor" style="width:30px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="5" readonly="readonly" />
&nbsp; <span class="textlink" style="font-size:20px;" onclick="numminus();">-</span> </form> </td>

</tr></table> </div>

/* This is a comment among JS. */

<br /><br />

<span class="bolet">Java Script CSS:</span>

&nbsp;

background-color is backgroundColor and so on

<br /> 

Delete the - and add capitals to the second word to change CSS to JS. 

<br /> 

document.getElementById("cssjs02").style.backgroundImage ="url('back.png')"; 

<br /><br />

<span class="bolet">Functions:</span>

&nbsp;

function fuctname() { actions... }

<br />

function fuctname() { if (condition) { action } if (condition) { action } else { action } }

<br /><br />

<span class="itlet">

var plusvar = 0; function numplus() { plusvar++; document.getElementById("plus").value=plusvar; }

<br />

var minusvar = 5; function numminus() { minusvar--; document.getElementById("minus").value=minusvar; }

</span>

<br /><br />

<script>

function change4() { document.getElementById("mouse4").src="design/pixel/Parfait_Oreo.gif"; }

function change5() { document.getElementById("mouse4").src="design/pixel/Parfait_Choco_Chip.gif"; }

var clickit="candy"; function change7() { switch (clickit) { 

case "candy": document.getElementById("mouse5").src="design/pixel/Parfait_Red_Velvet.gif"; clickit="sweet"; break; 

case "sweet": document.getElementById("mouse5").src="design/pixel/Parfait_Chocolate_2.gif"; clickit="candy"; break;

default: document.getElementById("mouse5").src="design/pixel/Parfait_Chocolate_2.gif"; clickit="candy"; break; } }

</script>


<span class="bolet">Mouse events:</span>
&nbsp;
onmouseover="function();"
&nbsp;
onmouseout="function();"
&nbsp;
onclick="function();"

<br /><br />

<span class="itlet">

function change4() { document.getElementById("mouse4").src="design/Parfait_Oreo.gif"; }
<br />
function change5() { document.getElementById("mouse4").src="design/Parfait_Choco_Chip.gif"; }
<br /><br />
var clickit="candy"; function change7() { switch (clickit) { 
<br />
case "candy": document.getElementById("mouse5").src="design/Parfait_Red_Velvet.gif"; clickit="sweet"; break; 
<br />
case "sweet": document.getElementById("mouse5").src="design/Parfait_Chocolate_2.gif"; clickit="candy"; break;
<br />
default: document.getElementById("mouse5").src="design/Parfait_Chocolate_2.gif"; clickit="candy"; break; } }

</span>

<br /><br />

<script>

function change8a() { document.getElementById("cha1").style.backgroundColor = "#0047ab"; 
document.getElementById("cha1").style.color = "#87cefa"; }

function change9() { document.getElementById("cha1").style.backgroundColor = "#87cefa"; 
document.getElementById("cha1").style.color = "#0047ab"; }

</script>

<div class="showbor" style="float:right; margin:0px 0px 10px 20px; display:inline-block;">
<table><tr>
<td><input type="text" class="focu" value="" id="cha1" onchange="change8a();" style="background-image:none;" /></td>
<td><span class="textlink" onclick="change9();" id="chare">Reset</span></td>
</tr></table> </div>

onchange="function();" 

<br />
<span class="itlet"> 
function change8a() { document.getElementById("cha1").style.backgroundColor = "#0047ab"; 
document.getElementById("cha1").style.color = "#87cefa"; } 
</span>

<br /><br />

<script>

function popup() { window.open('https://codepen.io/Mikari/', '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=200, height=150'); }

</script>

<span class="bolet">Pop-up window:</span> &nbsp;
<span class="textlink" onclick="popup();">Pop-Up</span>
<br />

<span class="itlet"> 
function popup() { window.open('page.html', '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, width=200, height=150'); }
</span>

<br /><br />

<script>
function trackmouse(event) { event.clientX; event.clientY;
document.getElementById("posy").innerHTML = event.clientY; 
document.getElementById("posx").innerHTML = event.clientX; }
</script>

<div class="showbor" style="width:300px; padding:10px; margin:0px 20px 10px 0px; text-align:center; float:left;" onclick="trackmouse(event);">
Click this div to see the mouse position.
<br />
Mouse position Y: <span id="posy"></span>
<br />
Mouse position X: <span id="posx"></span>
</div>

<span class="bolet">Mouse Position:</span> &nbsp;

<span class="itlet">
function trackmouse(event) { event.clientX; event.clientY;
document.getElementById("posy").innerHTML = event.clientY; 
document.getElementById("posx").innerHTML = event.clientX; }
</span>

<br /><br />

<span class="bolet">Mouse Sparkles:</span> Disable loops on the gif so it plays once. Replace it and put it back to reset it.

<br />

&lt;body onclick="sparkling();"&gt;

&lt;img src="design/sparkles3.gif" alt="" id="spark3" style="position:fixed; top:-30px; left:-30px;" /&gt;

<br /><br />

<span class="itlet">
function sparkling() {
document.getElementById("spark3").src = "design/syrupshock.gif";
document.getElementById("spark3").src = "design/sparkles3.gif";
var sparktop = event.clientY - 15;
var sparkleft = event.clientX - 15;
document.getElementById("spark3").style.top = sparktop + "px"; 
document.getElementById("spark3").style.left = sparkleft + "px"; }
</span>

<br /><br />

<span class="bolet">Alerts:</span>
&nbsp;
alert("text here " + variable + "more text..." + "\n");
&nbsp;
\n (new line)

<br />

<script>

var listen = "Listen!"; function heylisten() { alert( "Hey! \n" + listen ); } 

</script>

<span class="textlink" onclick="heylisten();">JS Alert Popup</span> &nbsp;

var listen = "Listen!"; function heylisten() { alert( "Hey! \n" + listen ); }

</div> <br />

<table style="display:inline-block; vertical-align:top; margin:0px 10px 20px 20px;"><tr> 

<td class="showbor" colspan="3" style="padding:5px 0px 5px 0px;"> 
<span class="bolet">Operation Symbols</span> </td> </tr>

<tr> <td class="showbor" style="padding:5px 15px 5px 15px;"> = <br /> assign value </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> &amp;&amp; <br /> and </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> || <br /> or </td>

</tr></table>

<table style="display:inline-block; vertical-align:top; margin:0px 10px 20px 20px;"><tr> 

<td class="showbor" colspan="3" style="padding:5px 0px 5px 0px;"> 
<span class="bolet">Comparison Symbols</span> </td> </tr> <tr>

<td class="showbor" style="padding:5px 15px 5px 15px;"> &lt; <br /> less </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> &gt; <br /> greater </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> == <br /> equal </td>

</tr><tr>

<td class="showbor" style="padding:5px 15px 5px 15px;"> &lt;= <br /> less/equal </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> &gt;= <br /> greater/equal </td>

<td class="showbor" style="padding:5px 15px 5px 15px;"> != <br /> not equal </td>

</tr></table>

<script>

function compare() { 

if (document.getElementById("leftnum").value == document.getElementById("rightnum").value) { document.getElementById("thenums").value="=="; }

if (document.getElementById("leftnum").value < document.getElementById("rightnum").value) { document.getElementById("thenums").value="<"; }

if (document.getElementById("leftnum").value > document.getElementById("rightnum").value) { document.getElementById("thenums").value=">"; } }

function compare2() { 

if (document.getElementById("leftnum2").value <= document.getElementById("rightnum2").value) { document.getElementById("thenums2").value="<="; }

if (document.getElementById("leftnum2").value >= document.getElementById("rightnum2").value) { document.getElementById("thenums2").value=">="; } }

function compare3() { 

if (document.getElementById("leftnum3").value == document.getElementById("rightnum3").value) { document.getElementById("thenums3").value="=="; }

if (document.getElementById("leftnum3").value != document.getElementById("rightnum3").value) { document.getElementById("thenums3").value="!="; } }

</script>

<div class="showbor" style="display:inline-block; vertical-align:top; margin:0px 10px 20px 20px; padding:10px;">
<form action="#">

<table><tr> 

<td> <input type="text" id="leftnum" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="1" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="thenums" class="showbor" style="width:30px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="?" readonly="readonly" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="rightnum" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="-2" /> </td>

</tr><tr> <td colspan="5"><span class="textlink" onclick="compare();">Compare</span></td>

</tr><tr> <td colspan="5"> == &nbsp; &lt; &nbsp; &gt; </td>

</tr></table>

</form> </div>

<div class="showbor" style="display:inline-block; vertical-align:top; margin:0px 10px 20px 20px; padding:10px;">
<form action="#">

<table><tr> 

<td> <input type="text" id="leftnum2" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="1" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="thenums2" class="showbor" style="width:30px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="?" readonly="readonly" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="rightnum2" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="2" /> </td>

</tr><tr> <td colspan="5"><span class="textlink" onclick="compare2();">Compare</span></td>

</tr><tr> <td colspan="5"> &lt;= &nbsp; &gt;= </td>

</tr></table>

</form> </div>

<div class="showbor" style="display:inline-block; vertical-align:top; margin:0px 10px 20px 20px; padding:10px;">
<form action="#">

<table><tr> 

<td> <input type="text" id="leftnum3" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="M" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="thenums3" class="showbor" style="width:30px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="?" readonly="readonly" /> </td>

<td style="width:5px;">&nbsp;</td>

<td> <input type="text" id="rightnum3" class="showbor" style="width:50px; height:30px; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; -moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; text-align:center;" value="M" /> </td>

</tr><tr> <td colspan="5"><span class="textlink" onclick="compare3();">Compare</span></td>

</tr><tr> <td colspan="5"> == &nbsp; != </td>

</tr></table>

</form> </div>
<br />
<a href="http://azurelight.net">AzureLight.net</a> | 
<a href="http://mikaristar.deviantart.com">MikariStar.DeviantArt.com</a> | 
<a href="http://artrift.com/Mikari/">ArtRift.com/Mikari/</a> | 
<a href="http://miliazure.wordpress.com">MiliAzure.WordPress.com</a>
</div>
            
          
!
            
              input.focu { text-align:center; border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; 
-moz-border-radius: 20px 20px 20px 20px / 20px 20px 20px 20px; border:0px none; 
background-color:#87cefa; color:#0047ab; width:80px; padding:5px; margin:10px; }

span#chare { display:block; width:50px; margin:0px 10px 0px 0px; }

body { padding:0px; margin:0px; font-family:Arial; font-size:14px; line-height:20px; 
color:#393939; background-color:#c2f0ff; text-align:center; }

::-webkit-scrollbar { width: 10px; height:10px; }
::-webkit-scrollbar-track { background-color:#c2f0ff; }
::-webkit-scrollbar-thumb { border-radius: 20px; background-color:#ff9adc; border: 0px none; }

.showbor { border:0px none; border:3px dotted #ff9adc; padding:0px; } 

a, span.textlink { color:#ff71ce; text-decoration:none; }

input, textarea, select, option, button { color:#393939;
font-family:Arial; font-size:14px; line-height:17px;
overflow:hidden; background-color: #fff8bb;  
border-radius: 30px 30px 30px 30px / 30px 30px 30px 30px; } 

*:focus { outline:none; }
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

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

Console