javascript

Getting height and width of body or window of web page

Hi Depending on which mode of IE8 i'm in (quirks or standard) i get different values for the height and width. I've tried standard javascript and jquery but both return different results. In Quirks $('body').width = 1239 $('body').height = 184 document.body.clientWidth = 1231 document.body.clientHeight = 176 In stand...

Adding keylistener and using javascript to click a link in Greasemonkey

Hi , I want to create a greasy monkey script , which will add a shortcut key for logout action in one mail site. Currently the logout link "?logout&hl=en" which have an id=":r5". I am able to get the node for the link but not able to call click on it. I tried the script as following function key_event(event){ GM_log("Hello"); ...

Negative look-around

the following regexp is wrong - can someone please help to find all :-) that do not have "please ignore me " in front? I have not previously needed such an regexp. The word boundaries might confuse things. Thanks <script type="text/javascript"> function regexTest(string, assert) { document.write('<hr>') document.write(string) docu...

Unable to change session variable through AJAX in IE

I'm getting some weird behavior from IE when trying to change a session variable on the server using AJAX. It works fine in FF, Chrome, Safari, and all the others I've tested but not in IE. I'm maintaining a list of variables (integers) in a session variable for anonymous users so I can keep their data when/if they register on the site....

Embeding low quality youtube video as the default quality..

I uploaded my videos to youtube to make use of the multi-quality features.. and I noticed that when I play them on the youtube website, they appear in 3 qualities with the ability to show the the forth HD quality if I hacked the mt parameter, while -the problem- it shows only with the 360p and 420p qualities .. Unlike all other questio...

Segmented (multi color) progress bar / chart for Javascript

I'm looking for a segmented Javascript progress bar similar to the one in the upper right corner on this screenshot: http://jokke.dk/media/2008-webgrind/webgrind_large.png Preferably a jQuery plugin. ...

jQuery: Count children of several elements and calculate

Hi there I'm making a website for a restaurant, where they want to make "room" in the menu, by starting the numbering with the following "5". Example: Starter 1. 2. Salads 5. 6. 7. 8. 9. 10. 11. Pizza 15. 17. I want to count the numbers of TABLEs within a DIV, give the tables this number, then count the number of TRs within the TAB...

Replace paragraph by <br /> tag in div with contenteditable

How to put <br /> only in div contenteditable while user is pressing ENTER key? I must manage the content of that div in XML after send, but some browsers translate new lines as <p>, some (in example Google Chrome) as <div>. The good solution will be force to make new lines the same in all browsers (only <p> or only <div>) too. PS: I'm...

Load Javascript array with MYSQL database data

Hello, suppose i have an javascript array "userName".I want to load it from a database table named "user". Can anyone help with idea or sample code? Thanks ...

how to show blog on a page without using iframe?

Hey experts, I have website where I need to show a blog inside my website, so i tried doing that by using iframe.Now the problem is since the blog is bigger in size, my iframe shows scroll bars and I don't want that and also I would like to know if there is any other way to show the blog in my website like if I am able to show the websi...

How to translate javascript-files in Pylons

Heya! We're making an application by using Pylons and JQuery. We have used standard way of making translations, but it doesn't quite work with javascript. The awkwardness of js-translation methods is that we should make duplicate processes for selecting languages etc. Is there a proper support in Pylons for javascript-translations? ...

Why do we have closures in JavaScript?

Am wrapping my head around JavaScript closures and am at a point where things are falling in place; i.e a closure is the local variables for a function - kept alive after the function has returned, or a closure is a stack-frame which is not deallocated when the function returns. Am starting to understand this concept, but the more i und...

iPad webapp problems: statusbar over page, html/JS links

Hi there. I have a webpage/webapp that works really good. Just 2 problems right now: The statusbar of the iPad is not above the page, like i think it should be, but its in the page. So the top ~10px are overlayed by the statusbar and therefore my menu at this place is nearly unusable. I used 'black-transulent' but also 'black' as status...

Javascript Syntax Error

hiere is my code, within a loop. I want to solve my closure problem. But on click I receive an error message "Syntac Error". Any help. Thanks in advance. var html = '<div style="margin-top:10px">'; html += '<div class="weiter"> Kartenauswahl in die Recherche &uuml;bernehmen </div>'; html += '<div class="weiter" style="display:...

image.Onload does not complete the image.

This is driving me crazy. I need to load an array of images in Javascript, but I want to make sure that all the images are loaded before starting drawing them. So, I busy-wait for every image onLoad event to be called. First I create images and set their source and onload function: // Load images from names for (i = 0; i < this.nImages...

Basic JS + WebDev help

Hello, I have a little Problem. I have seven <select>'s. The go from left to right counting up. <select id="sel_1" onchange="evalonsubmit('sel_1',1);"> <select id="sel_2" onchange="evalonsubmit('sel_2',2);"> That goes from 1 to 7 in this way. The logic is easy. On click check if the value is -1 if it is disable everything on the rig...

jquery tooltip hover help

I have a tooltip pulling in some Ajax content and want the tooltip to stay visible when the user hovers over the tooltip not just the original link. How would I achieve this extending the following code (function($){ $.fn.tooltip = function(options){ var defaults = { cssClass: "", //CSS class or classes to style the tooltip ...

How to get parent id of an anchor tag using prototype?

Event.observe(window, 'load', function() { $$('a.tag_links').each(function(s) { //alert(s.parent.parent.id); //How to get id of its parent to parent }); } ); I want to get the id of the parent element. Structure is something like this. <div class="home-page" id='entity-1'> <div class="index-page-category"> ...

jqtouch and redirecting

Hi, I am using JQTouch and I am trying to load a new page into the current page. Unfortunately JQTouch automatically adds a '#' to the url and thus the url cannot be opened. in order words, <li class="arrow"><a href="categories.html">Categories</a></li> would not work. Any suggestions please? Thanks, C. ...

How to parse css (stylesheet) comments (annotations)?

Hi! I have this idea, the user defines set of css rules with some comments (comments are simple annotations): /* @name Page style */ body { font: 16px/1.5 Arial; /* @editable */ backgorund-color: #fff; /* @editable */ } /* @name Section header */ h1 { font: 20px/1.2 Arial; /* @editable */ color: #c44 } I can apply this ...