javascript

Are defining many JQuery event handlers "expensive?" Internally Implemented at C/C++ or JavaScript level?

I have a long a web form. I'm wondering if I should bind() to each element separately (what I really want) or should I only define one bind() all of the input elements then do an if-then inside the handler to handle the specific element? ...

howto create a new Date() in Javascript from a non-standard date format

hi, i have a date in this format : dd.mm.yyyy when i instantiate a javascript date with it, it gives me a NaN in c# i can specify a dateformat, to say: here you have my string, it's in this format, please make a Datetime of it. is this possible in javascript too, and if not, is there an easy way? i would prefer not to use a substrin...

HTML and jQuery anchoring

Whenever the url contains the div id, it would obviously go down to the div when the URL has: http://domain.com.faq.php#1 <div id="1">Bla bla bla</div> But what I like is to have same feature of Stackoverflow, when you click on an answer in your messages, it will scroll down to the page and has that fadeOut effect on the answer. ...

cycle through list, change style every x seconds

I have a simple slideshow (jQuery Cycle) that displays an image every ten seconds (7 total images). In an adjacent div, I have a list with 7 bullet points. What's the easiest way to script a method in which the css/style of the appropriate bullet point changes as its accompanying image. The idea is to have all list items displayed, but 1...

How to position a div at the bottom of the viewport in standard and in quirks mode ??

Hi, I need to position a div to the bottom of my viewport. I start using position:fixed; bottom:0px; and that work just fine. But the thing that I'm working on gets injected via javascript in different pages. And some of the pages doesn't have a doctype defined, so in IE gets rendered like quircks mode, so the div doesn't get positioned...

JavaScript regex - positive lookahead -- giving me syntax errors

This piece of regex (?<=href\=")[^]+?(?=#_) is supposed to match everything in a href value except the the hash value and what follows it within the href url. It appears to work fine under Regex debuggers/testers such as http://gskinner.com/RegExr/ but in javascript it appears to produce syntax error. If i remove the < from the (?<=) it ...

HTML5 Playlist plays 2 videos, How about 4 or 5?

I'm able to get two videos to play sequentially, (and without pause!) with this code from Apple, (see section 2-4)... http://developer.apple.com/safari/library/documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html ...Yet completely lost as to how to play a 3rd or ...

Make browser to go back by reloading page 1st and then scrolling it back again too

EXPLAINING WHAT I'M TRYING TO SOLVE: I have a webpage (file_list.php) showing a list of files, and next to each file there is a button to delete it. When user press the DELETE button close to a certain file name, the browser goes to a script called delete_file.php that deletes the file and then it tells browser to go back to the file_li...

Delete current row in a <table> with jQuery

I have a table that lists a bunch of customers. The last cell is an ajax delete button. I want the row containing the deleted customer to be deleted through jQuery. <table> <tr><td>Customer info 1</td><td><a href="javascript:deleteCustomer(1);">Delete</a></td> <tr><td>Customer info 2</td><td><a href="javascript:deleteCustomer(2);">Dele...

How to find all javascript on page with php given url?

In php how would I grab all javascript from a page given it's url? Is there a good regular expression to get the src of all javascript script tags or the script inside of them? ...

auto_complete plugin error: Couldn't find Question with ID=auto_complete_for_...

I have successfully set up this plugin before so I am curious as to what I am doing wrong here. I have built the ability for users to add tags to questions. I am not using tagging plugin here but that shouldn't matter for this. With respect to the auto complete, I am trying to have the form located in the /views/questions/show.html.erb...

Javascript Namespace Help

Hi, I have a pretty big Javascript script with loads of global variables & functions in it. Then a piece of code that calls one function from this js file: myfunc(); Ok, now I have cloned this script and modified some functionality, all function prototypes and variables are named the same in both scripts. So now I have two scripts load...

JSpec mock_request() on Chrome

Hi, I have mock_request() calls on my JSpec tests, and they work fine on Firefox, but they break on Chrome because of mock_request... The tests don't even run on Chrome... Does anybody knows how to fix this? Thanks, Lucas ...

What is the java equivalent to javascript's String.fromCharCode?

What it the java equivalent of javascript's: String.fromCharCode(n1, n2, ..., nX) http://www.w3schools.com/jsref/jsref_fromCharCode.asp ...

JS / JQuery character problem

I have a code which has a character that JS is not handling properly. $(document).ready(function(){ $.getJSON("http://sjama.tumblr.com/api/read/json?callback=?", function (data){ for (var i=0; i<data.posts.length; i++){ var blog = data.posts[i]; var id = blog.id; ...

Google Map API v3 ~ Simply Close an infowindow?

Trying to simply close an infowindow? I already have an array of markers, so something like this would be good. Thanks MyMarkers[i].infowindow.close(); ...

Using Jquery autocomplete - looking for example of overriding the filllist() function

I'm using the JQuery autocomplete plugin. I wish to override the implementation of the filllist() function. Can someone point me to an example of how to do this? ...

Javascript handling textarea

Hi all, I'm a bit new to Javascript and am trying to create a delimited string from a textarea. The problem is when passing in the textarea, it adds newlines for each row on the textarea. I need to have the entire textarea parsed into a string with a delimiter for each line (replacing the newline char). So for example, if you passed i...

jQuery : how to apply effect on a child element

Hello, instead of re-writing the same function, I want to optimise my code : <div class="header"> <h3>How to use the widget</h3> <span id="idwidget" ></span> </div> <div class="content" id="widget"> the JS : <script type="text/javascript"> $(document).ready(function() { var showText="Show"; var hideText=...

Division of text follow the cursor via Javascript/Jquery

Dear experts, I wanted have a dynamic division of content follow you with the cursor in the web browser space. I am not a pro at JS so I spent 2 hours to finally debugged a very stupid way to accomplish this. $(document).ready(function () { function func(evt) { var evt = (evt) ? evt : event; var div = document.crea...