javascript

jQuery Color **Swatch** Picker

Has anyone coded up a jQuery query color picker that lets you pick colors from a predetermined list of colors? Something like a product color picker on an Ecommerce site. Most of the searching I've done reveals a lot of general purpose, pick-any-color-in-the-rgb-spectrum, but few options for picking specific colors. ...

Javascript syntax error

Update: I tried a version of the script without the "beforeContentUpdate" part, and this script returns the following JSON {"COLUMNS":["TNAME","TBRIEF","GAMEID","TITLEID","RDATE","GNAME","PABBR","PNAME","RSCORE","RNAME"], "DATA":[["Dark Void","Ancient gods known as 'The Watchers,' once banished from our world by superhuman Adepts, have ...

JQuery/JavaScript div tag "containment" approach/algorithm?

Background: I've created an online circuit design application where div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). I've searched JQuery and I don't see any built-in routine ...

What are some javascript practices I should avoid for good SEO

So I would like to know some things I should avoid doing in javascript for good SEO rankings. In my next site I will use jquery and javascript extensively but do not want to sacrifice SEO. So what do you think I should avoid doing? ...

Javascript: Whitespace Characters being Removed in Chrome (but not Firefox)

Why would the below eliminate the whitespace around matched keyword text when replacing it with an anchor link? Note, this error only occurs in Chrome, and not firefox. For complete context, the file is located at: http://seox.org/lbp/lb-core.js To view the code in action (no errors found yet), the demo page is at http://seox.org/test....

Finding the last focused element

I'm looking to determine which element had the last focus in a series of inputs, that are added dynamically by the user. This code can only get the inputs that are available on page load: $('input.item').focus(function(){ $(this).siblings('ul').slideDown(); }); And this code sees all elements that have ever had focus: $('input.it...

Has anyone used Coffeescript for a production application?

Coffeescript looks pretty cool. Has anyone used it? What are its Pros & Cons? ...

HTML5 <video> callbacks?

I'm working on a site for a client and they're insistent on using HTML5's video tag as the delivery method for some of their video content. I currently have it up and running with a little help from http://videojs.com/ to handle the Internet Explorer Flash fallback. One thing they've asked me to do is, after the videos finish playing (t...

Envoking mouse capturing function onmousedown?

I have the following: <html> <script type="text/javascript"> document.onmousemove = getCursorXY; function getCursorXY(e) { document.getElementById('cursorX').value = (window.Event) ? e.pageX : event.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrol...

how to find hidden information

hye im newbie here.. im looking for a hidden information in a source code.. for example the code is var d=document.getElementById('phoneSpan0');d.innerHTML+=0?'0':'0';d.innerHTML+='3';d.innerHTML+=0?'5':'-';d.innerHTML+=1?'7':'0';d.innerHTML+=0?'8':'9';d.innerHTML+='6';d.innerHTML+='8';d.innerHTML+=String.fromCharCode(19+30);d.inn...

JavaScript: get the current executing <script> node?

Hi, I need to know if it is possible the current execution node? Example: ..html <script id="x"> console.log(document.currentNode.id); // << this must return "x" </script> ..html Thanks! ...

How can I design a custom control in Javascript (possibly using jQuery)

I'd like to create a custom control in javascript. The goal is to create a building block that has methods, properties and events and render into a div. An example of one such control would be a calendar. It would render into a div, it would have properties that would define how it's displayed and what date is selected or highlighted, i...

Help with php custom popup

Hi i have create a custom popup using javascript to use in PHP file. thw popup will appear when user click My Special Website i need to change the title header. Can help me how to do it?? //function: function myPopup() { window.open( "<?=$CFG->wwwroot.'/example.php';?>" ,"myWindow", " height = 300, width = 600, statusbar=0, scrollbars=...

How to implement 2 rows and width to fit in the column in web development?

<td style="width:230px;overflow:hidden;"> <?php echo $something; ?> </td> What I'm doing is to cut $something to 2 rows at most,and add ... when necessary, but this kind of requirement seems clue less when trying to implement, Solutions within the scope of php/javascript/css are appreciated! anyone has ideas? ...

Difference between jQuery click, bind, live, delegate & trigger functions( with example)

Hello All, I know there are a lot of questions similar to this, but I want to know clear difference between all of these jQuery functions together on this page with an example, so that it will be very helpful for me to understand the mechanism of all of these functions. I have also read the reference on jQuery main site, but there is n...

Modifying jQuery ajax request Connection header

I'm trying to modify the Connection header with the following code with no success jQuery.ajax({ url: URL, async: boolVariable, beforeSend: function(xhr) { xhr.setRequestHeader("Connection", "close"); } }) The request headers via Firebug show: Connection keep-alive X-Requested-With XMLHttpRequest...

Execute PHP without leaving page

Okay. I have a form - textarea (named "su") and submit button. When the form is submitted, I need to run a PHP script without refreshing/leaving page "echo" or somehow print a return on the screen I'm pretty sure this works via some kind of ajax request thing. but I have no idea what I'm talking about. I'm not big on ajax or javasc...

facebook javascript sdk fb_xd_fragment??

Hi guys, I am using the facebook javascript sdk to embed a like button in my page. What is fb_xd_fragment??? I see it appends to the end of my url like http://www.mysite.com/controller/?fb_xd_fragment, and this is causing some nasty recursive reload of the page. Cheers James ...

Website: Make printable version with footnotes?

I have a website that uses editable divs so that a user can modify or make notes to a text. Is there a way I can have the website generate a pdf or some printable document with footnotes, such that if a user has this: <div class="text" id="text_1"> <div class="bodyTest">This is the body text</div> <div class="notes">These are th...

Different actions on multiple Keydown event

Okay, so my question (im hoping) is fairly simple. I want to know what to do so that I can create different events for the same keycode. For instance Id like to fade out a div and fade a new one in on the first keypress, then fade that one out and fade a new one in on keypress. Thanks! $(document).keydown(function() { if (event.keyCo...