javascript

Prevent horizontal scrolling with javascript?

Hello all, Does anyone know if there is a way to prevent the user from being able to scroll horizontally? ive used overflow-x:hidden css, but it can still sometimes scroll (but only sometimes, its weird..) http://www.kaiserroof.com Would it be possible to disable keystroke events for right/left arrows as well as left/right mousewheel ...

Question about the for loop in javascript ?

In the following code why the variable 'a' refer to the index rather than the value ? for (var a in Values) { alert(Values[a]); } ...

Javascript WYSIWYG Editor and font sizes and I am stumped

I'm creating a Javascript WYSWYG editor (yes I know a million already exist but none met my needs) and I've hit a wall. I need only two features in my editor: 1) Users should be able to select any font size specified in pts. 2) Users should be able to have text of various sizes in the same editor window. Sounds simple but you'd be sur...

javascript bookmarklet to hide all images from current webpage?

hey guys, i wanna create a simple bookmarklet that hides all images from the current website i'm browsing. javascript:body.getElementsByTagName("img").style.visibility="hidden"; that's not working? i wonder what i'm doing wrong? thank you for your help! ...

Setting font-size when browser is zoomed

Here's my issue: I need to set the font-size of an element to match the font-size of another element, dynamically (in javascript). This works fine when the browser isn't zoomed in/out. When the browser is zoomed out, however, this occures: window.getComputedStyle(element, null).getPropertyValue('font-size'); // 14px element.style.font...

Is the <noscript> tag outmoded?

A lot of what I continue to read about graceful degradation applies to browsers that don't use JavaScript. But my own experience shows that it's no longer reasonable to expect a normal experience on the Internet without JS and CSS support. How much energy is it responsible to devote to degradation these days? ...

getting json from google query - mootools 1.1

Hi-- I'm a bit stumped on what should be a really simple question. I'm trying to use the Google calculator URL to return a converted currency via ajax, but I can't ever get the data back due to the "same domain" issue I assume. Here's the code: window.addEvent('domready', function() { $('currency_select').addEvent('cha...

Why does the JQuery valid() method always return True?

I have a simple HTML form: <form id="frmNewCategory"> <span>New Category Name:</span> <input type="text" id="txtNewCategoryName"> <label>Amount:</label> <input type="text" id="txtNewCategoryAmount"> <br> <input type="submit" value="Create" class="importantButton button" id="btnNewCategory"> <input type="butto...

jHTMLArea locks up inside jQuery webform wizard

Hello, I previously posted this question http://stackoverflow.com/questions/1704933/jwysiwyg-or-jhtmlarea-within-a-jquery-ui-tab about getting jHtmlArea to work inside jQuery Ui tabs. I am now trying to get this same html editor to work inside the jQuery formtowizard plugin. I am not sure if this is exactly the same problem or not. No...

How do I select the first instance of an element of a certain class enclosinga DOM element..

Hi guys lets say I have the following html: <div class="owner"> <div> <a href="javascript:void(0)" onclick="">click</a> </div> </div> <div class="owner"> <div> <a href="javascript:void(0)" onclick="">click</a> </div> </div> I want to put code in the onclick handler so it results in selecting the element of class 'owner...

C++ Object & Javascript Object life cycle mis-synchronization

Dear all, I got a question regarding C++ Object & Javascript Object life cycle mis-synchronization and hope here your gurus could help me out. Specifically, I am embedding SpiderMonkey in my C++ program. I am not sure if my approach is right or not. What I am doing is like (1) C++ program loads a Javascript file and call an entry fun...

Load image with current date_time using Javascript

Hi, I have some images in a folder save automatically from a web camera naming by current date_time. Now i just want to load each image after some seconds(let say 4 sec) which matches to my server current date_time. Using java script.. I can get server time using PHP ** I more simple words, Is there any jquery plugin that load im...

goto HTML document location dynamically

My page adds # to the html programatically and have this in the tag function InsertTag(){ //Add <a name="spot"></a> to the middle of this document } window.addEventListener('load', InsertTag, false); my question is how can I make the document then jump to #spot? ...

BOUNDARY in sending the file data using the HTTP ?

I read some articles on net for sending the files using HTTP/(Ajax). While reading i found stuff like need to set BOUNDARY for the file etc. I don't understand what and why is this ? Can some one please help me understand this. ...

Javascript wait for function response

I have the following code: myFunc(); bar(); myFunc() is making an ajax request I don't want to execute bar() until myFunc()'s request has completed. I also do not want to move the call to bar() inside of myFunc. possible? EDIT Here is the code I ended up with: var FOO = { init: function(blah) { // Callbacks to pass to the AJ...

Getting the CPU time in JavaScript

Is there a way to get the time a piece of JavaScript actually runs on the CPU, like with the clock() and getrusage() functions in C? Using the normal Date() way only gives the wall time, and for performance measurements the CPU time would be much more useful. Note that I'm not looking for profiling tools, I want to reduce system noise f...

tooltip is set but not displayed in firefox, javascript

Can any body please help me why the tooltip is not getting displayed in firefox when it is set using title attribute for <a> element while it works with InternetExplorer. title is set but still not getting displayed. ...

Problem with passing xml data to webservice .asmx

I have the ajax call to webservice jsonwebservice.asmx ,my datatype is xml, i have problem with passing data to webservice is thier any syntax problem $.ajax({ type: "POST", async: false, url: "/blkseek2/JsonWebService.asmx/GetList", datatype:"xml", ...

Searching for objects in JavaScript arrays

how to search for the property of an object in an array , without using for loops in JavaScript ? If array is a simple one , I can use array.indexOf(value) to get the index but if array is array of objects ? other than looping any other way ? e.g. ar = [{x,y},{p,q},{u,v}] if searched for v , it should return array index as 2. ...

How to ignore pageviews by search engines on a PHP page?

I have a particular PHP page that I want to conditionally do things only if the visitor is not a search engine. Are there some good regex to match $_SERVER['HTTP_USER_AGENT']? Or would it be better to do a javascript redirect back to the page but set a flag, since search engines don't have javascript? (I don't have to worry much about m...