Jump to content

smus

Members
  • Posts

    177
  • Joined

  • Last visited

Everything posted by smus

  1. I am not familiar with classes, so I need a solution, or, at least, a clue, please! This code causes the error: TypeError: Cannot read property 'vendor' of undefined When I am trying to check its correctness, the interpreter also informs that the context is not bound to the 'getInfo' method. How can we correct classes in order to avoid the error? class Transport { constructor(type, price, vendor, model) { this.type = type; this.price = price; this.vendor = vendor; this.model = model; } getInfo() { return `${this.vendor}, ${this.model}`; } getPrice() { return this.price + '$'; } } class Car extends Transport { constructor(vendor, model, doorsCount, price) { super('car', price, vendor, model); this.doorsCount = doorsCount; } getDoorsCount() { return `Number of doors: ${this.doorsCount}`; } } class Bike extends Transport { constructor(vendor, model, maxSpeed, price) { super('bike', price, vendor, model); this.maxSpeed = maxSpeed; } getMaxSpeed() { return `Max speed: ${this.maxSpeed} kmh`; } }
  2. Got it: ul:nth-child(2) li:nth-child(even){ background-color: #996666; } 2 is because there is another <div></div> tag before all the <ul>s. So, in this case, first <ul> is the second child of the <body>
  3. You just need to deactivate what is written for :hover in CSS file. Try looking for it inside your style.css file for your active WP theme. It should be in the WP theme folder
  4. <ul class="cards"> <li class="two heart"></li> <li class="five diamond"></li> <li class="ten heart"></li> <li class="jack club"></li> <li class="queen spade"></li> <li class="king diamond"></li> <li class="ace heart"></li> <li class="six heart"></li> <li class="seven diamond"></li> <li class="eight spade"></li> <li class="nine club"></li> <li class="three club"></li> <li class="four heart"></li> </ul> <ul class="cards"> <li class="five spade"></li> <li class="six diamond"></li> <li class="seven spade"></li> <li class="eight club"></li> <li class="two diamond"></li> <li class="three heart"></li> <li class="four club"></li> <li class="queen club"></li> <li class="king spade"></li> <li class="seven diamond"></li> <li class="nine heart"></li> <li class="ten diamond"></li> <li class="jack heart"></li> </ul> <ul class="cards"> <li class="two spade"></li> <li class="ten heart"></li> <li class="ace club"></li> <li class="five heart"></li> <li class="nine diamond"></li> <li class="king diamond"></li> <li class="ace spade"></li> <li class="six heart"></li> <li class="eight diamond"></li> <li class="ace spade"></li> <li class="queen heart"></li> <li class="three diamond"></li> <li class="four spade"></li> </ul> <ul class="cards"> <li class="king heart"></li> <li class="jack club"></li> <li class="two club"></li> <li class="three spade"></li> <li class="four diamond"></li> <li class="ten club"></li> <li class="jack spade"></li> <li class="eight diamond"></li> <li class="nine spade"></li> <li class="queen diamond"></li> <li class="five club"></li> <li class="six club"></li> <li class="seven heart"></li> </ul> How can we call to all even <li> inside the first <ul>? I tried something like: li:nth-child(even) ul.cards:first-child{ background-color: #996666; }
  5. Since there is no 'NodeJS/MongoDB' discussion section I decided to post my question to 'JavaScript'. I am trying to start the server by running mongod.exe, and by doing the same thing using cmd. I want to start the server and use it with a tool called Robo 3T to manipulate NoSQL databases. There is no active connection can be seen in Robo 3T after I start mongo. Can anyone explain what I am supposed to do? What is the correct way to run MongoDB on Windows?
  6. document.getElementById("demo").innerHTML = days + "d " + hours + "h " + minutes + "m <span style='color:red'>" + seconds + "</span>s "
  7. Have you tried an <object> tag as a container for your page?
  8. Yes, you can, by using pure CSS (not necessarilly with W3.css). Try something like this: <style> .label:after{ content:'text I want to change'; } .label:hover:after{ content:'changed text'; } </style> <body> <p>text <span class="label"></span> text</p> </body>
  9. The page already goes with <style>section{display:none}</style> written in it. Adding and removing classes won't influence it. I also tried section.style.display='unset' which provides the same result as 'initial', and section.style.display=' ', but it does not work at all. As it is discussed here: https://stackoverflow.com/questions/18534561/what-is-use-of-initial-value-in-css 'initial' only resets to a CSS default, not to a browser default. And they only plan to add something in CSS4. While we are waiting the only reasonable way I thought about is to check each element if it is actual initial style property is 'block' or not, before switching it back from 'display:none'. Something like: if(element.tagName == 'div'){element.style.display = 'block'}... ☺️
  10. Very helpful, thanks! display = "initial" works, however, it changes the style not to display = "block" (which is default one for <section> tag), but to display = "inline". I wonder what the result would be if we do the following: <style> section{display:none} </style> <script> document.getElementsByTagName('section')[0].style.display = 'block' document.getElementsByTagName('section')[0].style.display = 'initial' </script> will it switch back to display = 'inline'? If so, why?
  11. For example, an element's default value is 'inline'. It was as 'display:block' on my page, but now it is hidden by 'display:none'. I want it back to visible again, but to its default state. I tried element.style.display = "", element.style.display = "auto", as well as element.style.removeProperty = "display", as it is described here: https://stackoverflow.com/questions/21457904/change-element-display-none-back-to-default-style-value-js But it could not be changed from 'display:none' (only by using 'display:block') There is an official list of default style properties, like, for example, this one: https://www.w3schools.com/cssref/css_default_values.asp but is there a way to get it by JavaScript?
  12. Server settings, try absolute address
  13. For the default value, you should simply add value="yourdefaultvalue" to your input tag. What do you want to display "LHS,RHS" in your code, when datalist is set to "initial or awlays"?
  14. var pageBreak = document.getElementById("pageBreak") All var declarations must be inside the function
  15. vmars316, not working at all or with errors? Looks like collectedTextareas variable was not initialized
  16. Thanks very much for the idea! Used this function for sorting the array: function arraysort(s) length = ubound(s) for i = 0 to length for j = 0 to length if s(i)<s(j) then t = s(i) s(i) = s(j) s(j) = t end if next next arraysort = s end function
  17. You mean I place them in an array, sort the elements as I want and display them in that order? That makes sense. Because now it only iterates through the folders and prints it out as it was returned from the file system.
  18. <%@LANGUAGE="VBSCRIPT"%> <% Option Explicit On Error Resume Next ' this section is optional - it just denies anonymous access ' If Request.ServerVariables("LOGON_USER")="" Then ' Response.Status = "401 Access Denied" 'End If ' declare variables Dim objFSO, objFolder Dim objCollection, objItem Dim strPhysicalPath, strTitle, strServerName Dim strPath, strTemp Dim strName, strFile, strExt, strAttr Dim intSizeB, intSizeK, intAttr, dtmDate ' declare constants Const vbReadOnly = 1 Const vbHidden = 2 Const vbSystem = 4 Const vbVolume = 8 Const vbDirectory = 16 Const vbArchive = 32 Const vbAlias = 64 Const vbCompressed = 128 ' don't cache the page Response.AddHeader "Pragma", "No-Cache" Response.CacheControl = "Private" ' get the current folder URL path strTemp = Mid(Request.ServerVariables("URL"),2) strPath = "" Do While Instr(strTemp,"/") strPath = strPath & Left(strTemp,Instr(strTemp,"/")) strTemp = Mid(strTemp,Instr(strTemp,"/")+1) Loop strPath = "/" & strPath ' build the page title ' strServerName = UCase(Request.ServerVariables("SERVER_NAME")) strTitle = "sitelist" ' create the file system objects strPhysicalPath = Server.MapPath(strPath) Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(strPhysicalPath) %> <html> <head> <title>The list of websites available</title> <base target="blank"> <style> BODY {background: hsl(24, 100%, 70%); } a {text-decoration:none;} a:hover {color:darkred;font-weight:600;} a:active {text-decoration:none;} </style> </head> <body class="w3-container"> <br> <h2 align="center"><%=strTitle%></h2> <div align="center"><center> <table border="0" cellspacing="0" cellpadding="2" style="BACKGROUND: #000000; width:70%"> <!-- <tr> <th align="left">Name</th> <th align="left">Bytes</th> <th align="left">KB</th> <th align="left">Attributes</th> <th align="left">Ext</th> <th align="left">Type</th> <th align="left">Date</th> <th align="left">Time</th> </tr> --> <% '''''''''''''''''''''''''''''''''''''''' ' output the folder list '''''''''''''''''''''''''''''''''''''''' Set objCollection = objFolder.SubFolders For Each objItem in objCollection strName = objItem.Name strAttr = MakeAttr(objItem.Attributes) dtmDate = CDate(objItem.DateLastModified) %> <tr> <td align="center" style="background: hsl(60, 100%, 75%);COLOR: #000000;font-family:courier;font-size:20px;"><a class="link hvr-underline-from-center" href="<%=strName%>"><%=strName%></a></td> <!-- <td align="right">N/A</td> <td align="right">N/A</td> <td align="left"><tt><%=strAttr%></tt></td> <td align="left"><b><DIR></b></td> <td align="left"><b>Directory</b></td> <td align="left"><%=FormatDateTime(dtmDate,vbShortDate)%></td> <td align="left"><%=FormatDateTime(dtmDate,vbLongTime)%></td> --> </tr> <% Next %> <!-- <% '''''''''''''''''''''''''''''''''''''''' ' output the file list '''''''''''''''''''''''''''''''''''''''' Set objCollection = objFolder.Files For Each objItem in objCollection strName = objItem.Name strFile = Server.HTMLEncode(Lcase(strName)) intSizeB = objItem.Size intSizeK = Int((intSizeB/1024) + .5) If intSizeK = 0 Then intSizeK = 1 strAttr = MakeAttr(objItem.Attributes) strName = Ucase(objItem.ShortName) If Instr(strName,".") Then strExt = Right(strName,Len(strName)-Instr(strName,".")) Else strExt = "" dtmDate = CDate(objItem.DateLastModified) %> <tr> <td align="left"><a href="<%=strFile%>"><%=strFile%></a></td> <td align="right"><%=FormatNumber(intSizeB,0)%></td> <td align="right"><%=intSizeK%>K</td> <td align="left"><tt><%=strAttr%></tt></td> <td align="left"><%=strExt%></td> <td align="left"><%=objItem.Type%></td> <td align="left"><%=FormatDateTime(dtmDate,vbShortDate)%></td> <td align="left"><%=FormatDateTime(dtmDate,vbLongTime)%></td> </tr> <% Next %> --> </table> </center></div> <br><br> </body> </html> <% Set objFSO = Nothing Set objFolder = Nothing ' this adds the IIf() function to VBScript Function IIf(i,j,k) If i Then IIf = j Else IIf = k End Function ' this function creates a string from the file atttributes Function MakeAttr(intAttr) MakeAttr = MakeAttr & IIf(intAttr And vbArchive,"A","-") MakeAttr = MakeAttr & IIf(intAttr And vbSystem,"S","-") MakeAttr = MakeAttr & IIf(intAttr And vbHidden,"H","-") MakeAttr = MakeAttr & IIf(intAttr And vbReadOnly,"R","-") End Function %> I am using the code above (in a separate index.asp file) to list all the subfolders in a current folder. It works under IIS and displays the names of all the subfolders (as a hyperlinks to browse to a subfolder). It always sorted them alphabetically (a - z), but now (after folders restoration) it started to add new folders to the bottom of the list, regardless of their name. I've already tried many things: restarted IIS, changed folders attributes etc., but it is the same, however, it works properly on the external webhosting service. What can be wrong? IIS settings? I've changed the file system when I was restoring those folders and files, from NTFS to exFAT, might that be the probable reason?
  19. I am not really into Linux shell system, but if you don't want to use PHP, other server side languages might be the alternative
  20. smus

    Table Sort

    Solved it! I was unattentive to include the additional <span> tag inside <td></td> (for the styles). It sorts normally without it, or with it if we use innerText instead of innerHTML
  21. smus

    Table Sort

    <!-- the table header --> <table class='indextable' align='center'><th onclick='sortTable(this.parentNode.parentNode,0)'>Subject</th><th onclick='sortTable(this.parentNode.parentNode,1)'>Questions</th><th>Edit</th> <!-- the javascript function --> <script> function sortTable(t,n) { var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0, intx, inty; table = t;//document.getElementsByClassName("indextable")[0]; switching = true; // Set the sorting direction to ascending: dir = "asc"; /* Make a loop that will continue until no switching has been done: */ while (switching) { // Start by saying: no switching is done: switching = false; rows = table.rows; /* Loop through all table rows (except the first, which contains table headers): */ for (i = 1; i < (rows.length - 1); i++) { // Start by saying there should be no switching: shouldSwitch = false; /* Get the two elements you want to compare, one from current row and one from the next: */ x = rows.getElementsByTagName("TD")[n]; y = rows[i + 1].getElementsByTagName("TD")[n]; /* Check if the two rows should switch place, based on the direction, asc or desc: */ if (dir == "asc") { if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { // If so, mark as a switch and break the loop: shouldSwitch = true; break; } } else if (dir == "desc") { if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) { // If so, mark as a switch and break the loop: shouldSwitch = true; break; } } } </script>
  22. smus

    Table Sort

    What I am doing is that I am only adding the condition. If it is the second row of the table (n==1), convert the x.innerHTML to an integer value using parseInt or Number. It does not react onclick, but the first row keeps on sorting the values out.
  23. smus

    Table Sort

    Here's the code: <!-- the table header --> <table class='indextable' align='center'><th onclick='sortTable(this.parentNode.parentNode,0)'>Subject</th><th onclick='sortTable(this.parentNode.parentNode,1)'>Questions</th><th>Edit</th> <!-- the javascript function --> <script> function sortTable(t,n) { var table, rows, switching, i, x, y, shouldSwitch, dir, switchcount = 0, intx, inty; table = t;//document.getElementsByClassName("indextable")[0]; switching = true; // Set the sorting direction to ascending: dir = "asc"; /* Make a loop that will continue until no switching has been done: */ while (switching) { // Start by saying: no switching is done: switching = false; rows = table.rows; /* Loop through all table rows (except the first, which contains table headers): */ for (i = 1; i < (rows.length - 1); i++) { // Start by saying there should be no switching: shouldSwitch = false; /* Get the two elements you want to compare, one from current row and one from the next: */ x = rows.getElementsByTagName("TD")[n]; y = rows[i + 1].getElementsByTagName("TD")[n]; /* Check if the two rows should switch place, based on the direction, asc or desc: */ if (dir == "asc") { if (x.innerHTML.toLowerCase() > y.innerHTML.toLowerCase()) { // If so, mark as a switch and break the loop: shouldSwitch = true; break; } } else if (dir == "desc") { if (x.innerHTML.toLowerCase() < y.innerHTML.toLowerCase()) { // If so, mark as a switch and break the loop: shouldSwitch = true; break; } } } </script>
×
×
  • Create New...