js字符串拼接怎么写 10
用单双引号和加号,怎么拼接啊。急比如:vara=12;vars="hi";varh="weio";怎么把数字拼接在中间...
用单双引号和加号,怎么拼接啊。急
比如:
var a=12;
var s = "hi";
var h = "weio";
怎么把数字拼接在中间 展开
比如:
var a=12;
var s = "hi";
var h = "weio";
怎么把数字拼接在中间 展开
1个回答
展开全部
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table id="tab" style=" border: 1px solid red;">
</table>
<script>
var webName = ["名1","名2","名3"];//这是名字集合
var web = ["网址1","网址2","网址3"];//这个是网址集合
var content = "";
for(var i=0;i<webName.length;i++){
content += "<tr><td>"+webName[i]+"</td><td>"+web[i]+"</td></tr>"
}
document.getElementById('tab').innerHTML = content;
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<table id="tab" style=" border: 1px solid red;">
</table>
<script>
var webName = ["名1","名2","名3"];//这是名字集合
var web = ["网址1","网址2","网址3"];//这个是网址集合
var content = "";
for(var i=0;i<webName.length;i++){
content += "<tr><td>"+webName[i]+"</td><td>"+web[i]+"</td></tr>"
}
document.getElementById('tab').innerHTML = content;
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询