猿问

前端页面找不到className

问题描述
图片描述浏览器报错,(找不到className,是这个意思吗?),应该怎么解决呢。还有一个问题,传入的值为元素,元素是个什么定义呢?
相关代码
这是前端页面
特性分支
集成分支
历史版本
这是common.js
这是方法的调用:
functiononloadTable(){
varBranchTypeID=getCookie("BranchTypeID");
varfeatureLi=document.getElementById("featureLi");
varintegrationLi=document.getElementById("integrationLi");
varpublishedLi=document.getElementById("publishedLi");
varFeature=document.getElementById("Feature");
varIntegration=document.getElementById("Integration");
varPublished=document.getElementById("Published");
if(BranchTypeID==1){
//为这个类移除属性
addClass(featureLi,"active");
removeClass(integrationLi,"active");
removeClass(publishedLi,"active");
$("#featureA").attr("aria-expanded","true");
$("#integrationA").attr("aria-expanded","false");
$("#publishedA").attr("aria-expanded","false");
addClass(Feature,"active");
removeClass(Integration,"active");
removeClass(Published,"active");
}
if(BranchTypeID==2){
//为这个类移除属性
removeClass(featureLi,"active");
addClass(integrationLi,"active");
removeClass(publishedLi,"active");
removeClass(Feature,"active");
addClass(Integration,"active");
removeClass(Published,"active");
$("#featureA").attr("aria-expanded","false");
$("#integrationA").attr("aria-expanded","true");
$("#publishedA").attr("aria-expanded","false");
}
if(BranchTypeID==3){
//为这个类移除属性
removeClass(featureLi,"active");
removeClass(integrationLi,"active");
addClass(publishedLi,"active");
$("#featureA").attr("aria-expanded","false");
$("#integrationA").attr("aria-expanded","false");
$("#publishedA").attr("aria-expanded","true");
removeClass(Feature,"active");
removeClass(Integration,"active");
addClass(Published,"active");
}
setInterval("checkPipelineStatus()",10000);
}
哔哔one
浏览 260回答 2
2回答

呼如林

看了下代码,你传入addClass,removeClass,hasClass的第一个参数应该element的但是你传入的却是element的className也就是一个字符串

小唯快跑啊

varapplyMergeLi=document.write(document.getElementById('applyMergeLi').className);varapplyPublishLi=document.getElementById("applyPublishLi").className;varmergeReviewLogLi=document.getElementById("mergeReviewLogLi").className;varpublishReviewLogLi=document.getElementById("publishReviewLogLi").className;varApplyMerge=document.getElementById("ApplyMerge").className;varApplyPublish=document.getElementById("ApplyPublish").className;varMergeReviewLog=document.getElementById("MergeReviewLog").className;varPublishReviewLog=document.getElementById("PublishReviewLog").className;每行去掉.className第一个再去掉document.write
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答