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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. please sol javascript problem

please sol javascript problem

Scheduled Pinned Locked Moved Web Development
javascripthelp
3 Posts 3 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.
  • V Offline
    V Offline
    Vinay Dornala
    wrote on last edited by
    #1

    Hi all, Iam new to javascript coding, I have listbox1 and listbox2 if i double click on any item i need to add it into listbox2, This is part is working fine with my code, function MoveItemTo() { var ctrlSource=GetObject('CRS00027lstAvailableCourses'); var ctrlTarget=GetObject('CRS00027lstSelectedCourses'); var s_Index = ctrlSource.selectedIndex; var s_Value = ctrlSource.selectedValue; if(s_Index > -1) { var newOption=new Option(); newOption.value = ctrlSource.options[s_Index].value; newOption.text = ctrlSource.options[s_Index].text; ctrlTarget.options[ctrlTarget.length]=newOption; } } If user click on same item that already exit in listbox2 then i need to display alert message i.e u have already selected particular item. please send sample code, Thanks N Advance;

    J G 2 Replies Last reply
    0
    • V Vinay Dornala

      Hi all, Iam new to javascript coding, I have listbox1 and listbox2 if i double click on any item i need to add it into listbox2, This is part is working fine with my code, function MoveItemTo() { var ctrlSource=GetObject('CRS00027lstAvailableCourses'); var ctrlTarget=GetObject('CRS00027lstSelectedCourses'); var s_Index = ctrlSource.selectedIndex; var s_Value = ctrlSource.selectedValue; if(s_Index > -1) { var newOption=new Option(); newOption.value = ctrlSource.options[s_Index].value; newOption.text = ctrlSource.options[s_Index].text; ctrlTarget.options[ctrlTarget.length]=newOption; } } If user click on same item that already exit in listbox2 then i need to display alert message i.e u have already selected particular item. please send sample code, Thanks N Advance;

      J Offline
      J Offline
      JimmyRopes
      wrote on last edited by
      #2

      shakeela wrote:

      If user click on same item that already exit in listbox2 then i need to display alert message i.e u have already selected particular item.

      Use onclick event to compare selected item with contents of listbox2.

      Simply Elegant Designs JimmyRopes Designs
      Think inside the box! ProActive Secure Systems
      I'm on-line therefore I am. JimmyRopes

      1 Reply Last reply
      0
      • V Vinay Dornala

        Hi all, Iam new to javascript coding, I have listbox1 and listbox2 if i double click on any item i need to add it into listbox2, This is part is working fine with my code, function MoveItemTo() { var ctrlSource=GetObject('CRS00027lstAvailableCourses'); var ctrlTarget=GetObject('CRS00027lstSelectedCourses'); var s_Index = ctrlSource.selectedIndex; var s_Value = ctrlSource.selectedValue; if(s_Index > -1) { var newOption=new Option(); newOption.value = ctrlSource.options[s_Index].value; newOption.text = ctrlSource.options[s_Index].text; ctrlTarget.options[ctrlTarget.length]=newOption; } } If user click on same item that already exit in listbox2 then i need to display alert message i.e u have already selected particular item. please send sample code, Thanks N Advance;

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

        You just have to loop through the items in listbox2 and look for the item that is selected.

        --- single minded; short sighted; long gone;

        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