\x0d\x0a\x0d\x0a\x0d\x0afunctioninstTR(){\x0d\x0avartab=document.getElementById('tab')\x0d\x0avarn=document.getElementById('x').rowIndex+1\x0d\x0avartr=tab.insertRow(n)\x0d\x0avartd=tr.insertCell(0)\x0d\x0atd.innerHTML='new'+Math.random()\x0d\x0a}\x0d\x0a\x0d\x0a 回答于 2022-12-14 抢首赞 已踩 0 查看全部1个回答 — 为你推荐更多精彩内容 — 正在加载 加载失败 点击重新加载
微信
微博
QQ空间
答案纠错
举报
取消 赞赏答主 5 10 50 100 200已赞赏0财富值
合计:0 财富值
登录后赞赏 选择举报类型 侵犯版权 色情低俗 涉嫌违法犯罪 时政信息不实 垃圾广告 低质灌水 工作人员会在48小时内处理,处理结果请关注系统通知,感谢您对百度知道的支持。 确定 void function(a,b,c,d,e,f){function g(b){a.attachEvent?a.attachEvent("onload",b,!1):a.addEventListener&&a.addEventListener("load",b)}function h(a,c,d){d=d||15var e=new Datee.setTime((new Date).getTime()+1e3*d),b.cookie=a+"="+escape(c)+"path=/expires="+e.toGMTString()}function i(a){var c=b.cookie.match(new RegExp("(^| )"+a+"=([^]*)(|$)"))return null!=c?unescape(c[2]):null}function j(){var a=i("PMS_JT")if(a){h("PMS_JT","",-1)try{a=a.match(/{["']s["']:(\d+),["']r["']:["']([\s\S]+)["']}/),a=a&&a[1]&&a[2]?{s:parseInt(a[1]),r:a[2]}:{}}catch(c){a={}}a.r&&b.referrer.replace(/#.*/,"")!=a.r||alog("speed.set","wt",a.s)}}if(a.alogObjectConfig){var k=a.alogObjectConfig.sample,l=a.alogObjectConfig.randd="https:"===a.location.protocol?"https://fex.bdstatic.com"+d:"http://fex.bdstatic.com"+d,k&&l&&l>k||(g(function(){alog("speed.set","lt",+new Date),e=b.createElement(c),e.async=!0,e.src=d+"?v="+~(new Date/864e5)+~(new Date/864e5),f=b.getElementsByTagName(c)[0],f.parentNode.insertBefore(e,f)}),j())}}(window,document,"script","/hunter/alog/dp.mobile.min.js") window.tt = 1681103758 (window.__IKNOW_GLOBAL__ || window).require.resourceMap({"res":{"m-common:widget\/lib\/gmu\/zepto\/zepto.origin.js":{"pkg":"m-common:p1"},"m-common:widget\/js\/util\/hunter\/hunter.js":{"pkg":"m-common:p2"},"m-question-new:node_modules\/js-base64\/base64.js":{"pkg":"m-question-new:p25"},"m-question-new:node_modules\/vue\/dist\/vue.common.prod.js":{"pkg":"m-question-new:p24"},"m-question-new:widget\/js\/gettext\/gettext.es.js":{"pkg":"m-question-new:p27","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js"]},"m-common:widget\/js\/logic\/share\/tools\/utils.js":{"pkg":"m-common:p3"},"m-question-new:widget\/question-author\/question-author-async.js":{"pkg":"m-question-new:p15","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-common:widget\/js\/ui\/v-flash\/js\/flash.es.js","m-common:widget\/js\/logic\/login\/login.js","m-question-new:widget\/js\/gradeRankDialog\/gradeRankDialog.js","m-question-new:widget\/recommend-follow\/recommend-follow.es.js","m-common:widget\/js\/util\/event\/event.js","m-common:widget\/js\/logic\/ban-dialog\/index.js"]},"m-question-new:widget\/video-entry\/common\/js\/until\/until.es.js":{"pkg":"m-question-new:p18","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/ui\/poptip\/poptip.js"]},"m-question-new:widget\/top-tip\/top-tip.es.js":{"pkg":"m-question-new:p14","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/storage\/storage.js","m-common:widget\/js\/util\/https\/https.js"]},"m-question-new:widget\/feed-recommend\/feed-recommend-async.es.js":{"pkg":"m-question-new:p19","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/template\/template.js","m-common:widget\/js\/logic\/login\/login.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-common:widget\/js\/util\/cookie\/cookie.js","m-question-new:node_modules\/@baidu\/ubc-report-sdk\/dist\/ubc-web-sdk.esm.js","m-common:widget\/js\/util\/observer\/intersection-observer.js","m-common:widget\/js\/util\/patch\/patch.js","m-question-new:widget\/js\/qbthumb\/qbthumbFeed.es.js","m-common:widget\/js\/util\/event\/event.js"]},"m-question-new:widget\/law-struct\/law-struct-relative-case\/law-struct-relative-case.es.js":{"pkg":"m-question-new:p28","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/template\/template.js","m-question-new:widget\/law\/util\/url.es.js","m-common:widget\/js\/util\/observer\/intersection-observer.js"]},"m-question-new:widget\/js\/similarAskDialog\/index.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-question-new\/widget\/js\/similarAskDialog\/index.7445542.js","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/ui\/dialog\/dialog.js","m-common:widget\/js\/util\/storage\/storage.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-common:widget\/js\/logic\/login\/login.js","m-common:widget\/js\/logic\/submit\/submit.js","m-common:widget\/js\/logic\/squarevcode\/squarevcode.js","m-common:widget\/js\/util\/event\/event.js"]},"m-common:widget\/js\/util\/observer\/observer.es.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-common\/widget\/js\/util\/observer\/observer.es.4fde5b9.js","deps":["m-common:widget\/js\/util\/observer\/intersection-observer.js","m-common:widget\/js\/util\/log\/log.js"]},"m-question-new:widget\/js\/PhotoSwipe\/photoswipe.min.js":{"pkg":"m-question-new:p13"},"m-question-new:widget\/ad-ecom-inchain\/ad-ecom-inchain.js":{"pkg":"m-question-new:p16","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js"]},"m-question-new:widget\/js\/trans-knowledge-custom-card\/trans-knowledge-custom-card.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-question-new\/widget\/js\/trans-knowledge-custom-card\/trans-knowledge-custom-card.03b0ed7.js","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/template\/template.js"]},"m-question-new:widget\/js\/page\/single.es.js":{"pkg":"m-question-new:p20","deps":["m-common:widget\/js\/util\/event\/event.js","m-common:widget\/js\/util\/log\/log.js","m-question-new:widget\/js\/trans-knowledge-custom-card\/trans-knowledge-custom-card.js"]},"m-question-new:widget\/single-meta\/single-meta.js":{"pkg":"m-question-new:p20","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/event\/event.js","m-question-new:widget\/question-meta\/support\/support.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-question-new:widget\/js\/throttle\/throttle.js"]},"m-question-new:widget\/single-meta-exp\/support\/support.es.js":{"pkg":"m-question-new:p20","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/logic\/submit\/submit.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/logic\/login\/login.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-common:widget\/js\/util\/storage\/storage.js"]},"m-question-new:widget\/single-meta-exp\/single-meta-exp.es.js":{"pkg":"m-question-new:p20","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/event\/event.js","m-question-new:widget\/single-meta-exp\/support\/support.es.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-common:widget\/js\/util\/observer\/intersection-observer.js"]},"m-question-new:widget\/rfq-card\/rfq-card.es.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-question-new\/widget\/rfq-card\/rfq-card.es.8d400e0.js","deps":["m-common:widget\/lib\/gmu\/zepto\/zepto.js","m-common:widget\/js\/ui\/poptip\/poptip.js","m-question-new:node_modules\/jsencrypt\/bin\/jsencrypt.js","m-common:widget\/js\/util\/log\/log.js","m-common:widget\/js\/util\/observer\/intersection-observer.js","m-common:widget\/js\/util\/template\/template.js"]},"m-question-new:widget\/contextual-earches\/contextual-earches-async.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-question-new\/widget\/contextual-earches\/contextual-earches-async.3afefef.js","deps":["m-common:widget\/js\/util\/template\/template.js","m-common:widget\/js\/util\/event\/event.js","m-common:widget\/js\/util\/log\/log.js"]},"m-common:widget\/js\/util\/monitor\/monitor.es.js":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-common\/widget\/js\/util\/monitor\/monitor.es.b379cd4.js","deps":["m-common:widget\/js\/util\/log\/log.js"]}},"pkg":{"m-question-new:p20":{"url":"https:\/\/iknowwap.bdimg.com\/static\/m-question-new\/pkg\/qb-single.ff2d67e.js","has":["m-question-new:widget\/js\/page\/single.es.js","m-question-new:widget\/single-meta\/single-meta.js","m-question-new:widget\/single-meta-exp\/support\/support.es.js","m-question-new:widget\/single-meta-exp\/single-meta-exp.es.js"]}}}) !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context({ question:{ qid:'186095536447719324', cid:'', quid: '300751074', score:'0', import_id:'1580', title:'想在一个表格里面特定的tr后面增加一行,用javascript应该如何做?', replyNum:"1" , createTime: '1671007483', replyCount: '1', content: '', update_time: '0', singleRid: '4208695586', ext_word: '', hostedContentFrom: 'lvlin', status: '0', is_appeal: 0, deleted: 0 ,tags: [{"tagname":"Javascript"},{"tagname":"\u7f16\u7a0b\u8bed\u8a00"},{"tagname":"\u7f16\u7a0b"},{"tagname":"JavaScript"},{"tagname":"\u524d\u7aef\u5f00\u53d1"},{"tagname":"\u4fe1\u606f\u6280\u672f"}] ,content_cid: ["110","110106"] ,newTags: "JavaScript_\u524d\u7aef\u5f00\u53d1" ,category_v1: '信息技术' }, bestAnswerCount: '0', isMyQuestion: 0, answerKey: 0, adsAll:{ youx:'', adsEids: null }, adsEids: { asp: [289,11102] }, eid: Number(289), isWyw: Boolean(), nettype:'0', word: '' || '', evaSampling_lowVal: '458', pageType: 'single', sourceIsOut: 0, argueNum: 0 }) F.context('user')['isRealName'] = '' F.context('user')['role'] = 'browser' F.context('feedbackInfo', { feedback: '0', feedback_rid: 0 }) F.context('newbest', 'null') F.context('replies', '[]') // 是否有料qb页 F.context('discussion', 0) // 二跳缓存配置 F.context('asyncCachePercent', 1000) // 用户是否手动关闭过关注推荐d窗 F.context('isCloseFollow', 0) // 推荐中台实验类型 F.context('feedExpName', 'wap_qb_feed_gr') // 封禁信息:isFilter-是否封禁用户 F.context('banInfo', null) // 是否是律临法律qb页 F.context('is_law', 0) F.context('is_law_video', ) F.context('is_from_law_migration', 0) F.context('isRiskView', '0') F.context('riskViewIp', '') F.context('riskViewVid', '') // 是否是法律临结构页 F.context('is_law_struct', 0) // nonce F.context('nonceStr', 'RAR1851ZS25YbSvuNmhCENgZZ') }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require var headerContainer = '#iknow-common-header' var searchContainer = '#search-box' require.async(['m-common:widget/iknow-header/iknow-header-async'], function(header){ header.init(headerContainer,{ nettype: '0', frameQids: [], isLogin: 0, searchWord: "", anonymousAsk: 0, isLightStyle: 1,adsEid:'289'}) }) require.async(['m-common:widget/iknow-header/search'],function(search){ var offsetX = -51 var offsetY = 38 search.init(headerContainer, searchContainer, { x: offsetX, y: offsetY }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context('cmsKey', 'top:defs|mid:defs|fb:') }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/lib/gmu/zepto/zepto','m-question-new:widget/question-answer/question-answer'],function($, answer){ answer.init($('#w-1')) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/question-title-operation/question-title-operation.es'], function(operation) { operation.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/question-title/question-title.es'], function(title) { title.init({ qid:'186095536447719324', title:'想在一个表格里面特定的tr后面增加一行,用javascript应该如何做?', descContent:'', descSupply: '', imgUrl:'[]', supImgUrl:'[]', videoInfo: null, }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/ad-top-answer/ad-top-answer.es'], function (mod) { mod.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/lib/gmu/zepto/zepto','m-question-new:widget/detail-full/detail-async'],function($, detail){ //这部分内容会被加载更多问题功能引用,整个html被写入,不加timeout会导致js执行的时候dom尚未渲染完毕 setTimeout(function(){ detail.init({ container: $("#w-2"), foldHeight: '778', longFoldFlag: +'', isFoldAnswer: '1', evaluatedType: '0', uid: '7d074069236f25705e795ccc', answerFolderAdv: {"wapSingleAnswer":{"switch":"0","height":"900","eid1":"123456","eid1Height":"1800","eid2":"123457","eid2Height":"1800"},"wapMultiAnswer":{"switch":"0","num":"2","eid":{"123456":"2","123457":"3"}}}, reply: new Object({"rid":"4208695586","content":false,"contentRich":false,"contentText":false,"publishTime":"2022-12-14","c_timestamp":"1671007483","isAdopt":"0","user":{"uid":"3428583293","name":"\u93af\u72b1\u7d12\u7f03\u6220\u7cb6","imId":"public.1.23aac9b9.adJrRYnFjoCcW9iEu6AEuQ","isAnonymous":"0","isUnLogin":"0","isCurrentUser":"0","isNoUserName":"0","iconType":"6","sex":"1","isAuth":"0","isExpert":"0","isExpertImport":"0","isUserAdmin":"0","isFamous":"0","isMaster":"0","isFromTorch":"0","isFilter":"0","shoubaiUser":{"avatar":"https:\/\/gips0.baidu.com\/it\/u=1011588934,2527752559&fm=3012&app=3012&autime=1678121803&size=b200,200","displayname":false,"sign":false,"third_id":"1586462008336116","type":"media","vip":"10","vtype":"0"},"chatUserInfo":[],"isOpenApp":"0","encodeUid":"7d074069236f25705e795ccc","gradeIndex":"20","grAnswerNum":"120195","praiseNum":"30092","goodRate":"99.107827535312","adoptRate":"98","carefield":[{"cid":"175","cname":false}],"selfDefinedPhoto":"0","isAppAuth":"0","BC":"30092","JQ":{"followMe":"37"},"DC":"120195","answerNum":false,"AX":"685793","helpNum":false,"wywInfo":{"auth":"0","tag":"1180"},"business":{"businessId":"96182","companyName":false,"bjhUpgradeStatus":"1","bjhAuditStatus":"1","cAppId":"1586462008336116","cid":"0","name":false,"uid":"3428583293","uname":"\u93af\u72b1\u7d12\u7f03\u6220\u7cb6","siteUrl":"http:\/\/www.huiqi.org","slogan":false,"main":false,"imgUrl":"https:\/\/pic.rmb.bdstatic.com\/bjh\/user\/343825d09bee196abf9cec8955c23e80.jpeg","intro":false,"type":"0","insType":"1","servicePhone":"","replyNum":"956755","thumbNum":"29429","v_type":"1","vipLevel":"0","vipRights":"1,2,3","tagType":"0","pluginInfo":{"officialPhone":"","siteUrl":"http:\/\/www.huiqi.org"},"isBrandBusiness":"","encodeUid":"7d074069236f25705e795ccc"},"iconChange":"1","showInfo":{"type":"2","partnerId":"96182","companyName":false,"bjhUpgradeStatus":"1","bjhAuditStatus":"1","cAppId":"1586462008336116","name":false,"imgUrl":"https:\/\/pic.rmb.bdstatic.com\/bjh\/user\/343825d09bee196abf9cec8955c23e80.jpeg","slogan":false,"siteUrl":"https:\/\/zhidao.baidu.com\/business\/profile?id=96182&role=business","siteUrlArr":[],"v_type":"1","intro":false,"businessId":"96182","encodeUid":"7d074069236f25705e795ccc","thumbNum":"29429"},"isFromBusiness":"96182"},"goodValueNum":"0","badValueNum":"0","collectNum":"0","refContent":"","bit_pack":{"is_recommend":"0","wap_flag":"0","is_pic_contained":"0","media_flag":"0","help_flag":"0","anonymous":"0","is_really_anonymous":"0","level_new":"1","comment_flag":"0","in_mis":"0","auto_recommend":"0","content_rich_flag":"1","prior_flag":"0","hidden_flag":"0","rec_canceled_flag":"0","mis_flag":"0","file_flag":"0","read_flag":"0","is_challenge":"0","ikaudio_flag":"0","mavin_flag":"0","is_delete_lock":"0","authentic_state":"0","is_compulsory_best":"0","dynamic_stick_flag":"0","video_flag":"0","vote_affirmative":"0","vote_negative":"0","is_video":"0","is_baiduyun":"0","is_yike_card":"0","is_baidumap":"0"},"ext_pack":{"business":{"businessId":"96182"},"display_best_for_se":"1","display_best_for_se_time":"1671333444","dynamic_optime":"1671332030","dynamic_score_detail":"{\"qua_score\":1942,\"time_score\":null,\"ide_score\":null,\"pre_score\":0}","ignore_spam":"15","mode_begintime":"0","mode_qtype":"0","op_uid":"0","partner":[]},"isSupport":"0","evaluatedType":"0","deleted":"0","value_rank":"1001942","type":"normal","threadId":"16834782345","next_rid":"0","pre_rid":"0","team_id":"0","import_id":"1580","userRewardWealth":"","uafrom":"","replyAsk":"","is_appeal":"0","musicInfo":[],"tiebaInfo":[]}), isPartnerHosting: 0, baidumapContainerId: 'baidumap-card', baidumapInfo: new Object(null), }) },0) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/single-meta-exp/single-meta-exp.es'], function (A) { A.init({ rid: 4208695586, encodeUid: '7d074069236f25705e795ccc', threadId: 16834782345 }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/ad-asp-ads/ad-asp-ads-async'], function (rec) { rec.init({ container: $('#wgt-hnwyt64339b-asp'), adPlaceholder: $('#ad-PLACEHODER-id') }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/rfq-card/rfq-card.es'], function (rfq) { rfq.init({"index":"","encode_qid":"186095536447719324"}) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/contextual-earches/contextual-earches-async'], function (rec) { rec.init({ container: $('#contextual-wmrvg64339b-earches') }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context('now', 1681103758) require.async(['m-question-new:widget/ad-union-new/ad-union-new-async'], function (rec) { rec.init($('#wgt-lscwn64339b-youx')) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context('relatedName', 'xpjcd64339b') require.async(["m-question-new:widget/related-question-new/related-question-new-async.es"], function (relateQuestion) { relateQuestion.init({ container: '#related-list-target', mixClass: '#xpjcd64339b', word: '' || '', title: '想在一个表格里面特定的tr后面增加一行,用javascript应该如何做?', toNaSample: 0, isLightStyle: 1 }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context({ feedOpt:{ tag:'Javascript', word: '' || '', adapt: {"_lbs_loc":{"rgc_flag":"5"},"_adapt_result":{"bd_page_type":"1","is_wifi":"0","tn":"middle"},"browser":"chrome","ecom_mobile_browser_id":"3","js":"0","mobile_browser":"chrome","mobile_browser_id":"24","mobile_browser_version":"58.0","resolution_height":"220","resolution_width":"1501","utn":"0"}, naAdObj: {"name":"3656\u4eba\u6b63\u5728\u70ed\u8bae","btn":"\u53c2\u4e0e\u8ba8\u8bba","banner":"https:\/\/iknow-base.bj.bcebos.com\/wulin\/feed_6_qian_1114.jpg","android":"https:\/\/downpack.baidu.com\/baiduzhidao_AndroidPhone_qbashezuo.apk","ios":"https:\/\/itunes.apple.com\/cn\/app\/bai-du-zhi-dao\/id465885800?mt=8","desc":"\u4e3a\u4ec0\u4e48\u73b0\u5728\u8d8a\u6765\u8d8a\u96be\u8d5a\u94b1\u4e86\uff1f","start":"2018-08-10 16:20:21"} } }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/bg-mask/bg-mask.es'], function(mask) { mask.default.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/index/morebar/morebar.es'], function(morebar) { morebar.default.init(1) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/index/question-reward/question-reward.es'], function(index) { index.init({"usersurplus":"","isLogin":"","isSingleReply":"1"}) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/index/accusation/accusation.es'], function(accusation) { accusation.default.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require F.context('singleReply', '4208695586') F.context('isLightTheme', 1) F.context('singleImport', 1580) F.context('pvid', '958791953') F.context('singleUid', '7d074069236f25705e795ccc') F.context('businessId', '96182') // 知识头条是否内容制作包 F.context('knowledgeCardType', 0) F.context('isPartnerHosting', 0) F.context('hostedContentFrom', '') require.async(['m-common:widget/js/util/log/log'], function (log) { log.addKey({ rid: '4208695586', pinzhuanFlag: 0, typeSqbFlag: 0, isPartnerHosting: 0, hostedContentFrom: '', businessId: 96182 }) log.send({ action: 'pv', area: 'pv', }) }) require.async(["m-question-new:widget/js/page/index"]) require.async(["m-question-new:widget/js/page/single.es"], function (single) { single.init({ videoCount: 0, rid: '4208695586', answerIsBusiness: 96182 }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-question-new:widget/comment-layer/comment-layer.es'], function (comment) { comment.init({ rid: '4208695586' }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(["m-question-new:widget/gotop/gotop"],function(gotop){ gotop.init('#w-gotop') }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(["m-common:widget/js/logic/duration/duration"],function(dur){ // 手百中,如果document.referrer中含有xcx=\d+时,在此链接中添加xcx参数 var match = (document.referrer).match(/xcx=\d+/i) if (window.history && navigator.userAgent.match(/baiduboxapp/i) && match) { var hash = location.hash var search = location.search var joiner = search.indexOf('?') === -1 ? '?' : '&' window.history.replaceState(null, '', search + joiner + match[0] + hash) } dur.init({ uid: '' }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/lib/gmu/zepto/zepto'], function($) { var businessIds = [96182] businessIds && businessIds instanceof Array && $.ajax({ url: '/business/submit/dailystatistics', type: 'GET', timeout: 30 * 1000, data: { type: 1, businessIds: businessIds.join('_'), qid: F.context('question').qid } }) }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/trans-yun/trans-yun-log'], function(YunLog){ YunLog.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).requirerequire.async(['m-question-new:widget/yike-card/yike-card-log'], function(yikeCardLog){ yikeCardLog.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/pushStateQuery/pushStateQuery'], function (app) { app.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/js/util/monitor/monitor.es'], function(m) { window.iPerformance && m.monitor && m.monitor.init() }) }() !function(){var F = (window.__IKNOW_GLOBAL__ || window).Fvar require = (window.__IKNOW_GLOBAL__ || window).require require.async(['m-common:widget/js/util/log/log'], function(log) { var ssrEnd = Date.now() var cost = ssrEnd - Number(1681103758975) setTimeout(function () { log.send({ action: 'latency', area: 'ssr', plat: 'h5', cost: cost, uri: window.location.pathname }) }, 1000) }) }() if(typeof PDC!="undefined"){PDC.tti()} var _hmt = _hmt || [] (function() { var hm = document.createElement("script") hm.src = "//hm.baidu.com/hm.js?16bc67e4f6394c05d03992ea0a0e9123" var s = document.getElementsByTagName("script")[0] s.parentNode.insertBefore(hm, s) })() !function(document, window){ var log = { list: [], host: 'https://' + location.host + '/api/httpscheck', log: function(param) { var a = [] a.push('wap=1') for(var k in param) { a.push(k + '=' + param[k]) } var msg = a.join('&') if(~this.list.indexOf(msg)){ return } this.list.push(msg) var img = new Image() var key = '_ik_log_' + (Math.random()*2147483648 ^ 0).toString(36) window[key] = img img.onload = img.onerror = img.onabort = function() { img.onload = img.onerror = img.onabort = null window[key] = null img = null } img.src = this.host + '?' + msg } } function HTTPSWarningLog(){ this.selector = [ 'link', 'script', 'img', 'embed', 'iframe' ] this.warningCounter = 0 this.init() } HTTPSWarningLog.prototype = { init: function(){ this.fetch() }, fetch: function(){ for(var tags = this.selector, i =0, len = tags.lengthi < leni++) { this.getTag(tags[i]) } }, getTag: function(tag) { var domList = document.getElementsByTagName(tag) if(!domList.length) { return } for(var i = 0,len = domList.lengthi因为ie的兼容性问题(table节点下没法添加tr节点),原表格必须在table节点下有tbody节点,所有的tr节点都是在tbody节点之下。当我们要添加行的时候,创建tr节点,然后添加到tbody节点之下,再创建对应的td节点,添加到tr节点之下就行了。
测试代码如下:
<table>
<tbody id="myTableBody">
<tr>
<td>第一行</td>
</tr>
<tr>
<td>第二行</td>
</tr>
</tbody>
</table>
<input type="button" value="追加行" onclick="appendRow()" />
<script type="text/javascript">
function appendRow() {
var tableBody = document.getElementById('myTableBody')
var newRow = document.createElement('tr')
tableBody.appendChild(newRow)
var td = document.createElement('td')
td.innerHTML = '新行'
newRow.appendChild(td)
}
另外楼下提到的insertRow也可以 不过要注意加上参数-1, 这样才可以兼容Firefox。但是insertCell就显得不怎么好用了,因为用insertCell生成的td是没法用innerHTML赋值的
js如何在table中插入一行的方法是定位,插入:1、通过id定位到myTable对象
var table = document.getElementById("myTable")
2、创建一个空的<tr>标签,并且插入到第一行:
var row = table.insertRow(0)
3、插入两列:
var cell1 = row.insertCell(0)
var cell2 = row.insertCell(1)
4、给列分别赋值:
cell1.innerHTML = "NEW CELL1"
cell2.innerHTML = "NEW CELL2"
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)