Membuat "Select All" Tanpa Tombol

Allow,,, yang iasa tukar banner, trus textarea buat kode bannernya masih pake tombol kayak gini: basi!!
Gag perlu pake tombol lagi jaman sekarang.
Coba kamu liat textarea di sidebar kiri, di textarea punyaku, kagak pake tombol.
begitu tectareanya diklik, langsung Hightlighted semua.
Mau?

Kodenya sama, cuman pindahin aja attribut pada tombol ke textareanya.
Untuk jelasnya liat nih:


Jangan lupa ama kode javascriptnya:
<script type='text/javascript'>
var copytoclip=1
function HighlightAll(theField) {
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
if (document.all&&copytoclip==1){
therange=tempval.createTextRange()
therange.execCommand("Copy")
window.status="Contents highlighted and copied to clipboard!"
setTimeout("window.status=''",1800)
}
}
</script>

Nah, trus pada textareanya bikin kayak gini:
<Form name="SelectAll">
<textarea onclick="HighlightAll('SelectAll.Copy')" name="Copy" width="bla bla" height="bla bla">

BLA BLA BLA
</textarea>
</form>

Nah, coba liat bedanya....
(^o^)d

Comments

No comments:

Related posts
Guestbook
Author


© 2008 - 2016 DickeyMaru
Blogger Template Win 8 design by Dark Ard from DeezClan | All rights reversed.
  • Post
  • Comments
  • Related
  • Guestbook
  • Author
  • Other