→ starjou:又試了一下,其實可以省掉 onblur 時存入變數的步驟 12/11 17:19
→ starjou:那個值不會跑掉 12/11 17:20
推 jonathanmeow:感謝 但是看不太懂 要來去試試看先 :D 12/11 19:34
→ starjou:comment.selectionStart 可以得到游標位置,假設叫 pos 12/11 22:24
→ starjou:comment.value.substr(0, pos) 可以取得游標前的部份 12/11 22:24
→ starjou:comment.value.substr(pos, comment.value.length-pos) 為 12/11 22:25
→ starjou:游標後的部份 12/11 22:25
→ starjou:把前面加中間你要加的東東加後面,指到 comment.value 12/11 22:26
→ starjou:就完工了 12/11 22:26
推 jonathanmeow:狂推啊 我就是看不太懂selectionStart 想說要去查 12/12 16:50
→ jonathanmeow:真是太感謝了啦! 12/12 16:51