首頁 >web前端 >js教程 >js中switch case循環實例程式碼_javascript技巧

js中switch case循環實例程式碼_javascript技巧

WBOY
WBOY原創
2016-05-16 17:06:091334瀏覽

複製代碼代碼如下:

switch (objNameType) {

案例「PD」:

:valueUD = obj.id;

id = objName;

var loadVUD = UserData.load(exam, id);

if (loadVUD == null || loadVUD == undefined || loadVUD == '') {

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

打破;

案例「DANX」:

:valueUD = obj.id;

var objName = obj.name;

var objNameTop = objName.substr(0,objName.indexOf('_'));

id = objName;

var loadVUD = UserData.load(exam, id);

if (loadVUD == null || loadVUD == undefined || loadVUD == '') {

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

打破;

案例「PP」:

:valueUD = obj.id;

var objName = obj.name;

var objNameTop = objName.substr(0,objName.indexOf('_'));

id = objName;

var loadVUD = UserData.load(exam, id);

if (loadVUD == null || loadVUD == undefined || loadVUD == '') {

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

打破;

案例「文本」:

:valueUD = obj.value;

id = "text_" obj.id;

var loadVUD = UserData.load(exam, id);

if (loadVUD == null) {

if (valueUD == null || valueUD == '') {

返回;

其他{

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

其他{

if (valueUD == null || valueUD == '') {

UserData.remove(exam, id);

examAnswerKeyStr = removeStrWithcomma(examAnswerKeyStr, id);

UserData.save(examinfo, "examAnswerKeyStr", examAnswerKeyStr, 1);

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]]--;

返回;

打破;

案例「複選框」:

id = "checkbox_" obj.id.substr(0, obj.id.lastIndexOf('_'));

var key = obj.id.substr(0, obj.id.lastIndexOf('_'));

key = "checkbox_" key;

值UD = UserData.load(exam, key);

var flag = obj.checked;

if (valueUD == null) {

如果(標誌){

id = 鍵;

:valueUD = obj.id;

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

其他{

如果(標誌){

if (valueUD.indexOf(obj.id) == -1) {

valueUD = "," obj.id

其他{

if (valueUD.indexOf(obj.id) != -1) {

if (valueUD.indexOf(',' obj.id) != -1) {

valueUD = valueUD.replace(',' obj.id, '');

其他

if (valueUD.indexOf(obj.id ',') != -1) {

:valueUD = valueUD.replace(obj.id ',', '');

其他{

UserData.remove(exam, key);

examAnswerKeyStr = removeStrWithcomma(examAnswerKeyStr, key);

UserData.save(examinfo, "examAnswerKeyStr", examAnswerKeyStr, 1);

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]]--;

返回;

打破;

案例'textarea':

:valueUD = obj.value;

id = "textarea_" obj.id;

var loadVUD = UserData.load(exam, id);

if (loadVUD == null) {

if (valueUD == null || valueUD == '') {

返回;

其他{

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]] ;

其他{

if (valueUD == null || valueUD == '') {

UserData.remove(exam, id);

examAnswerKeyStr = removeStrWithcomma(examAnswerKeyStr, id);

UserData.save(examinfo, "examAnswerKeyStr", examAnswerKeyStr, 1);

var tmpTGId = obj.id.substr(0, obj.id.indexOf('_'));

qNoTotalD[qIdNoStr[tmpTGId]]--;

返回;

打破;

預設值:

回傳; }

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn