だから私は、名前を生成し、それを変数として設定してオブジェクトを作成できるjavascript関数を作成したいと考えています。以下のコードでは、Javascript のみを表示していますが、フォームに入力する例を考えました。オブジェクト coffee を作成するために、ユーザーがデータを 1 回入力したとします。コメントを読む
function object(a,b){
this.validate = 1
this.one = a
this.two = b
if(z == "undefined"){
var z = 0;
}else{
z = z++;
gen(z);
}
}
/*
Need a function that is able to generate generate names and set them as a variable
This case for example the name of the object I'm trying to generate is coffee3
*/
function gen(x){
if(coffee.validate != "undefined"){
for(x, x < (x++), x++){
var y = x.toString();
y = "coffee" + y;
/*
Turning the string value stored in y currently, say coffee3 for example,
into a variable named coffee3 and gets new object("caramel", "milk")
Also a code to store an object inside the sessionStorage object.
if(typeof(Storage)!=="undefined")
to check storage first of course
*/
}
}else{
var coffee = new object("stuff", "input");
}
}
もちろん、この例を正確に使用しているわけではありません。わかりやすくするために使用しました。このような関数の実際の使用法は、クライアント側スクリプトを返し、カスタム S(CC)AI-S/API をロードするサーバー スクリプトに CAS をロードするための基本的なクライアント側ストレージ出力です。ブラウザ。