Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Everything posted by justsomeguy

  1. It might be an issue of 32-bit vs 64-bit, although a 64-bit OS should still be able to run 32-bit software. If you right-click on My Computer and do Properties you'll see all of your info there.
  2. You need to get better at asking questions. This is not a service where you enter your code and error message and a solution pops out. Also, please understand how to post code using the Code button in the text entry field. The error message is telling you exactly what the problem is, do you understand what it's saying?
  3. No problem. Just so you're aware, this is Javascript. Java is a completely unrelated language.
  4. What do you mean it doesn't work, what actually happens?
  5. Make addItem general, don't get the value to add from the page: function addItem(text){ var ul = document.getElementById("dynamic-list"); var li = document.createElement("li"); li.setAttribute('id',text); li.appendChild(document.createTextNode(text)); ul.appendChild(li); } The point is to remove the code that might change any time you want to call it, and instead pass those values to it. Now you pass the value that you want to the function: addItem('Milk'); addItem('Water'); addItem(document.getElementById("candidate").value); <button onclick="addItem(document.getElementById('candidate').value)">add item</button> <button onclick="removeItem()">remove item</button> <button onclick="addItem('Water')">Water</button> <button onclick="addItem('Milk')">Milk</button>
  6. localStorage is just like sessionStorage, but sessionStorage only lasts while they're on your site, it won't be there if they come back. localStorage will. It's exactly the same to use it though, the difference is persistence.
  7. It's probably best to use localStorage, but you could also use cookies as a data store.
  8. If you're using SQL Server, it looks like Mon-dd-yyyy is not one of the supported formats: https://www.mssqltips.com/sqlservertip/1145/date-and-time-conversions-using-sql-server/ You would first need to convert that field to a supported format using the string functions, then you can use the convert function to convert it to a datetime. e.g.: convert(datetime, '30 Dec 2006', 106)
  9. Your database should give you a function to convert a date where you tell it the format of the string to expect. If you're trying to run it over the entire table then make sure there are no null values or other bad data. A misspelled value in one row will cause it to break.
  10. It's not an issue of time. Cookies are sent as HTTP headers with either the request or the response. When your browser sends the HTTP request to the server, it includes any cookies that match the request as headers. You can use your browser's developer tools to see that. When the server is sending the response back, it will also send headers. If your PHP code sets a cookie, then the response headers will include a Set-Cookie header to tell the browser to set a new cookie. So when you set a cookie on one response you can't check the same cookie in that request. That request was sent before the browser was told to set the cookie. The cookie will be sent in the next request.
  11. Change the function to add a new item so that you pass the value in instead of getting it from the input. You can still use it with the regular add button: addItem(document.getElementById("myInput").value); Or you can call it with whatever other value you want: addItem('Milk');
  12. I'm building something vaguely similar with React, if you've worked with that before then that might be a good option. Depending on what your skill set is, you can probably think of other ways to do it. If you have specific questions that you need help with then feel free to ask.
  13. What do you mean you cloned a site? Do you have the code to process the form and send the email?
  14. Changing a data structure in Javascript does not change files on disk. Javascript running in a browser does not have permission to write to any files on your computer, thankfully. If you want to change files on the server you need to use a server-side language like PHP for that.
  15. parseFloat does something different than what isNaN checks for. isNaN converts to a Number, and then checks if that is NaN. Converting to a Number is not the same as using parseFloat: var res = ""; res = res + isNaN(123) + ": 123 -> " + Number(123) + "\n"; res = res + isNaN(-1.23) + ": -1.23 -> " + Number(-1.23) + "\n"; res = res + isNaN(5-2) + ": 5-2 -> " + Number(5-2) + "\n"; res = res + isNaN(0) + ": 0 -> " + Number(0) + "\n"; res = res + isNaN('123') + ": '123' -> " + Number('123') + "\n"; res = res + isNaN('Hello') + ": 'Hello' -> " + Number('Hello') + "\n"; res = res + isNaN('2005/12/12') + ": '2005/12/12' -> " + Number('2005/12/12') + "\n"; res = res + isNaN('') + ": '' -> " + Number('') + "\n"; res = res + isNaN(true) + ": true -> " + Number(true) + "\n"; res = res + isNaN(undefined) + ": undefined -> " + Number(undefined) + "\n"; res = res + isNaN(null) + ": null -> " + Number(null) + "\n"; res = res + isNaN('NaN') + ": 'NaN' -> " + Number('NaN') + "\n"; res = res + isNaN(NaN) + ": NaN -> " + Number(NaN) + "\n"; res = res + isNaN(0 / 0) + ": 0 / 0 -> " + Number(0 / 0) + "\n"; console.log(res) That shows the results that are expected. I agree that isNaN should be associated with parseFloat and parseInt though, because that's usually when you need to test. I typically convert first and then test to see if that result is NaN instead of using isNaN on the value to be converted.
  16. There's a wheel event: https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event You may also want to consider using the arrow keys to scroll, and just grabbing the scrollbar and moving it.
  17. According to the notes in the manual, the options array was added in version 7.3. If you don't have that then you won't be able to use samesite for this.
  18. Pass an array of options. https://www.php.net/manual/en/function.session-set-cookie-params.php
  19. Do you want to do all of that in Javascript? If so, put a handler on each dropdown that runs when the value is changed, and save the new value. When the page is loaded check for that saved data and set the values of each field.
  20. decodeURIComponent decodes a string that was encoded as a component of a URI. It does not require an entire URI.
  21. There's not really a reason to use ORDER with UPDATE, it shouldn't matter what order the rows get updated. What does that mean? Is the exercise to append the total duration to the playlist title?
  22. Array is a function that returns an array object. If that makes sense. In Javascript, functions, arrays, and objects are all very closely related. The syntax is even interchangeable: window["alert"]("what");
  23. If I had to guess, I'd say the provider isn't found. You''re asking for a specific version, are you sure that one is included in what you installed? https://www.connectionstrings.com/access/ That has a note about using Jet in 64-bit environments, it sounds like you use a different driver for that.
  24. You only actually need to do it if you're specifically trying to refer to a global instead of a local variable, and both exist.
  25. If you try to start the session while it is already started then PHP will show an error. If it hasn't been started for that request then there's no problem. Remember, every HTTP request is separate in PHP. Starting a session in one request does not automatically start it in any other request. It doesn't matter if it is an XHR request, or typing a URL and hitting enter, or clicking a link. They're all just requests.
×
×
  • Create New...