1. 程式人生 > >一些過期的整理前端代碼

一些過期的整理前端代碼

ade don spa [0 orm lis tof prop com

  var MyText = {
    one : "1",
    two : "2",
    three : "3"
  };
  for(var prop in MyText){
    document.writeln(prop + "<br />");
  }
  //var myName = "javk";
  //alert(myName.strike());
  //var name = new String("momo");
  //alert(name.valueOf());

  //var boolFlag = new Boolean("");
  //alert(boolFlag.toString());
//var value1 = -1 * Number.MAX_VALUE*2; //alert(value1); //var num = new Number(36.88888); //alert(num.toExponential(2)); //alert(num.toPrecision(4)); //alert(num.toFixed(3)); /*var str = new String("hello world"); document.writeln(str.strike() + "<br />"); document.writeln(str.big() + "<br />"); document.writeln(str.small() + "<br />"); document.writeln(str.bold() + "<br />"); //document.writeln(str.blink() + "<br />"); //document.writeln(str.italice() + "<br />"); document.writeln(str.link(‘www.baidu.com‘) + "<br />"); document.writeln(str.sup() + "<br />"); var str = new String("firstName = li ,lastName = ming,state = shandong,statement =‘ test split‘"); var arrayTokens = str.split(‘,‘,3); for(var token in arrayTokens){ document.writeln(arrayTokens[token] + "<br />"); var newToken = arrayTokens[token].split(‘=‘); document.writeln(newToken[1].toUpperCase()+"<br />"); }
*/ /*var date = new Date(); document.writeln(date.getFullYear()); document.writeln(date.getDay()); document.writeln(date.getDate()); */ /*var value = -3.14; document.writeln(Math.ceil(value) + "<br />"); document.writeln(Math.floor(value) + "<br />"); document.writeln(Math.exp(4) + "<br />"); document.writeln(Math.pow(3,2) + "<br />"); for (var i=0;i<10;i++){ //document.writeln(Math.random().toPrecision(2) + "<br />") document.writeln(Math.ceil(Math.random() * 10) + "<br />"); }
*/ /* var newArray = new Array(); for( var i=0;i<10;i++){ newArray[i] = i+1; } var newArray2 = newArray.slice(0,5); document.writeln(newArray2 + "<br />"); document.writeln(newArray + "<br />"); var newArray3 = newArray.concat(newArray2); document.writeln(newArray3 + "<br />") newArray3.reverse(); document.writeln(newArray3 + "<br />") var str = newArray3.join("----"); document.writeln(str);*/ // newArray.splice(0,2,‘11‘,‘12‘); // for (var num in newArray){ // document.writeln(num + "<br />"); // } /* var str = new String("cats,dogs,birds,horses"); array = str.split(‘,‘,4); document.writeln(array[2] + "<br />"); //array.join("--"); // for (var anm in array){ // document.writeln(array[anm] + "<br />"); // } // document.writeln(array + "<br />"); var date = new Date(); document.writeln(date + "<br />"); var hour = date.getHours(); hour += 168; date.setHours(hour); document.writeln(date.toString() + "<br />"); var num = 34.44; document.writeln(Math.ceil(num) + "<br />"); document.writeln(Math.floor(num) + "<br />") */ // var func = prompt("Enter function body: "); // var x = prompt("Enter value of x: "); // var y = prompt("Enter value of y: "); // // var op = new Function("x","y",func); // var theAnswer = op(x,y); // // alert("Function is : "+func); // alert("x is :" + x +"y is "+y); // document.writeln(jiecheng(3)+"<br />"); // var val = new Function("x","y",func); // func(x,y){ // return x + y; // } // document.writeln(val(1,2) +"<br />"); //var msg = "hello world....0"; //console.log("%s",msg); //var headerElement = document.getElementById("pageHeader"); //headerElement.style.textShadow = "#ff0000 2px 2px 2px 3px"; //alert("hello "); } function mouseDown(nsEvent){ var theEvent = nsEvent ? nsEvent : window.event; var locStrinng = "X: "+theEvent.screenX + "Y: "+theEvent.screenY; // document.writeln(locStrinng + "<br />"); alert(locStrinng); console.log(locStrinng); } function show_coords(event) { alert("haha"); x=event.screenX; y=event.screenY; document.writeln(x+ " "+ y) alert("X coords: " + x + ", Y coords: " + y) } function isShiftkeyDown(event){ if(event.keyCode == ‘A‘){ alert("ok"); }else { alert("not ok "); } } function setObjects(){ document.getElementById("people").firstName.focus(); } function bubbleUp(event){ alert("Bubbling: "+this); } function setUp(event){ document.addEventListener("click",bubbleUp,false); //document.getElementById("people").addEventListener("click",bubbleUp,false); document.forms[0].addEventListener("click",bubbleUp,false); } function strReverse(str){ var length = str.length(); for(var i=length-1;i>=0;i--){ document.writeln(str.charAt(i)); } }

<!-- <input type="button" id = "but" value="按鈕" /> -->
<!-- <form id = "people" action="">
<p>
<input type="submit" value="Submit" /><br />
FirstName : <input type="text" name="firstName" /><br /><br />
LastName : <input type="text" name="secondName" /><br />
</p>
</form> -->

一些過期的整理前端代碼