Jump to content

F1Fan

Members
  • Posts

    1,182
  • Joined

  • Last visited

Everything posted by F1Fan

  1. F1Fan

    Submit Code

    What happens if you try this: <table > <tr> <td style="width:136px;" align="right"> <br style="line-height:7px"> Your Full Name Here:<br> <br style="line-height:14px"> Your E-mail Address:<br> <br style="line-height:14px"> Comments & Questions: </td> <td style="width:13px;"></td> <td style="width:169px;"> <form id="form1" action="" name="form1" method = "post"> <div class="form"><input type="text" name="name" id="name"></div> <div class="form"><input type="text" name="email" id="email"></div> <textarea rows="40" cols="50" name="message" id="message"></textarea><br> <br style="line-height:9px"> <span > <a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:52px">clear</a> <a href="#" onClick="document.getElementById('Submit').click()" style="margin-left:10px">send</a> </span> <label> <input type="submit" name="Submit" id="Submit" value="Submit"> </label> </form> </td> </tr> </table> The difference is that the submit <a> virtually clicks the submit button. If you then want to hide the submit button, hide it with CSS.
  2. <input type="text" onkeyup="document.getElementById('secondText').value=this.value;"> <input type="text" id="secondText">
  3. Please post code in the code tags. It makes it much easier to read. So what problem are you having, other than "it isn't working?" The more details, the better. At first glance, it appears that your button is calling a function called "ajaxget()," but there is no such function.
  4. Ah, yes I believe the reason is that you have an empty href attribute. You need to add # to it. Like this: <a href=\"#\" onclick=\"document.getElementById('im').src='images/vendors/$image01'\"><img src=\"images/vendors/$image01\" width=\"40\" height=\"40\" ALT=\" \" ></a> Otherwise, I believe it just defaults to whatever the current URL is, so clicking on one of those links would reload the page without the #.
  5. We might need to see some code in order to make any suggestions.
  6. F1Fan

    Submit Code

    are you sure that you have "form1" as the ID on that form? Also, if that <a> is inside the form, you could do this: <a href="#" onClick="this.form.submit()" style="margin-left:10px">send</a>
  7. The problem is that your "this" in the onclick event for the submit button refers to itself, the submit button. You need to change that to "this.form" to refer to the form.
  8. What JS errors are you getting? You should have something in your error console. Also, why are you putting a backslash before the closing single quote on your image source in your onclick? onclick=\"document.getElementById('im').src='images/vendors/$image01\'\" should be onclick=\"document.getElementById('im').src='images/vendors/$image01'\"
  9. Seriously? What is the PHP url that you are pointing to now? If it is this: xmlhttp.open("GET","getusernu.php?q="+str+"&variableToReceiveAs=<?php echo $navn; ?>",true); you don't see the problem?? $_GET['q'] and $_GET['variableToReceiveAs'] are the only ones you're passing.
  10. F1Fan

    error

    After some research, it looks like these types of errors are usually due to IE, a corrupted jQuery file, or a typo somewhere that causes it to not properly find the element with that ID. Are you listing all of your code? Maybe you have more than one ID with "datepicker." Have you tried multiple browsers?
  11. F1Fan

    error

    Hmm. Try calling the jQuery files absolutely, like you already are with the CSS files. <link rel="stylesheet" type="text/css" href="/css/style.css" /> <link rel="stylesheet" type="text/css" href="/ajax/jquery/datepicker/datepicker.css" /> <script type="text/javascript" src="/ajax/jquery/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/ajax/jquery/datepicker/datepicker.js"></script> <script type="text/javascript" src="/ajax/jquery/datepicker/datepicker.core.js"></script> <script type="text/javascript" src="/javascript/inputEmbeddedImage.js"></script>
  12. xmlhttp.open("GET","getusernu.php?q="+str+"&variableToReceiveAs=<?php echo $navn; ?>",true); Try it this way, if you already have $_GET['navn']. xmlhttp.open("GET","getusernu.php?q="+str+"&variableToReceiveAs=<?php echo $_GET['navn']; ?>",true);
  13. F1Fan

    error

    You really should move it into the document.ready function. $(document).ready(function() { $(".inputWithImage").each(function(){ $(this).add($(this).next()).wrapAll('<div class="imageInputWrapper"></div>'); }); $("#datepicker").datepicker(); });
  14. F1Fan

    error

    I know what jQuery datepicker is. I'm asking for the rest of your code. The jQuery date picker is supposed to be applied to a text input field, and your error appears to imply that you're applying it to a non-text field.
  15. F1Fan

    error

    What kind of element is id "datepicker"?
  16. The trick to this is actually quite easy. Create a new http object for each request that you want to make. If this isn't clear, list your code and I'll show you.
  17. OK, you're getting there. You can pass your variables via get, and you are already passing one variable. In this line: xmlhttp.open("GET","getusernu.php?q="+str,true); you are sending the JavaScript "str" variable in the first page to the "getusernu.php" file. That file receives the "str" variable as the PHP variable "$_GET['q']". To add other variables, you need to add "&variableToReceiveAs=variableToSend" to the end of the URL string, one for each variable you want sent. So, to add a PHP variable, you would do it this way: xmlhttp.open("GET","getusernu.php?q="+str+"&variableToReceiveAs=<?php echo $variableToSend; ?>",true); What you typed with the $_GET['navn'] doesn't make sense, because that's a variable that you would receive, not send. So, if you are wanting to send the selected variable from a <select> to the "getusernu.php", then you need to pass the variable into the JavaScript function, and finally pass it to the "getusernu.php" file. So, let's cover those three steps. Part 1, get the selected variable into the JavaScript function. Start by adding "this.value" to the arguments passed into the function, like this: <select name='selectName' onchange='showUser(this.value);'> Then accept that into the JavaScript function, like this: function showUser(selectedValue){ Part 2, send the variable to the PHP file: xmlhttp.open("GET","getusernu.php?sentValue="+selectedValue,true); Part 3, accept the sent variable into the PHP file: echo $_GET['sentValue']; Finally, here's an example of how to pass two variables: Part 1: echo "<select name='selectName' onchange='showUser(this.value, \"$somePHPvar\");'>"; function showUser(selectedValue, varFromPHP){ Part 2: xmlhttp.open("GET","getusernu.php?sentValue="+selectedValue+"&secondValue="+varFromPHP,true); Part 3: echo $_GET['sentValue'].'<br>'; echo $_GET['secondValue'];
  18. 'beha' is your table name, not your input name. Also, if you're referring to what you use to get it in the PHP part of Ajax, then you use $_GET['q'] because of this line: xmlhttp.open("GET","getusernu.php?q="+str,true);
  19. Where are you creating the "http_request" object? It appears that your problem is that you've created that object globally, then you're attempting to reuse it. When you do that, each request will abort the previous, and you will only ever get the last response. You need to actually create that object inside your private function, so that you are using 20 different http objects 1 time each, as opposed to 1 object 20 times. Also, you keep saying you want to sort them. What do you want to use to sort them? Something that's being returned, or do you want them in the order that you called them?
  20. OK, I don't see how some of your code is working, but I THINK what you're asking is for this: $oHTML .= "<select name='$field' onchange='showUser(this.value)'>\n<option value='all'>All</option>\n";
  21. First, if you don't already know how, learn how to make asynchronous calls (true) as opposed to the synchronous (false) that you're doing now. Assuming you don't know how to do this, here are two examples that do the same thing, but one sync, the other async: Synchronous: var newHttpObject = getHTTPObject(); newHttpObject.open('GET', url, false); newHttpObject.send(null); document.getElementById('someElement').innerHTML = newHttpObject.responseText; Asynchronous: var newHttpObject = getHTTPObject(); newHttpObject.open('GET', url, true); newHttpObject.send(null); newHttpObject.onreadystatechange = function(){ if (newHttpObject.readyState == 4){ document.getElementById('someElement').innerHTML = newHttpObject.responseText; } } Now, to make multiple calls, I would suggest putting the above into its own function. Then, in your loop (or whatever you're using to do the 20 calls), call the function each time. This will create a unique http object for each call, allowing them to each run independently of one another. As far as handling the returned data, I'm not sure. I would guess the best way to to that would be to set a global JS counter that was incremented each time the function was called, and decrement that counter inside the IF statement that handles the response. Then, in your first function, write something that waits until that counter is back to zero before it sorts whatever data you have returned. It also would probably be best to put the data returned by each call into an array, so it doesn't overwrite any previous calls. Hope this helps.
  22. F1Fan

    INNER JOIN

    Looks like that's what you have. What errors are you getting?
  23. First, please post all code in code tags. The <tr> tag is for a table row inside the <table> tag. You have no table. If you are trying to hide an entire table, use "display: none;" and "display: table;" to hide or show your table, respectively. If you are using the <table> tag and just neglected to show it, replace your <div> tags with <tbody> tags. <tbody> is for a group of rows. You can then hide or show that group of rows.
  24. First, PLEASE post your code in code tags. Just put the ID in a hidden input field.
  25. Your classes are for <a> tags only, hence ".lrollover a".
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.