。ランダムなクラスを格納するための変数を作成し、それらをquote要素に追加することができます。私はまた、あなたがフィドルhereを表示することができ、jsfiddleにフィドルを作成し、この使用して、次のコード
var my_res = _.sample([
'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et',
'Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab',
'Li Europan lingues es membres del sam familie. Lor separat existentie es un myth. Por scientie, musica, sport etc, litot',
'Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated',
'A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with',
'One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin.'
], 3);
var my_class = _.sample(['style_1','style_2','style_3','style_4','style_5','style_6'],3)
var arr_len = my_res.length;
var targ = document.getElementById('i_need_quotes_within_this');
for(i=0; i<arr_len; i++){
targ.innerHTML += "<q class="+my_class[i]+">"+my_res[i]+"</q><br/>"
}
を達成しました。
HERE you GO:あなたはEDIT
面倒な何かを見つける場合は私に知らせてください。悲しい私は最初に問題を理解しませんでした
なぜ条件を追加しないでください? 'if(returnNumber == 5)//このリストのスタイルを...にします。 –
正確にあなたが求めていることは明確ではありません。 '[{n:1、color: 'red'}]'のようなオブジェクトが欲しいですか? '[' 1']'のようなDOM要素が欲しいですか? –
数字は最終的に引用符で囲まれます。それはJFを助けますか? – AndrewLeonardi