Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Selecting muliplte SPAN text. Currently, only allows for 1 at a time

    Greetings....How would I achieve the bulleted tasks with the code below?


    • Select Mulitple Groups
    • Deselect is not clearing the selections





    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    	function fnSelect(objId) {
    		fnDeSelect();
    		if (document.selection) {
    		var range = document.body.createTextRange();
     	        range.moveToElementText(document.getElementById(objId));
    		range.select();
    		}
    		else if (window.getSelection) {
    		var range = document.createRange();
    		range.selectNode(document.getElementById(objId));
    		window.getSelection().addRange(range);
    		}
    	}
     
    	function fnDeSelect() {
    		if (document.selection) document.selection.empty(); 
    		else if (window.getSelection)
                    window.getSelection().removeAllRanges();
    	}
    	</script>
    </head>
    
    <body>
    <form action=""><div id="div1" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span></td>
        <td><input type="checkbox"   onclick="fnSelect('div1');"></td>
      </tr> </table></div><br />
      
      <!--  #2 starts here -->
      <div id="div2" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span></td>
        <td><input type="checkbox"   onclick="fnSelect('div2');"></td>
      </tr> </table></div><br />
      
      <!---- #3 starts here --->
      
      <div id="div3" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span></td>
        <td><input type="checkbox"   onclick="fnSelect('div3');"></td>
      </tr> </table></div><br />
      
      <!--- #4 -->
      <div id="div4" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span></td>
        <td><input type="checkbox"   onclick="fnSelect('div4');">Select text in div 1</a>&nbsp;</td>
      </tr> </table></div><br />
      
      <!-- #5 -->
      
      <div id="div5" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span></td>
        <td><input type="checkbox"   onclick="fnSelect('div5');"></td>
      </tr> </table></div><br />
      
      <!-- #6-->
      
      <div id="div6" style="background-color: #ffffdd;border: 1px solid #000;">
    <table width="900" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td width="212"> Procedure Code </td>
        <td width="34"><span id="PROC_CODE" name="PROC_CODE">Test1</span>&nbsp;</td>
        <td width="646">&nbsp;</td>
      </tr>
      <tr>
        <td> Medicare Advantage </td>
        <td><span id="MEDICARE" name="MEDICARE" >Test2</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Procedure </td>
        <td><span id="STATUS">Test3</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Specialty </td>
        <td><span id="ATA_ID">Test4</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Precert Type </td>
        <td><span id="SYS_APP">Test5</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Review Type: </td>
        <td><span  id="SUBMITTER">Test6</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Guidelines: </td>
        <td><span id="EMAIL">Test7</span></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td> Additional Information for CPT </td>
        <td><span id="ADD_CPT" name="ADD_CPT" >Test8</span></td>
        <td>&nbsp;</td>
      </tr
      ><tr>
        <td> Prior Change Information </td>
        <td><span id="change" name="change">Test9</span>    <td><input type="checkbox"  onclick="fnSelect('div6');"/><!--<a href="javascript:fnSelect('div6');">Select text in div 1</a> -->&nbsp;</td>
    </td>
      </tr> </table></div>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
    </table>
    </form>
    </body>
    </html>

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,761
    Thanks
    23
    Thanked 546 Times in 545 Posts
    I really don't know why your doing what your doing maybe if you could explain what your trying to accomplish we could help. Right now you should be aware that in
    function fnSelect(objId) only the "else if" section executes never if(document.selection)

    And in function fnDeSelect() it's only the "else if" that executes.
    Evolution - The non-random survival of random variants.

  • #3
    New Coder
    Join Date
    Mar 2007
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    I really don't know why your doing what your doing maybe if you could explain what your trying to accomplish we could help. Right now you should be aware that in
    function fnSelect(objId) only the "else if" section executes never if(document.selection)

    And in function fnDeSelect() it's only the "else if" that executes.
    I'm sorry for lack of details. Basically the user should have the ablility to select muliple SPAN objects. Also if they deceide the change thier selection the secletiuon itself will deselect. The end goal is to allow the user to select the group designaded for that div and copy to another location.

  • #4
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    3,761
    Thanks
    23
    Thanked 546 Times in 545 Posts
    You should read this
    http://api.jquery.com/html/
    Evolution - The non-random survival of random variants.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •