【ゲームキャラの名前】
■ このスレッドは過去ログ倉庫に格納されています
0057名前は開発中のものです。
02/06/02 21:43ID:???ほい
selected = 0;
charList = new Array();
for(var i = 0, j = "ァ".charCodeAt(0); j <= "ヴ".charCodeAt(0); i++, j++)
charList[i] = String.fromCharCode(j);
charList[charList.length] = "ー";
function getSingleRandName()
{
var str = "", max = !selected ? Math.floor(Math.random() * 10) + 1 : selected;
for(var i = 1; i <= max; i++)
str += charList[Math.floor(Math.random() * charList.length)];
return str;
}
<form>
音数
<select name="number" onChange="selected = this.selectedIndex;">
<option>ランダム<option>1音<option>2音<option>3音<option>4音
<option>5音<option>6音<option>7音<option>8音<option>9音<option>10音
</select>
<input type="text" name="output" value="" size="30">
<input type="button" value="Naming" onClick="output.value = getSingleRandName()"><br>
</form>
正規表現は実装が面倒なので無し
■ このスレッドは過去ログ倉庫に格納されています