callumacrae
-
Posts
89 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by callumacrae
-
-
If you've written your login code correct, you should have a sessions table; just add a column to show when the user was last active. If you haven't got a sessions table, you are not of a level of PHP where you should be writing a login system. They're one of the trickiest things to write, and if you mess them up and get hacked, you will annoy a lot of people.
-
Yeah, you can modify document.title to change the title of the page:
document.title = prompt('Modify the title', document.title);
However, you shouldn't use the prompt function. It's ugly and invasive, and your users will hate you. You should use an input box on your page instead.
-
Regular expressions have the following syntax:
/expression/flags
The two forwards slashes (/) are what makes it a regular expression, just like strings have quotes around them. The expression is the regular expression itself, and the flags are stuff like telling the regular expression to be global ("g" is the modifier, not "/g"). I would recommend disregarding the w3schools regex ref you linked to, it isn't very good.
- 1
-
Ask them to enable it for you. Ask them why not. Change hosting provider.
-
Brown!With pigment, if you mix all colors you get black. -
It's not a long string of alerts, it's even worse; it is fix one field, get new error message when submitting for, fix the next field, etc.Also important, you never call the validate function. It has to be called from within reply_click. As it is, all that code does nothing. I don't see why you need the internal function anyway, if that's where most of the code is going to be. BTW, your users are going to hate you for making them sit through a potentially long string of alerts. Changing the innerHTML of a label next to the invalid item, or causing a red dot to appear next to the invalid item, is much more user friendly. -
No, that wouldn't do it. JSON.stringify has its own error message for cyclic structures, and it is also a TypeError.That error usually means that you have recursive functions that aren't stopping recursing, and it's almost always a programming or logic error. You might be trying to JSON-encode the window or document object, for example, that would do it (they link to each other). I've never hit the maximum stack size in a situation where I didn't make a mistake. The page took 6.7 seconds for me to load, but every request has significant latency. That usually means the connection to the server is too slow. -
Again, that's a silly and unrealistic example. A practical example which is similar to that would be to insert an image before every external link warning the user that they would be leaving the site:
img:not([href^="http://example.com"],[href^="/"]):before { content: url('./imgs/external.png');}
Note: You should not use gifs, either.
-
It is our responsibility as experienced developers to ensure that less experienced developers do not develop habit habits or make the same mistakes we did. The amount of time I have spent searching for incorrectly spelled variables... I did not "flog" him, merely pointed it out.callumacrae, I think everyone welcomes a seasoned developer on the board. But there are some matters you may wish to hold back on until you've absorbed more of the spirit of the board, who we are, and what the members are looking for. -
What?Do you know why we have conventions on variable naming? I'll give you a clue: it isn't to make the code pretty.it doesn't really matter if it is spelled wrong, per se. if it is spelled the same way all the way throughout the code (as in his example) then it wont cause any errors. If you're just out to be the spelling/grammar police, then do so more gracefully, since it's just a programming forum and there are no rules to how your actually name your variables, other than the required syntax of the language. -
OP originally posted a huge block of code with no whitespace, but has now edited it down to two seemingly irrelevant lines.as replied, what's the problem? Where is your javascript code? What are you stuck on? -
Test
in HTML/XHTML
You don't need a test. Just make a website and run it through the validator.
-
What specifically is going wrong here? Could you provide a minimal case so that I don't have to work through all your code to find out what the problem is myself.
-
Yes.I don't like writing short replies, but there is seriously nothing more I can say here.
-
Test
in HTML/XHTML
What do you mean? Do you mean something like unit tests?
-
Test
in HTML/XHTML
What?
-
You shouldn't use the onclick attribute to add events, you should use the addEventListener function (and possibly .attachEvent if you want support for oldIE).Finally I made it (reset input date)!_________________________________________________________________________________________________________ // Here is my code: <script type="JavaScript"> function reset() { // Creat date datatype variable and set it to null value var a=new Date();a.setFullYear(0,0,0); // Get input date element and insert the variable a var b=document.getElementsByName("name")[0];b.value=a; } <script> <input type="date" name="date"> <button onclick="reset()">Reset Date</button>_________________________________________________________________________________________________________ @dsonesuk: Thank you for http://w3schools.com...ef_obj_date.asp @niche: Thank you I found out that innerHTML is only for changing text inside of an element. -
Don't use tables for layout. Don't use tables for layout. Don't use tables for layout. I can't look at your code right now, but if nobody has given a full answer by the time I get back, I will.
-
I'm Callum Macrae. I've written a book on JavaScript and have been working as a front-end developer for a good few years now. I want to see if I can improve w3schools.
-
It tells the search engine that a link is for navigating about the site, and so helps more of your site be relevantly indexed.
-
CSS3 linear
in CSS
A linear gradient is a gradient which starts of at one colour, and then fades to another colour at a linear speed across the element:What is CSS3 linear? Thanks.- 1
-
I can't remember where I learned this stuff from, but I imagine that if you buy a good CSS book, it will cover it. I would recommend CSS3: The Missing Manual or CSS: The Definitive Guide. Pretty much any O'Reilly book would do the trick, though.
-
The validator doesn't always output the code exactly as it was (or it sometimes messes up the whitespace).The particular line looks OK. There probably is something wrong on the previous line of code. -
That's not a problem at all, most developers do it on a fairly regular basis. If you specifically aim to not use IDs and classes on the same elements, you will end up with either some very messy CSS, or some really messy HTML.
convert javascript code to Flowchart ?
in JavaScript
Posted
There's nothing automatic because it's a stupid thing to do. There are plenty of free flowchart solutions, though.