語法:Right(string,length)
函數 | 字串 | 字元數 | 執行 | 函數寫法 | 結果 | 訊息 |
Right | 000123 | 3 | Right("000123",3) | 123 | ||
Right |
<script language="vbscript">
<!--
sub run_Right()
document.all("lblRight").innerHTML = ""
if isNumeric(trim(document.all("Right2").value)) then
if CDBL(trim(document.all("Right2").value)) >=0 then
document.all("Right3").innerHTML = "Right(" & chr(34) & document.all("Right1").value & chr(34) &_
"," & trim(document.all("Right2").value) & ")"
document.all("Right4").value = Right(document.all("Right1").value,trim(document.all("Right2").value))
document.all("lblRight").innerHTML = "已取得字串!"
else
document.all("lblRight").innerHTML = "字元數=" & document.all("Right2").value & ",請輸入≧0的整數!"
document.all("Right3").innerHTML = ""
document.all("Right4").value = ""
document.all("Right2").value = ""
document.all("Right2").focus
end if
else
document.all("lblRight").innerHTML = "字元數=" & document.all("Right2").value & ",請輸入≧0的整數!"
document.all("Right3").innerHTML = ""
document.all("Right4").value = ""
document.all("Right2").value = ""
document.all("Right2").focus
end if
end sub
-->
</script>
<br />
<table>
<tbody>
<tr>
<td>函數</td><td>字串</td><td>字元數</td><td>執行</td><td>函數寫法</td><td>結果</td><td>訊息</td>
</tr>
<tr>
<td>Right</td>
<td><input id="Right1" name="Right1" type="text" style="width:80px"/></td>
<td><input id="Right2" name="Right2" type="text" style="width:25px"/></td>
<td><input id="btnRight" name="btnRight" onclick="run_Right()" type="button" value="Run" /></td>
<td><label id="Right3" name="Right3"></label></td>
<td><input id="Right4" name="Right4" type="text" style="width:80px" readonly/></td>
<td><label id="lblRight" name="lblRight"></label></td>
</tr>
</tbody>
</table>
沒有留言:
張貼留言