Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. My first guess would be that what you have is just a string instead of a JSON object. Log the full object into the console to see what it contains.
  3. DILEMMA: I have a fairly complex JSON object that is introduced via an AJAX call. Unfortunately, my control panel tells me that it is undefined. Is this because it has no value? Or, is it because I do not know how to read the value properly? {"lastVisits"[{"firstVisit":{"prettyDate":"Monday, May 14, 2018"}}]} The name of the variable into which it is read is visitor_data. Am I reading the value of correctly? visitor_data.lastVisits[0].firstVisit.prettyDate Roddy
  4. Ingolme

    Link to this buttom

    Just replace the <button> element with an <a> element that has the same class attribute. The class is important. <a class="button"><span>Hover </span></a>
  5. Yesterday
  6. MARCELO

    Link to this buttom

    How can i add a link in this buttom: https://www.w3schools.com/code/tryit.asp?filename=FRM3ZD7H5SZE I thought i should only add to it this: <a href="https xxx">Hover</a> but its not working Thanks.
  7. westman

    user agreement

    Hi all, No PHP or cookies today just text. I would like to update my Terms of Use / User Agreement - legal page. I am terrible with page content like this and would like to use a good free template. Where do I go for this?
  8. OK, Team, your confusion helped me to unravel my own confusion, and I was able to achieve the task with overwhelming success. SUCCESS: The following code replaces the current content of <div id='main'> with the content of another called <div id='legal_div'>. It also propels the user to the top of the hosting div -- namely, <div id='main'> after the new content is in place. This task is achieved with a Javascript file that was imported when the old content was set. My confusion was three-fold: 1) how to select the #main div 2) where to place the Javascript, and 3) how to select the <h2> element called #data_analysis $("#make_invisible").click(function() { var replacement = $("#legal_div").html(); $("#main").html(replacement); $('body, html').animate({scrollTop: $('#main').find('#data_analysis').offset().top},800); }); In any case, the problem is now resolved. Roddy
  9. Ingolme

    How to Replace an Insert from Another Insert

    I'm not sure what "from inside the div" means. Does that mean that the script that's doing the replacement is inside the div? As far as replacing the content of any element, you can either set its innerHTML property or use DOM methods such as removeChild() and appendChild().
  10. OK. Let us assume that how the content was inserted and the content itself do not matter. How does one go about replacing the content of a div from inside the div whose content is to be replaced? This should be a much easier question to understand. Roddy
  11. Last week
  12. justsomeguy

    onchange event question

    Well, you probably didn't do it right then.
  13. westman

    cookie coding

    Thank you for the answer to my question. Most of what you were discussing I did not follow but thanks.
  14. KateMacwil

    onchange event question

    HI I tried passing the id and it didn't work
  15. Sigmahokies

    Validation form

    Never mind, someone helped me, just added required in html, then it will appear... Thank you for helped.
  16. justsomeguy

    Validation form

    What do you mean it doesn't work, what happens? One thing to be aware of is that if you want to print "<" or ">" on an HTML page, you need to use the character entity. The browser uses those characters to represent HTML tags. If you're trying to print the actual character use the HTML entity for that character.
  17. justsomeguy

    onchange event question

    Pass the function another value to tell it which field to update, or what the box is, or whatever information you need to make it general. You could also get the name of the select and use that.
  18. Sigmahokies

    Validation form

    Hi everyone, I am trying to have validation form, seem it doesn't work. what did I do wrong? If anyone can help, Thank you so much... Gary Taylor <?php $buzz = $buzz2 = ""; if ($_SERVER['REQUEST_METHOD'] == "POST") { if (empty($_POST['select'])) { $buzz = "<h2><color ='red'> >- </color></h2>"; $buzz2 = "<h2><color ='red'> -< </color></h2>"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Welcome to ASL-PT Scoring</title> <link href="default.css" rel="stylesheet" type="text/css"> </head> <body> <fieldset> <h1>Welcome to ASL-PT Scoring website</h1> <table> <form action="login.php" method="post"> <select name="select"> <?php echo $buzz ?><option value="" >Please select the level</option><?php echo $buzz2 ?> <option value="Administrator">Administrator</option> <option value="License">License</option> <option value="Scorer">Scorer</option> </select> <caption>Please login to enter the site below:</caption> <tr><td>Username:</td><td class="td"><input type="text" name="user"></td></tr> <tr><td>Password:</td><td class="td"><input type="password" name="password"></td></tr> <tr><td colspan="2"><input type="submit" name="submitted" value="Login"></td></tr> </form> </table> </fieldset> </body> </html>
  19. KateMacwil

    onchange event question

    HI I have 3 select drop downs on my page - Status, Type and Year. Each have a few options the user can select from. When the user selects an option, a textbox is updated with this value. Each select drop down has their own onchange function, Below is an example of the Year select drop down. <select class="custom-select" name="filter-year" onchange="FilterTendersYear(this);">> Here is my Javascript for this: function FilterTendersYear(selectObject) { var value = selectObject.value; document.getElementById("textbox-year").value = value; } How can I re-write this function so that it will work with all my 3 select boxes on the same page?
  20. justsomeguy

    Testing a radio button ON or OFF?

    Because the question is how to validate with Javascript.
  21. JMRKER

    Testing a radio button ON or OFF?

    Then why not ask in the PHP forum?
  22. justsomeguy

    cookie coding

    I wouldn't call that "strange", just uninformed. Saying that you need to send output before particular HTML tags would imply that PHP treats output different depending on what you're outputting, and it does not. That should be obvious. Also, the PHP manual does not say "put it before the <html> tag", it says this (emphasis mine): It does not characterize the output. ALL output. Yeah, in general, they do. They also claim to have a "complete" PHP function reference, which is obviously not true if you compare theirs with the actual PHP reference. No, cookies take up a handful of bytes in the request/response. Setting new cookies on every response isn't going to be a bottleneck. "The introduction of output_buffer" was 18 years ago. The w3schools developers are not the only ones with years of experience, some of us here even have computer science degrees, jobs as CTO, and 15+ years of experience working with server-side languages, and we understand things like the fact that output buffering is disabled by default and in general is rarely used other than in niche situations where you need to collect a bunch of data in the response buffer, then read it out the buffer and clear the buffer, and deliver a different response. Scripts that are meant to be shared should not rely on output buffering, in fact there is a whole series of functions to control the runtime behavior of the buffer. At a bare minimum, if they are showing examples of sending headers in the middle of output (which is a bad practice in general - it violates separation of concerns to be sending output before you know what the code even needs to do) then the examples should also show code on the top, before the output, calling ob_start. It's just a bad example, it's not going to work with a default PHP installation or the most popular web host configurations.
  23. justsomeguy

    How to Replace an Insert from Another Insert

    I don't understand the question. Replacing the contents of any element on the page is the same regardless of the content you're replacing it with. Methods of replacing content in an element do not change based on the content. I don't know if you're referring to appending content instead of replacing.
  24. DILEMMA: Visitors to the mainpage of my website can fill the middle section of the page from the page's navigation bar in either of two ways. Both ways employ Javascript: one, copy a div already on the page into another div on the same page; and two, copy the contents of a div on a another page into same. What I would like to do now is to copy the contents of a div already on the page with a call from the contents of a div that was previously on another page. QUESTION: How does one get a div to replace its own content when the div whose contents needs to be replaced has been filled with content from another page? Roddy
  25. dsonesuk

    cookie coding

    It seems with the introduction of output_buffer this is no longer true, and probably why w3schools developers with their years of experience, decided to ignore this rule as its no longer relevant for their setcookie() examples.
  26. westman

    cookie coding

    In my last topic i opened It was advised to have a new cookie and never use the same one. At the moment my code is setting a new cookie with each page view after being logged in. Is this too excessive?
  27. westman

    cookie coding

    Hi Foxy, Thank you very much for your contribution. I was really quite advance for me but I am sure it wasn't lost on others. In the end I added one more line of code to fix the problem - It probably didn't fix the problem but no errors are show to the page and the cookie gets killed. if (isset($_GET['active'])) { $active = $_GET['active']; if ($active == "logout"){ if(isset($_COOKIE["username"])){ setcookie("username", '', strtotime( '-5 days' ), '/'); } session_destroy(); echo "<script>setTimeout(\"location.replace('http://mysite.com')\",1000)</script>"; exit(); } } as you can see a just added "exit();"
  28. iwato

    Disable $.colorbox for Mobile Devices

    With the exception of the American public, not everyone is intentionally stupid. I try not to punish people for their ignorance. Nature will do that on its own accord. In any case, it appears that I have resolved the need for zoom by setting the minimum width of the acceptable viewport to wider than the height of the viewport of the smallest smartphone. This pretty much insures that enough of the splash panel will be made visible so that it can be easily eliminated, if it gets in the way. Roddy
  1. Load more activity
×