1. 程式人生 > >隨便的寫寫的

隨便的寫寫的

<input type="submit" name="button" value="點選" onclick="js()">
<span id="aa"> </span>
<script type="text/javascript">
     function js(){
      var c = new Array("first","second","third");
  var i =Math.round((Math.random()*3));
        document.getElementById("aa").innerHTML=c[i];
  }


</script>

字串分解

        String str ="sdsd/xsdsd";
        String[] temp
= str.split("/");
       
for(int i =0; i < temp.length; i++)
        {
            System.out.println(temp[i]);
        }