劉任昌JavaScript輸出與輸入的程式碼

JavaScript輸出與輸入的程式碼

輸入字串:

JavaScript程式碼

<p>輸入字串:<input type="text" len="50" id="in"></p>
<p><input type="button" value="執行JavaScript" onclick="f()"></p>
<p id="out"></p>
<script>
function f(){
  var a = document.getElementById("in").value;/*取得id=in的文字*/
  var b = "原字串: "+a+"<br>長度是:"+a.length+"<br>反串是: ";
  var c = "";
  for (var i = 0; i < a.length; i++)
     c = a.slice(i,i+1) + c; 
  b = b +"<font size=7>" +c + "</font>";
  document.getElementById("out").innerHTML = b;/*輸出html指令*/
}
</script>

196影片

留言

  1. https://kingthegreatliu.blogspot.com/2023/01/javascript.html

    回覆刪除
  2. https://d11150112.blogspot.com/2023/01/javascript.html

    回覆刪除
  3. 作者已經移除這則留言。

    回覆刪除
  4. https://rtytrdtfg.blogspot.com/2023/01/h1bordersolid-8px-purple-javascript.html

    回覆刪除
  5. https://d11150116.blogspot.com/2023/01/javascript.html

    回覆刪除
  6. https://d11150115.blogspot.com/2023/01/javascript.html

    回覆刪除
  7. https://cindy-javascript.blogspot.com/2023/01/javascript.html

    回覆刪除
  8. https://tgyhjikolujik2554.blogspot.com/2023/01/javascript.html

    回覆刪除
  9. https://lihtml-css-javascript-java.blogspot.com/2023/01/javascript.html

    回覆刪除
  10. https://643gjeytfru4312.blogspot.com/2023/01/javascript.html

    回覆刪除
  11. https://d11150114.blogspot.com/2023/01/javascript.html

    回覆刪除
  12. https://enchenghu0905.blogspot.com/2023/01/javascript.html

    回覆刪除
  13. https://d11150108.blogspot.com/2023/01/javascript.html

    回覆刪除
  14. https://www.blogger.com/blog/post/edit/2503769166705683616/4238664622796537746

    回覆刪除
  15. https://jdoifjopq1264.blogspot.com/2023/01/blog-post.html

    回覆刪除
  16. https://unnnn20.blogspot.com/2023/01/javascriptinputtextgetelementbyid.html

    回覆刪除
  17. https://d11150113.blogspot.com/2023/01/javascript.html

    回覆刪除
  18. https://xinyijava.blogspot.com/2023/01/d11050134-javascript.html

    回覆刪除
  19. https://iuytjhg5261.blogspot.com/2023/01/h1-background-color-red-border-solid.html

    回覆刪除

張貼留言

這個網誌中的熱門文章

劉任昌對照Python與JavaScript指令

劉任昌Python集合set清單list元組tuple字典dictionary

劉任昌python, input, str, float