How would some of you go about doing this.

Discussion in 'JavaScript' started by joesgraphics, Mar 24, 2007.

  1. #1
    Hi the thing i want to do is change a value in some javascript useing javascript i have made the so called script but iv only bin able to set the link to work with <a href etc but the thing is i want it to use this bit of code for the link
    javascript:llamarasincrono(' +url + id+ ', 'main');
    Code (markup):
    and here is the code for the form and javascript


    form and toggle script:-
    
    <li><a href="" onclick="toggle_form();return false">Id Search</a></li>
    
        </ul>
    
     
     <div id="id-search-form-container">
    <div>              
    <form id="searchid" name="searchid">
    <input type="text" size="3" id="id" name="id" value="Id.." onkeyup="dosearchid();" onkeypress="return chknum(event)" />&nbsp;
    <select size="1" name="options" id="select" onchange="dosearchid();">
    <option selected>....</option>
    <option value="delete.php?id=">Delete</option>
    <option value="edit.php?id=">Edit</option>
    </select>
    <div id="edurl"></div>
    </form>
    &nbsp;&nbsp;<span class="tiggle-form-cross"><a onclick="toggle_form();" onmousedown="javascript:document.searchid.reset();"><img src="images/close2.gif" /></a></span>
    </div></div>
    
    
    
    
    
    
        <script language="javascript"> 
          the_form = document.getElementById('id-search-form-container')
          the_form.style.display = 'none'
       
    function toggle_form() { 
    
             
            if(the_form.style.display == 'none') {
              the_form.style.display = 'block'
            }
            else {
              the_form.style.display = 'none'
            }
          }
        </script>
     </div> 
    HTML:



    Javascript for the ok button and link:-
    <script type="text/javascript">
    function dosearchid() 
    { 
    
        var frm = document.searchid; 
    	var url = frm.select.value; 
    	var id = frm.id.value; 
    
    if (url) { document.getElementById('edurl').innerHTML='<br /><a href="' + url + id + '" onmousedown="javascript:document.searchid.reset();" onclick="toggle_form();"><img src="images/ok2.gif" border="0" width"" hight="" /></a>'; } 
    else {  document.getElementById('edurl').innerHTML=""; } 
    
    
     } 
    function chknum(evt) 
    { 
    var charCode = (evt.which) ? evt.which : event.keyCode; 
    if (charCode > 31 && (charCode < 48 || charCode > 57)) 
    return false; return true; 
    }
    </script>
    Code (markup):

    the bit i want to change is were i have this
    innerHTML='<br /><a href="' + url + id + '" onmousedown="javascript:document.searchid.reset();" onclick="toggle_form();"><img src="images/ok2.gif" border="0" width"" hight="" /></a>';
    Code (markup):
    i would like to change it to but im unsure how to make this 1 work.
    innerHTML='<br /><a onmouseclick="javascript:llamarasincrono(' + url + id + ', 'main');" onmousedown="javascript:document.searchid.reset();" onclick="toggle_form();"><img src="images/ok2.gif" border="0" width"" hight="" /></a>';
    Code (markup):

    If any 1 could help me with this would be great thanks. :)
     
    joesgraphics, Mar 24, 2007 IP