I need to open a new window in the background with JavaScript, and make sure the original is still focused

This is known as a ‘pop-under’ (and is generally frowned upon… but I digress).. It should give you plenty to google about You probably want to do something like: var popup = window.open(…); popup.blur(); window.focus(); Which should set the focus back to the original window (untested – pinched from google). Some browsers might block this … Read more

two DIV side by side and aligned vertically at their bottom

See: http://jsfiddle.net/thirtydot/J9eds/ I’ve used display: inline-block combined with vertical-align: bottom. HTML: <div id=”container”> <div id=”left”> left<br />left<br />left<br />left<br />left<br />left<br /> leftleftleftleftleftleft </div> <div id=”right”></div> </div> CSS: #container { border: 1px solid red; float: left; } #left, #right { border: 2px solid red; background: #ccc; vertical-align: bottom; display: inline-block; /* ie6/7 */ *display: inline; … Read more

ReferenceError: Chart is not defined – chartjs

I was also getting same error. To fix this I moved the chart script into separate graph.js file. Still I was getting same error. Which is fixed later when I put tag in following order before end of tag as shown below. <script src=”https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.4.0/Chart.min.js”></script> <script type=”text/javascript” src=”jscript/graph.js”></script> </body> The page look like this: var ctx … Read more

Can div with contenteditable=true be passed through form?

Using HTML5, how do I use contenteditable fields in a form submission? Content Editable does not work as a form element. Only javascript can allow it to work. EDIT: In response to your comment… This should work. <script> function getContent(){ document.getElementById(“my-textarea”).value = document.getElementById(“my-content”).innerHTML; } </script> <div id=”my-content” contenteditable=”true”><a href=”https://stackoverflow.com/questions/7355583/page.html”>Some</a> Text</div> <form action=”some-page.php” onsubmit=”return getContent()”> <textarea … Read more

Why does overflow hidden stop floating elements escaping their container?

It creates a block formatting context. Block formatting contexts are important for the positioning (see float) and clearing (see clear) of floats. The rules for positioning and clearing of floats apply only to things within the same block formatting context. Floats do not affect the layout of things in other block formatting contexts, and clear … Read more

HTML comments within comments?

I think the key point is this: Note that comments are markup. http://www.w3.org/TR/html4/intro/sgmltut.html#h-3.2.4 This is not valid markup: <div <span/> /> … so neither is the one you mention. Since all my sites are written in PHP I normally comment out code with PHP comments: <?/*?> <div>…</div> <p>…</p> <?*/?> Perhaps you can use a similar … Read more

What is the best way to get an element’s tag name in JS?

nodeName is the most consistent here. I would suggest you take a minute and read this post for a few differences and inconsistencies with tagName if you’re more curious as to why. For the prototype part of the question…it’s a JavaScript property, just this.nodeName should work or element.nodeName, whatever your element’s called in the current … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)