Assigning value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #16
    $i was only an example. You can use the img ID as part of the ID, e.g.
    Code:
    <input type='hidden' id='act".$row['folder_id']."' name='act[]' value='".$row['active']."'>
    then to refer to the hidden field you can use "act"+id

    Comment

    • Shalini Bhalla
      New Member
      • Dec 2007
      • 190

      #17
      i am trying to ge value in javascript :

      Code:
      <script>
      function changeMySrc(alt,id)
            {
              alert("hi"+ alt );
              if(alt == "not_selected")
      {
                     
               dc = document.getElementById(id);
               dc.src="http://bytes.com/images/delete.gif";
               dc.alt="selected";
               alert(dc.src);
      
               hd_val= document.getElementById("act"+id);
              hd_val.value = "0" ;
              alert(hd_val.value);


      its giving me error , pls try to understand what i want ?
      Last edited by acoder; Dec 5 '08, 05:24 PM. Reason: Please use [code] tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #18
        As a full member now, you should know that we expect your code to be posted in [CODE] tags (See How to Ask a Question).

        This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

        Please use the tags in future.

        Moderator.

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #19
          Originally posted by Shalini Bhalla
          i am trying to ge value in javascript :
          its giving me error
          Check the source as generated in the browser and post that here, i.e. the HTML code, not PHP.

          Comment

          • Shalini Bhalla
            New Member
            • Dec 2007
            • 190

            #20
            code

            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><MMString:LoadString id="insertbar/linebreak" /></title>
            <link href="css/admin.css" rel="stylesheet" type="text/css" />
            <script  src="selectuser.js"></script>
            <script src="call_insert.js"></script>
            <style type="text/css">
            <!--
            a:link {
            	text-decoration: none;
            }
            a:visited {
            	text-decoration: none;
            }
            a:hover {
            	text-decoration: underline;
            }
            a:active {
            	text-decoration: none;
            }
            -->
            </style>
            <!-- Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved. -->
            <!-- Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved. -->
            <!-- Copyright 2000, 2001, 2002, 2003 Macromedia, Inc. All rights reserved. -->
            
            <script>
            function changeMySrc(alt,id)
                  {
                    alert("hi"+ alt );
                    if(alt == "not_selected")
            {
                           
                     dc = document.getElementById(id);
                     dc.src="images/delete.gif";
                     dc.alt="selected";
                     alert(dc.src);
            
                     hd_val= document.getElementById("act"+id);
                    hd_val.value = "0" ;
                   alert(hd_val.value);
            
                    
                      
                    
                
                  
                   
                     }
                    else  if(alt == "selected")
                    {
                
                     dc=document.getElementById(id);
                     dc.src="images/addbutton.gif";
                     dc.alt="not_selected";
                     alert(dc.src);
            
                    }
                }
            
            
            
            </script>
            
            
            </head>
            
            <body class="oneColElsCtr" >
            
            <div id="container">
              <div id="mainContent"><br />
               <br />
               <br />
               <br />
            
               <span class="mainheading">Administration Module</span><br />
               <span class="topnav"><br />
               </span><a href="#" class="topnav">Create Folder</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span><a href="#" class="topnav">Add Content</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span><a href="#" class="topnav">Video Archive</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span><a href="#" class="topnav">Create User</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span><a href="#" class="topnav">Assign User</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#">&nbsp;</a></span><a href="#" class="topnav">Account Archive</a><span class="topnav">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;</span><a href="#" class="topnav">Account Overview</a><br />
            
               <br />
               <br />
               <br />
               <br />
               <br />
               <br />
               <br />
               <div class="formContainer">
                 <form id="form1" name="form1" method="POST" action="video_archive.php"  >
            
                   <table width="100%" border="0">
                   <tr>
                     <td width="45%" valign="top"><span class="mainheading2">Video Archive </span></td>
                     <td valign="top">&nbsp;</td>
                     <td width="45%" valign="top"><span class="mainheading2">Create User</span></td>
                   </tr>
                   <tr>
                     <td valign="top"><table width="100%" border="0">
            
            		          <tr >
                         <td width="47%" class="foldername1"  ><b>Html</b></td>
                         <td width="53%"></td>
                    </tr>
            		   	  
            		   <tr>
                       <td colspan="2">test.html</td>
                       </tr>
            		            <tr >
            
                         <td width="47%" class="foldername1"  ><b>Php</b></td>
                         <td width="53%"></td>
                    </tr>
            		   	  
            		   <tr>
                       <td colspan="2">test1.php</td>
                       </tr>
            		   		 </table> 
                       </td>
            
                     <td valign="top">&nbsp;</td>
                     <td valign="top"><table width="100%" border="0">
                       <tr>
                         <td width="47%"><label>User Name</label></td>
                         <td width="53%"><input type="text" name="username" /></td>
                       </tr>
                       <tr>
                         <td><label>
            
            Password             </label>
                           <label>               </label></td>
                       <td><input type="password" name="pass" /></td>
                       </tr>
                       <tr>
                         <td><label>
                         </label>
                           <label>Email ID              </label></td>
            
                         <td><input type="text" name="email" /></td>
                       </tr>
                       
                       <tr>
                         <td><label>
            Company Name            </label></td>
                         <td><input type="text" name="company" /></td>
                       </tr>
                       <tr>
                         <td><div align="right">
            
                         </div></td>
                         <td>
                           <div align="right">
                             <label>
                               <input type="submit" name="Submit" value="Submit" />
                             </label>
                           </div></td>
                       </tr>
                     </table></td>
            
                   </tr>
                   <tr>
                     <td valign="top" class="mainheading2">&nbsp;</td>
                     <td valign="top">&nbsp;</td>
                     <td valign="top" class="mainheading2">&nbsp;</td>
                   </tr>
                   <tr>
                     <td valign="top" class="mainheading2">&nbsp;</td>
                     <td valign="top">&nbsp;</td>
            
                     <td valign="top" class="mainheading2">Assign User </td>
                   </tr>
            
            
                         
                   <tr>
                     <td valign="top" class="mainheading2">&nbsp;</td>
                     <td valign="top">&nbsp;</td>
                     <td valign="top" class="mainheading2"> 
                    <select name="select"   onchange="showUser(this.value)">
                 <option value="Select" selected >Select User</option>
            
                                  <option value = 1 >abc</option>
                                  <option value = 2 >hij</option>
                                  <option value = 3 >shalini</option>
                                  <option value = 4 >fdgvfd</option>
                                  <option value = 6 >neeta</option>
                                </select></td>
            
                   </tr>
                   <tr>
                     <td valign="top" class="mainheading2">&nbsp;</td>
                     <td valign="top"></td>
                     <td valign="top" class="mainheading2"><table width="323">
                       <tr><td width="241">
            <div id="txtHint"></div>
            </td></tr></table></td>
                   </tr>
            <tr><td><input  type='submit' value='Assign'  name='assign'>
            
                 </table>
            
                 </form>
                 <br />
            </div>
            <br />
               
               <!-- end #mainContent -->
              </div>
            <!-- end #container --></div>
            </body>
            </html>

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #21
              Are you sure you've got the right page? Where's the image and hidden fields?

              Comment

              Working...