将方法输入为字符串

时间:2017-07-20 20:58:03

标签: scala

考虑一个字符串

val inp = "name,age,city"

考虑使用输入类型的方法

def partitions(colName:String,colNames:Sting*) : String

我必须在我的变量inp中使用逗号分隔的字符串列表将方法称为分区("名称","年龄","城市")。 / p>

1 个答案:

答案 0 :(得分:0)

<form action="/action_page.php">
<input type="number" name="low" id="low" placeholder="lowest number" 
value="1"><br>
<input type="number" name="high" id="high" placeholder="highest number" 
value="10"><br>
<input type="button" value="Submit" onclick="myFunction()">
</form>
<p id="randnum"></p>

<script>
function myFunction() {
var x = document.getElementById("randnum")
var low = document.getElementById("low").value;
var high = document.getElementById("high").value;
var random = Math.random();
x.innerHTML = Math.floor(random * (high-low) + high);
}
</script>