Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Everything in the W3Schools Javascript reference is native JS and not code from a library.
  2. That's just the client-side part, it will not work properly without server-side code to handle some of the data. I'm quite sure you would not be allowed to copy their TryIt editor, that would not fall under their fair use categories. https://www.w3schools.com/about/about_copyright.asp Certainly you're allowed to build your own online code editor from scratch.
  3. If you want to add dates you have to use the date and time functions. Personally, I'd store start and end dates and ignore the duration, but it all depends on how you intend to select data later on. This syntax looks like it's creating a virtual table and naming it "Processes" FROM (SELECT '2018-01-22 09:00:00' as st, '0000-00-00 00:05:00' as dt) Processes; If you want to create your own values to insert, then don't use the INSERT...SELECT syntax, instead use INSERT...VALUES
  4. Does your second query make use of data from the first query?
  5. Ingolme

    Drop down menu

    The <select> element creates a dropdown. If you're looking for something more complicated, then describe it in more detail.
  6. Seeing as it's outputting an HTML page in the browser, you can use CSS to style the links to look like buttons. The links that it is providing will only work inside your local network because it is using a local IP address. I can't see the pastebin link because it's asking me to create an account. If the code is not too long, you can use the codeblock button to paste it here.
  7. You just changed your code from Javascript to jQuery, the impression I got was that you had found a jQuery solution. To make the original code work for class attributes instead of content, just replace innerHTML for className. function search() { var input, filter, ul, li, a, i; input = document.getElementById("myInput"); filter = input.value.toUpperCase(); ul = document.getElementById("myUL"); li = ul.getElementsByTagName("li"); for (i = 0; i < li.length; i++) { a = li[i].getElementsByTagName("a")[0]; if (a.className.toUpperCase().indexOf(filter) > -1) { li[i].style.display = ""; } else { li[i].style.display = "none"; } } }
  8. You can changing the size of the surface of the canvas by changing its width and height properties using Javascript. After this, though, you will need to call the drawImage() function again since resizing the canvas also clears its content.
  9. Everybody uses a CMS. The only difference is whether the CMS is created by a third party (like Wordpress) or is custom built by the same team that owns the website.
  10. $highmark is a string. Do not implode $highmarks.
  11. Where did you use the max() function?
  12. Ingolme

    meaning of *{

    It's just "*", the "{" is the opening brace for the rule set.
  13. That will probably work, considering that HTML parses all entities before executing anything. Alternatively, you can just escape double quotes with a backslash. echo "<div class='contframeturn' onclick='matchshow(\"$matchID\")'>";
  14. No, the main problem is that the number is too large for Javascript to represent it correctly. Pass it in as a string instead by wrapping it in quotation marks, like this: matchshow("151636871863316991")
  15. Where is the function being called? You can't fix this from inside the function, you have to fix it in the code that's calling the function. The number is likely much too large for Javascript to represent. Converting it back to a string after the precision was lost is not going to recover the lost precision. This is not valid syntax, so it's not going to work. function matchshow(string($sids)) {
  16. Is your Javascript code accessing existing elements on the page?
  17. It seems that in some cases, the variable is being passed over from the previous loop iteration because one of the fields is an empty string and you're not initializing it inside the loop. You also are initializing $highmarkth as an array but the converting it to a number. Perhaps this may suit your requirements better: $highmark = []; for ($i = 0; $i < $highmq->num_rows; $i++) { $rows = $highmq->fetch_assoc(); // Initialize theory and practical marks $highmarkpr = 0; $highmarkth = 0; $data = explode("#", $rows['marktheory']); if(isset($data[2])) { $highmarkth = (float) $data[2]; } $data = explode("#", $rows['markpractical']); if(isset($data[2])) { $highmarkpr = (float) $data[2]; } // Sum the two and add the result to the list of high marks $highmark[] = $highmarkth + $highmarkpr; } echo implode(',', $highmark); For security you should be using prepared statements if you have variables in the query.
  18. Can you provide an example of what is in the marktheory and markpractical fields?
  19. Where did that string come from? Information has been lost and is irrecoverable, you have to get the missing information from the original source that created the string.
  20. That can be done by setting the right widths, floating the elements left or right and making use of box model properties. My guess is that nobody's stepped up to do it because the layout requires writing a considerable amount of code. Your first layout has three rows. The first row has just one item, the second row has three and the third row has two. Each of the rows can be built with a structure like this: <div class="row"> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> </div> I would advise that you use class names that better describe the content within the elements, but since I don't know anything about your website I have to go with something generic like "row" and 'item" In your CSS, you would set the width of the items in the row to the percentage they should occupy. Since this example row has three items, they should be 33.33% wide. .item { float: left; width: 33.33%; } Finally, since elements with the "float" property aren't used to calculate the height of the parent element by default, we use this small piece of code to force the parent to wrap around the children. It creates a pseudo-element that forces itself right below all the child elements and the parent element will wrap around it. .row::after { content: ""; display: table; clear: both; } That's the most basic form of what's referred to as a grid layout. It's more complicated, but if you want gaps between the elements you need to add percentage margins and make sure that the sum of all margins and widths do not exceed 100%. It's also more complicated if you have an unknown amount of elements and you want to fit them into several rows. There are a whole lot of extra things you can do to make the optimal layout for each situation and I don't have the time to write an essay about it.
  21. I don't know where the numbers are being produced. If all you had was a string like this "7474.776.89578.3" it would be impossible to separate the numbers since nobody knows where one number ends and the next begins.
  22. I'd advise that you read the questions carefully before giving answers.
  23. For a popup you can use fixed position and vh units, which refer to percentage of the viewport height. .popup { position: fixed; top: 5vh; height: 90vh; /* Center horizontally */ left: 50%; transform: translateX(-50%); width: 900px; max-width: 95vw; }
  24. Yes, using the technique in the second half of my post, select all rows in the table and use the while() loop to separate it into the four different arrays.
×
×
  • Create New...