Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Smileys symbols in textbox

Smileys symbols in textbox

Scheduled Pinned Locked Moved Web Development
javascript
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    greendragons
    wrote on last edited by
    #1

    for my project i created a smiley chart.... as user clicks a particular smiley from the chart it's corresponding code ex (@;}--) is for rose) should appear in textbox...... i got struck in javascript code......

    • Smileys

    smile


    D 1 Reply Last reply
    0
    • G greendragons

      for my project i created a smiley chart.... as user clicks a particular smiley from the chart it's corresponding code ex (@;}--) is for rose) should appear in textbox...... i got struck in javascript code......

      • Smileys

      smile


      D Offline
      D Offline
      daveyerwin
      wrote on last edited by
      #2

      document.links[i].onclick = smileyClick(i); That doesnt do what you expect. It assigns the results of smileyClick(i), which is a function call, to onclick. Try this ... for (var i = 1; i < document.links.length; i++) { document.links[i].num = i; document.links[i].onclick = smileyClick; } function smileyClick() { alert(this.num); ... ... document.getElementById('TextBox1').value = document.getElementById('TextBox1').value + symbols[this.num]; -- Modified Monday, March 22, 2010 4:46 PM

      G 1 Reply Last reply
      0
      • D daveyerwin

        document.links[i].onclick = smileyClick(i); That doesnt do what you expect. It assigns the results of smileyClick(i), which is a function call, to onclick. Try this ... for (var i = 1; i < document.links.length; i++) { document.links[i].num = i; document.links[i].onclick = smileyClick; } function smileyClick() { alert(this.num); ... ... document.getElementById('TextBox1').value = document.getElementById('TextBox1').value + symbols[this.num]; -- Modified Monday, March 22, 2010 4:46 PM

        G Offline
        G Offline
        greendragons
        wrote on last edited by
        #3

        Thnx a lot....:)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups