Jump to content

justsomeguy

Moderator
  • Posts

    31,575
  • Joined

  • Last visited

  • Days Won

    77

Posts posted by justsomeguy

  1. It sounds like you think your code is the same as this:

    var jsonLikeObj = {
      getFoo: {
        value: function() { return this.foo = 1; },
        enumerable: false
      }
    };

    It's not, that's not what Object.create does.  That second parameter is a description about how to create the object, it's not the actual object.  jsonLikeObj.getFoo.enumerable is also undefined.  Why?  Because that's not the actual object, it's the specification for the object.  It's metadata.

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create

    • Thanks 1
  2. You can use a search and replace with a regular expression, several text editors offer that.

    Somehow I need to open the My Places file with the XMLHttpRequest object. How do I do that?

    You can make a web page and send an ajax request for the file, but Javascript isn't going to be able to save a file on your computer.

  3. Quote

    NOTE: If I touch the value attribute ie value="<?php echo $event['eventdate'] .'|'. $event['venuename']?>" the javascript wont work.

    Then you need different Javascript, don't you, because that's the value that gets submitted to the server.  Put the eventname there if that's the value you want to submit to PHP, and use data attributes to store the other data instead of trying to cram all of the data in the value attribute.

    https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

  4. That's a pretty serious AI you're suggesting that can figure out what the developer intended and write the appropriate code.  It's not just about copying and pasting changes, it's different code to do the same thing, which means you need software to figure out what they meant to do.

  5. I don't know, I don't know what you did.  It's pretty basic as far as programming goes, though.  You can use ajax to send requests to the server with the data you want to save, and use ajax to read the data from the server and do whatever you want with it.  On the server you either just get the data and save it, or read it and output it.  Relative to programming, it's about as basic as it gets.

  6. If there's a problem with the headers you should be able to open that script in a browser to see the error messages.  Trying to send a header if they've already been sent will give you a warning and tell you where the first output was.  You can also use an error log and check that.

  7. Don't assume that just because you put an ID on an element, that the browser will make a Javascript object for it.  Get the element with document.getElementById.

×
×
  • Create New...