Pen Settings

HTML

CSS

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

JavaScript

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

Behavior

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.

HTML

              
                <div id="wrapper">

	<h1>Suzhou numerals 蘇州碼子 / 花碼</h1>
	<h3>Suzhou numerals converter 轉換蘇州碼子 / 花碼</h3>
	<p>Enter number in textbox and click "&gt;" to convert.<br />輸入數字然後按"&gt;".</p>
	<form id="submitForm">
		<input type="text" id="source_code" placeholder="Numerals" value="64" />
		<input type="button" id="ston" value="<" style="display:none;" />
		<input type="submit" id="ntos" value="&gt;" />
	</form>
	<br />
	<div id="target_code">
		<div id="target_label">價錢</div>
		<div id="code_wrapper">
			<div id="code_number"></div>
			<div id="code_unit"></div>
		</div>
	</div>
	<h4 id="canvas_label">You can right-click and save as image file.<br />你可以按滑鼠右鍵然後儲存影像.</h4>
	<div id="target_canvas"></div>

	<h3>About Suzhou numerals 關於蘇州碼子 / 花碼</h3>
	<p class="blockquote" cite="https://en.wikipedia.org/wiki/Suzhou_numerals">The Suzhou numerals or huama is a numeral system used in China before the introduction of Arabic numerals... Suzhou numerals were once popular in Chinese marketplaces, such as those in Hong Kong along with local transportation before the 1990s, but they have gradually been supplanted by Arabic numerals.<br />蘇州碼子又稱花碼、草碼、菁仔碼、番仔碼,是一種傳統在中國民間流行的數字,產生於中國的蘇州,起源自算籌,因其書寫便捷,曾經廣泛使用於商業中,在賬簿和發票等均有使用。現在這種數字在中國大陸及台灣幾近絕跡,但在港澳地區的街市、舊式茶餐廳及中藥房偶而仍然可見。</p>

</div>
              
            
!

CSS

              
                html, body {
	font-family: 'Open Sans', sans-serif;
	background-color:#333;
	color: #fff;
	margin-bottom: 50px;
}
h2 {
	margin: 10px 0px 5px 0px;
	font-weight: 700;
	color: #fff;
}
h3 {
	margin: 40px 0px 10px 0px;
	font-weight: 700;
	color: #fff;
}
h3:first-of-type {
	margin: 20px 0px 10px 0px;
}
p {
	color: #ccc;
}
.blockquote {
	margin: 10px 0px 20px 0px;
	width: 700px;
	line-height: 1.3em;
}
.blockquote:after {
	content: " - Wikipedia";
	font-weight: 700;
}
#target_code {
	padding: 20px;
	margin: 20px 0px 40px 0px;
	display: none;
	font-size: 48px;
	background-color: #fff;
	font-family: 'cwTeXFangSong', serif;
	line-height: 1.2em;
}
#target_label {
	margin-bottom: 20px;
	padding-bottom: 5px;
	position: relative;
	border-bottom: 3px solid #006;
	font-size: 36px;
	font-weight: 700;
	line-height: 1.2em;
	color: #006;
	text-align: center;
}
#code_wrapper {
	margin: 0px auto;
	position: relative;
	font-weight: 700;
	color: #900;
	font-size: 48px;
}
#code_number,
#code_unit{
	position: relative;
}
#code_number {
	display: inline;
}
#code_unit {
	display: block;
}
#canvas_label {
	display:none;
}
              
            
!

JS

              
                var scode_array = [["〇","〡","〢","〣","〤","〥","〦","〧","〨","〩"], ["〇","一","二","三","〤","〥","〦","〧","〨","〩"]];
var scode_unit_array = ["","","拾","佰","仟","萬","十萬","佰萬","仟萬","億","十億","佰億","仟億","萬億","兆","十兆","百兆","千兆","京","十京","百京","千京"];

$("#ntos").click(function() {
	generateCode($("#source_code").val());
});

$("#submitForm").submit(function(e){
    return false;
});

function generateCode(num) {
	$("#target_code").hide().width("auto");
	if(!isNaN(Number(num))) {
		var output = [], sNumber = num.toString(), currentSet = 0, decimal_count = scode_unit_array[sNumber.split(".")[0].length], isDecimal = sNumber.indexOf(".");

		for (var i = 0, len = sNumber.length; i < len; i++) {
				if (parseInt(sNumber.charAt(i-1)) >= 1 && parseInt(sNumber.charAt(i-1)) <=3) {
					if (parseInt(sNumber.charAt(i)) >= 1 && parseInt(sNumber.charAt(i)) <=3) {
						currentSet++;
						if (currentSet > 1) {
							currentSet = 0;
						}
					}
				}
				output.push(scode_array[currentSet][parseInt(sNumber.charAt(i))]);
		}
		$("#code_number").html(output.join(""));
		$("#code_unit").html(decimal_count+"元");
		$("#target_code").show();
		$("#target_code").width($("#code_number").outerWidth()+10);
		html2canvas($("#target_code")).then(function(canvas) {
			$("#target_canvas").html(canvas);
			$("#canvas_label").show();
		});
		
	} else {
		alert("Please enter valid number.");
	}
}

generateCode(64);
              
            
!
999px

Console