-
Posts
14,901 -
Joined
-
Last visited
-
Days Won
177
Content Type
Profiles
Forums
Events
Everything posted by Ingolme
-
You can use Javascript. Give each of the elements an ID, get a reference to those elements in Javascript using document.getElementById(). When either of the two radio buttons changes, set the textbox required property to true or false depending on which radio button is currently checked.
-
how to embed line break and double space in array string
Ingolme replied to W3_Bill's topic in JavaScript
CSS wouldn't help for that particular case. You can use .- 4 replies
-
- line break
- double space
-
(and 1 more)
Tagged with:
-
It sounds like the server is returning an error message instead of JSON. Run this line first and see what it shows in the console: console.log( "ResponseText: " + data);
-
The return statement says this: return oParent.children[i - 1]; oParent is the parent node, children is a list of child nodes, [i-1] is an index in the children list. It's not hard to figure out what is being returned. Have you looked at the objects and arrays tutorial pages?
- 8 replies
-
- 2
-
- javascript
- dom
-
(and 2 more)
Tagged with:
-
The console should have a description of the error. What does it say?
-
how to embed line break and double space in array string
Ingolme replied to W3_Bill's topic in JavaScript
You can set innerHTML instead of textContent and then it will interpret <br> tags properly. Additional spaces can be added with " " but I would advise against it. You should use CSS to style the text. You can set the text-indent property to push the text further in. In HTML whitespace is ignored so that you can indent the code without all of the indentation showing up on the rendered page.- 4 replies
-
- line break
- double space
-
(and 1 more)
Tagged with:
-
In the piece of code you provided oNode is not defined, so this code doesn't actually do anything. Assuming that oNode is actually a reference to a DOM node, I'll break it down for you: // Get a reference to the parent of the node var oParent=oNode.parentElement; // Find out how many nodes are children of that parent var iLength=oParent.children.length; // The variable i starts at zero and increases by one each time the code loops // The loop ends when i is equal to the number of children in the parent of oNode for(var i=0;i < iLength;i++){ // If the node with index "i" is oNode then run the code between the braces if(oParent.children[i]==oNode) { // Return the element node with an index of one less than the oNode's index return oParent.children[i - 1]; // Exit the loop break; } } The function could be further improved if you could actually pass oNode as a parameter to the function, and it doesn't account for oNode being the first child in its parent.
- 8 replies
-
- 2
-
- javascript
- dom
-
(and 2 more)
Tagged with:
-
navigate within index.html using cordova and phonegap
Ingolme replied to abdallaham's topic in HTML/XHTML
The only way to do it without loading a new page is with Javascript. You can hide one element and show another when the link is clicked. You should read the Javascript tutorial, it is simple to add a click event listener and change the style.display property of an element.- 1 reply
-
- cordova
- javascript
-
(and 2 more)
Tagged with:
-
This is a misuse of prepared statements, don't ever put a variable inside a query string. This code will do what you're asking // Returns true if it exists, false otherwise function value_exists($var) { $stmt = $con->prepare('SELECT 1 FROM table WHERE col1 = ? LIMIT 1'); $stme->execute(array($var)); return !!$stmt->fetch(); }
-
There's no choice, really, there's only one way to do responsive design. You use flexible units like percentages and use media queries to rearrange things on different screen sizes.
- 1 reply
-
- 1
-
That's not all of your code. I suspect you're printing out $data somewhere else. You have an unnecessary else statement, just remove that from your code. You can simplify your function to just this: function check_subdomain($data){ return preg_match("/^(?:[A-Za-z0-9][A-Za-z0-9\-]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$/", $data); }
-
New to me - what are these unique identifier code?
Ingolme replied to tylersprayman@gmail.com's topic in HTML/XHTML
I would say it's just there to prevent browsers from using the cached version of the file after a change has been made to the CSS or Javascript, I suspect it's probably a hash of the file contents. It's not required for the file to load. css3366.css is the name of the file. To me it looks like these files and the HTML were generated by a content management system. -
Mouse over on hyperlink that shows what was selected on previous page
Ingolme replied to mldardy's topic in JavaScript
You can't put a <script> tag in a <title> tag, and the Javascript should not be run on the server, it has to run on the client. Remove runat="server" from the HTML. -
Maybe one of the ads on the page is doing that.
- 5 replies
-
- refresh
- w3schools site
-
(and 1 more)
Tagged with:
-
W3.CSS just changes the appearance of the pagination buttons. The href="#" are example links that don't do anything. Usually for pagination, you will have PHP generate a set of links with query strings attached, such as <a href="?page=1"> or <a href="?offset=20"> and then use the data passed in the $_GET array to query for certain results from a database. There are plenty of pagination tutorials for PHP. https://www.google.ca/?q=php+pagination+tutorial
-
Just change the value of the list-style-type property.
-
Mouse over on hyperlink that shows what was selected on previous page
Ingolme replied to mldardy's topic in JavaScript
Javascript can use the web storage API, but I would recommend doing it on the server-side, with a language like PHP. PHP has the $_SESSION system. -
But your framework, as it is now, still requires the developer to write the code. You probably should change your framework to use classes and data attributes, because most developers are concerned about valid HTML. Valid HTML helps screen readers read HTML pages and helps improve search engine rankings. Have you thought about how the website might look if Javascript is disabled? If you have a source that says custom elements are valid in HTML 5 I'd like to read about it. To my knowledge so far, HTML 5 only allows custom attributes using the data- prefix.
-
There are no conditions, no credit required or anything. The library is free and open.
- 7 replies
-
- CSS
- Stylesheet
-
(and 1 more)
Tagged with:
-
I think drupal has an option to change the HTML of the items you're displaying, but if you can't do that, you can set the display property of the elements to "list-item". .field-items { padding-left: 30px; } .field-item { display: list-item; list-style-type: disc; }
-
I'm using Firefox on Windows 8.1. There's a problem with the core foundation of your framework: It encourages writing invalid HTML. Custom elements are not valid. Back in the days of XHTML (the "X" stands for "eXtensible") you were technically allowed to use custom elements by using namespaces or a custom DTD (though it was not well supported by browsers), but this doesn't work in HTML 5. If you want to make this framework compatible with HTML 5 you have to do two things: Use classes instead of element names (for example <div class="tcount"></div>) Use data- attributes (<div class="tcount" data-start="1900"></div>) This brings another issue with your framework: It's adding unnecessary overhead. Instead of going through your framework like this: var tcount = ted.define("tcount", ["start"]); ted.create(tcount, function( start ) { start = parseInt( start ); var THIS = this; if (start > 0) { setInterval(function() { THIS.html( tedApi.SecToTime(start--).string ); }, 1000); } this.show(); }); The developer can take a shortcut and write the code directly for the element itself: var tcounts = document.getElementsByClassName("tcount"); for(var i = 0; i < tcounts.length; i++) { (function(element){ var start = Number(element.getAttribute("data-start")); var interval = setInterval(function() { if(start <= 0) { start = 0; clearInterval(interval); } element.innerHTML = formatTime(start--); }, 1000); })(tcounts[i]); } function formatTime(seconds) { var h = Math.floor(seconds / 3600); h = h < 10 ? "0" + h : h; var m = Math.floor(seconds/60) % 60; m = m < 10 ? "0" + m : m; var s = seconds % 60; s = s < 10 ? "0" + s : s; return h + ":" + m + ":" + s; } That's slightly longer than your framework's code, but that's because a function was created to replace SecToTime(). The define() and create() methods of your framework are overhead.
-
It looks like the <br /> is just part of the error message and not the cause of the problem. If your document is saved as UTF-8 with a byte order mark (BOM), the BOM will be sent to the client before any of the PHP starts running, which would cause that issue. I'm not sure if Windows notepad adds the byte order mark or not, notepad is not the ideal environment to write code in. Aside from that, make sure there are no line breaks, tabs or spaces before the opening <?php tag.