//按钮【按钮一】的回调
//layer.msg('按钮【按钮一】的回调', {icon: 1})
select = 1
select_return(index)
},
btn2: function(index){ //或者使用btn2
//按钮【按钮二】的回调
//layer.msg('按钮【按钮二】的回调', {icon: 2})
select = 2
select_return(index)
},
btn3: function(index){
//按钮【按钮三】的回调
//layer.msg('按钮【按钮三】的回调', {icon: 3})
select = 3
select_return(index)
}.
btn4: function(index){
//按钮【按钮4】的回调
//layer.msg('按钮【按钮4】的回调', {icon: 4})
select = 4
select_return(index)
},
btn5: function(index){
//按钮【按钮5】的回调
//layer.msg('按钮【按钮5】的回调', {icon: 5})
select = 5
select_return(index)
}
把这一整段写成一个字符串返回给页面好了。想了半天没什么好方法,呵呵。主要是不知道你其他地方是怎么实现的。
你好!你前台必须先有一个模板来接受数据,这个模板可以是你自定义的,假设你的数据对象是
1
data = [{"name":"张三", "age":"21"},{"name":"李四", "age":"21"},{"name":"<a href="https://www.baidu.com/s?wd=%E7%8E%8B%E4%BA%94&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1d9nj0YP1u9P1b3PjnduAFW0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1DLPHfLrHmsPj6dnHR4PWRdPj6" target="_blank" class="baidu-highlight">王五</a>", "age":"21"}]
前台模板为
1
2
3
4
<div id="muban">
<ul id="ml">
</ul id="ml"></div id="muban">
数据操作为
1
2
3
4
5
for(var i = 0i <data.lengthi++){
var a = "<li>姓名:" + data[i].name + ",年龄: "+ data[i].age +"</li>"
var $ul = document.getElementById("ml")
$ul.append(a)
}
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<script type="text/javascript">
var r=prompt("请输入圆的半径","在此输入数字")
var i = 1
while(i == 1){
if(isNaN(r)){
//alert("请输入数字")
r=prompt("请输入圆的半径","在此输入数字")
}
else{
var s=Math.PI*r*r
document.write(s)
i = 0
}
}
</script>
</body>
</html>