javascript

How to access an array via RJS proxy?

In Rails' RJS Adapter, page['id'] // $('id') accesses an CSS-id, page['id'].property // $('id').property a property of it. But how can I access an array index, e.g. page.select('ul').value_at(2) // $('id').select('ul')[2] Is there any way of doing this without writing: page << "$('id').select('ul')[2]" ...

WebBrowser Control from MFC — How to Inject Javascript?

This is like the question http://stackoverflow.com/questions/153748/webbrowser-control-from-net-how-to-inject-javascript But i don't know how to transform this code into good old MFC C++ code. For example what is the InvokeScript method, i can't find it anywhere. Isn't .NET webbrowser the same as IWebBrowser2 ? ...

Getting around Firefox not passing the file path

I need a means of getting past Firefox's irritating refusal to pass the full path of a file selected using the input file element. This issue has come up in multiple other forums and I haven't found any solutions that are helpful. What I want is a means, via javascript, to open a file dialog (without using the silly "hidden file input ...

Echoing <script> from PHP to jQuery AJAX causes problems with my interval

Basically, I'm grabbing contents from a PHP file. I check it every 5 seconds. If the content differs from the content on the page, it loads that new content: <script type="text/javascript"> $(document).ready(function() { $.ajaxSetup ({ cache: false }); var loadUrl = "<?php echo site_url("admin/get_uploads"...

Is there a javascript LaTeX equation renderer?

I am looking for a purely client side javascript library that renders latex equations as HTML/CSS. I hate that all I see are utilities that request an image from a server. Example usage: latex('\frac{a}{b}') output: <div style="position: relative; display: inline-block; height: 2em; width: 1em"> <div style="position: absolute; top...

JavaScript Handler Calls - How to Implement this Structure?

Hello, Not sure what to call this post exactly. I want to mimic a structure I've seen in Facebook, but I'm not actually using Facebook, this was a good example. I remember from using the Facebook API that it had a method that did: FB_RequireFeatures(<key>, <handler>) This method essentially said if the feature was ready to go at the...

Is Javascript under V8 faster than equivalent code on other languages?

Anyone know whether Javascript on V8 runs faster than equivalent code on other languages such as Python, Perl, PHP etc...? ...

Make object not pass by reference

I just found out the hard way objects are passed by reference in Javascript, for example: for(var layer = 0; layer < hudLayers['layers'].length; layer++){ // Store the to-be-calculated values in this object var tempValues = hudLayers['layers'][layer]; tempValues['name'] = 'test'; } This will change the value in tempValue...

popup window on mozilla

i'm using javascript to open a new window in a html page. It works fine ie whereas mozilla opens a new tab. is there a way to make the mozilla open the popup in a new window instead of new tab using javascript or any parameter? -Vivek ...

A nonce for each function or one for all AJAX calls?

I'm using nonces as WordPress uses them. It's an extra security measure, a hash that is being sent to the server that changes within ever few hours. If that hash is not there, the request is invalidated. The page I am working on has many AJAX calls (about 20 or so). Right now, I have a difference unique nonce for each one. Is that nece...

'length' is null or not an object? IE 8

Hey guys quick question I get the following error 'length is null or not an object' in IE 8, anyone have any ideas? Feedback greatly appreciated... function refresh() { $.getJSON(files+"handler.php?action=view&load=update&time="+lastTimeInterval+"&username="+username+"&topic_id="+topic_id+"&t=" + (new Date()), function(json) { if(j...

Detecting SSL Browser support

Hello, How can you detect if the client browser has SSL support? I am not refering to the server Variables HTTPS_* . I want to be able to determine if the browser has no SSL support. P.S. I know this is possible because this company (http://www.cyscape.com) has a product that can even detect when you unselect SSL support from your bro...

Storing Highlighted text in a variable

Is there a javascript function that will allow me to capture the text that is currently highlighted with the cursor and store it in a variable? I've been trying document.selection.createRange().text but this hasn't been working. Are there any possible alternatives? Here's the code: function moremagic(){ var output = document.selection.c...

How do I keep smartgwt from polluting the window namespace?

I have existing javascript in a project that creates a 'Calendar' object. The object is a member of window. When I added smartgwt to my project, the original Calendar object was overwritten by a smartclient calendar (ISC_Calendar) packaged in smartgwt. Using a browser-based JS debugger, I found that all the JS objects from smartgwt wer...

Streamlined way to validate website ownership (with javascript?)

I have a rails app which requires users to verify that they own a website before submitting links from that site. I have implemented a website verification system that works thanks to the answers given to a question I made several months ago. This system works but it is rather cumbersome for users. It requires them to create a web page ...

Hide a column in a javascript populated table

I would like to hide the entire age column on this table. <table id="displayTable"> <tr> <td class="Name"></td> <td class="Phone"></td> <td class="Age"></td> </tr> </table> Javascript follows to hide Age cell - var table = document.getElementById('displayTable'); var tableRow = table.getElementsByTa...

Best way to parse this XML with jQuery

<?xml version="1.0" encoding="UTF-8" ?> <BMC_Impact_Manager version="1.0"> <IMPACT_EVENT> <EVENT> <date_reception>1279568162</date_reception> </EVENT> <EVENT> <date_reception>1279568162</date_reception> </EVENT> <EVENT> <date_reception>1279568102</date_reception> </EVENT> <EVENT> <date_reception>12795...

My website alway scroll up when i click link?

I have a link <a href="#">Text</a> when i click this link my page alway scroll up to the top. How do i manage it that when i clik this link my page not scroll up to the top. Javascript? or something thank you ...

AJAX responseText not getting anything

I wrote this simple AJAX script: var request; function createRequest(){ request = null; try{ request = new XMLHttpRequest(); }catch(failed){ request = null; } if(request==null){ alert("Incompatible Browser"); } } function getProd(form){ createRequest(); var w = form.list.selectedIndex; var cat = form....

Create a 'send to Delicious' bookmarklet with custom tag

Hi, I've created a javascript bookmarklet that gets the current page's title and URL, using the following code: //Check to see if jQuery is already loaded if (typeof jQuery == 'undefined') { var jQ = document.createElement('script'); jQ.type = 'text/javascript'; jQ.onload=runthis; jQ.src = 'http://ajax.googleapis.com/aja...