javascript

how to find the height of html content

Hi, I am trying to display 10 html pages as a single document,with 10 chapters. I am using Webkitgtk+ engine to render the HTML pages. I am getting the content of each html files and concatenating all of them to create a single 'char *content' and using webkit_web_view_load_html_string(WebKitWebView *web_view, ...

(function() {})() declaring/initializing javascript function

Possible Duplicate: JavaScript: Why the anonymous function wrapper? Hi Guys, I would like to ask you what is the reason of wrapping everything in (function() { document.write("Hello World!"); })(); function ? cheers ...

0 in [1, 2] == true, why?

Excerpt from my JavaScript console: > 0 in [1, 2] true Why? ...

How do I avoid multiple key up/down/press events when holding a key?

I'm creating a web front end to control a small robot. Ajax calls will be made on a keydown, to start the robot, and keyup to stop it. My problem is that when a key is held down the keyup, keydown, and keypress events seem to cycle continually. Does anybody know of a way to only have keydown fire when the key is first pressed and keyup...

Dynamically created image doesn't show when <img>'s src is refreshed to point to it

Hello, I have a javascript function generateGraph() { ... jQuery.get('chart.php?month='+month+'&year='+year); document.getElementById('graph').src = 'charts/'+month+'_'+year+'.png'; ... } which is called onChange. It basically creates, if not exists, or refreshes if already exists, a PNG image (using the first line ab...

Make value of input sum of other inputs automatically?

I'm just wondering if this is possible, and if not, the best way to set up event handlers to make this happen... If I have a spreadsheet-like HTML table like so: <table> <tr id="row1"> <td><input type="text" class="number" value="1"/></td> <td><input type="text" class="number" value="2"/></td> <td><input type="text...

Javascript RegEx trouble in Internet Explorer

I am trying to split a string in Javascript using a Regular Expression. My code is as follows: var status = "This is a test http://yfrog.com/5y6eruj"; var regexp = /(http:\/\/yfrog\.com(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi; matchParts = status.split(regexp); alert(matchParts); In Chrome and FF when I a...

Obtain the method and url from an XHR

Basically what the title says, I want to get the URL and HTTP Verb from a xhr. Is this possible? ...

Javascript won't execute in iPhone Safari

I'm running into this issue only because I recently purchased an iPhone. The javascript for a picture carousel on my website (http://www.stuartmeyerphotography.com) won't execute in Safari for iPhone. I thought it worked on Mac Safari last I checked with a friend who had a Mac (a year ago), but now I need to go back and check that too ...

Within a web browser, is it possible for JavaScript to obtain information about the SSL Certificate being used for the current page?

Is there a method for JavaScript running in a browser to determine which CA certificate is being used to authenticate the remote host for the browser's current SSL connection, and also obtain properties of that certificate, such as the name of the CA? If not, are there any other options for programatically obtaining this information, su...

HTML <select> selected option background-color CSS style

Is there a style for a select option's "selected" color? For example: <HTML> <BODY> <FORM NAME="form1"> <SELECT NAME="mySelect" SIZE="7" style="background-color:red;"> <OPTION>Test 1 <OPTION>Test 2 <OPTION>Test 3 <OPTION>Test 4 <OPTION>Test 5 <OPTION>Test 6 <OPTION>Test 7 </SELECT> </FORM> </BODY> </HTML> When I select an option it tu...

javascript associative array length using jquery

Hello All I am using javascript associative array like: var testarray = []; testarray['one'] = '1'; testarray['two'] = '2'; testarray['three'] = '3'; I am also using jquery alongside. How can I check length of this associative array using jquery or any other method? Basically i want to check whether this array is empty or not. Thank ...

[Firefox vs IE] element.offsetTop when parent has overflow and border

Hi, FF and IE give differents offsetTop when a child is into a parent with overflow and border. FF substracts the top border size of the parent from offsetTop value, so return a negative value(often); I think IE return the correct value instead. Test it There is a crossbrowser way to get the same value? Thank you. ...

What does the JS function 'postMessage()' do when called on an html object tag?

I was recently searching for a way to call the print function on a PDF I was displaying in adobe air. I solved this problem with a little help from this fellow, and by calling postMessage on my PDF like so: //this is the HTML I use to view my PDF <object id="PDFObj" data="test.pdf" type="application/pdf"/> ... //this actionscript live...

Model Bind to a List<> when Posting JavaScript Data Object

Hi Guys I'm trying to post a JavaScript data object with the following: $.post(frm.attr("action"), data, function(res) { // do some stuff }, "json"); where 'data' takes the structure of data - panelId - siteId - ConfiguredFactsheetId // this is an array of CheckBox ids that correspond to ConfiguredFactsheets - 123 - 234...

jQuery optimization - anything wrong with storing a jquery object reference?

I have a web-based application which is very highly reliant on jquery / javascript, and its sometimes a bit slow. One of the things that gets done frequently is changes to the grid (jqGrid) which means each time I'm using jQuery to select that object, ie: function load_editor() { $('#listview').jqGrid(do_stuff); } I believe simply sto...

JavaScript new keyword and memory management

Coming from C++ it is hard grained into my mind that everytime I call new I call delete. In JavaScript I find myself calling new occasionally in my code but (hoping) the garbage collection functionality in the browser will take care of the mess for me. I don't like this - is there a delete method in JavaScript and is how I use it differ...

Calling javascript from a code behind vs. calling a code behind from javascript

I have a web application that will need to access code behind methods as well as javascript methods. For this particular implementation it doesn't really matter which order they are called in from a program flow perspective. I'm looking for insight into when it would be appropriate to use a code behind to call javascript and when it wo...

jQuery closing pop-up after successful form submit

Hi, I have a pop up form that i wish to close on successfull submit of the form. Currently we are only validating on the server side which will create an unordered list of validation errors with the class .error_message. Once the form has been successfully submitted i want to close the window. Currently the jQuery i am using for this...

ExtJS: remove a grid from a tabpanel when its underlying store is empty

Hi, I have TabPanel which contains, among other things, a Grid connected to a Store. Several events may remove elements from the store. I would like the Grid to be removed from the TabPanel when the store is empty and, possibly, to have a single place in my code to check for this event. I thought about using store listeners, but unfo...