天天看點

多行文本框操作示範

 <mce:script language=Jscript><!--

function run(obj){

if (f1.code.value==''||f1.code.value==' '){alert("您需要運作的代碼為空!");obj.focus()}

else{var winEx = window.open("", "winEx", "width=400,height=300,resizable=yes,top=0,left=0");

winEx.document.write(f1.code.value);winEx.document.close()}}

function Jia(){document.f1.code.rows+=parseFloat(f1.h1.value)}

function Jian(ob){if (ob.rows>3) document.f1.code.rows-=parseInt(f1.h1.value);

else alert('已接近最小值')}

function Exec(obj,cmd){obj.select();document.execCommand(cmd)}

function Paste(obj){obj.focus();document.execCommand('paste')}

function Exe(cmd){document.execCommand(cmd)}

function view(){window.location="view-source:"+window.location.href}

// --></mce:script><mce:style><!--

body{color:#063;font-family:arial;font-size:12}

textarea{border:1 solid #000;font-family:arial;font-size:12;width:100%;color:red;margin:5 0}

--></mce:style><style mce_bogus="1">body{color:#063;font-family:arial;font-size:12}

textarea{border:1 solid #000;font-family:arial;font-size:12;width:100%;color:red;margin:5 0}</style>

<form name=f1 method="post" action="">

<input type=button value='↓' οnclick=Jia(code)>

<select οnchange="h1.value=this.options[this.selectedIndex].value">

<option value=1>1</option><option value=2>2</option><option value=3>3</option></select>

<input type=button value="全選" onClick="javascript:this.form.code.focus();this.form.code.select();">

<input type=button value='↑' οnclick=Jian(code)>

<input type=button value='拷貝' οnclick=Exec(code,'Copy')>

<input type=button value='剪切' οnclick=Exec(code,'Cut')>

<input type=button value='粘貼' οnclick=Paste(code)>

<input type=button value='清空' οnclick=Exec(code,'Delete')>

<input value=1 name=h1 type=hidden>

<input type=button value=運作代碼' οnclick=run(code)>

<textarea name=code cols="35" rows="9" style="BACKGROUND-COLOR: #FCE3FD" mce_style="BACKGROUND-COLOR: #FCE3FD">

繼續閱讀