javascript

How do I style the scrollbar of a textarea

I've got a textarea in a contact form which is styled with css, it looks great until i write more than the area can fit, when I do that a scrollbar appears and this scrollbar looks horrible with my dark styling (it's black with white text). So how would I go about to style this? I've googled some but haven't found any good answer just fo...

unitPngFix prevents changing "display" of hidden "div"

I have almost solved a huge problem with png files and transparency in IE browsers on my website. The problem is that only in IE6, this wont work. I have this code called unitpngfix.js which displays transparent PNG images correctly on my website in IE browsers. I have a DIV with a png image inside it like this: <div id="pop" class="...

Writing callback functions

I'm using jQuery to write things like this: $('#current_image').fadeOut(function(){ $('#current_image').attr('src',newImage).show(); }); This is lovely, once the fadeOut has completed, the nested bit executes. I'd like to make my own function here that would replace fadeOut. What would my function look like so that th...

location data for symbian

I want to retrieve location data (latitude and longitude) from symbian phone with its web browser with getlocation api. Is there anyway I can do it? any api to recommend to get location data from gps enabled symbian devices? Thanks!! ...

How to invoke a function from another funtion in Javascript?

I have a non-working code. I think it needs just a little mods and it should be working. I couldn't figure it out. Just started studying JS. var add = function (a, b) { if (typeof a !== 'number' || typeof b !== 'number') { throw { name: 'TypeError', message: 'add needs numbers' } } r...

NSString in webview iPhone and objective-C

Hi, i have an NSString and a webView in my project (Objective-C for iPhone), i have called index.html in webView and in index.html i have written my script (javascript) How can i pass the NSString as a var in my script and viceversa? http://developer.apple.com/library/safari/#documentation/AppleApplications/Conceptual/SafariJSProgTopics/...

Is it sometimes ok NOT to Degrade Gracefully?

I am in the process of building a video sharing CMS that uses lots of jQuery and ajax for everything from rich UI effects to submitting and retrieving data to and from the database. When JavaScript is disabled it everything falls apart and 90% of the functionality doesn't work. I am beginning to think its ok to not degrade gracefully fo...

Internet explorer 6 Z-index problem

I have a popup DIV (js triggered) which shows an image. Very simple. The problem is, that this DIV must overlap the SELECTS which lie underneath the DIV. It works in all browsers but IE6. When the js is triggered, and the DIV is displayed, the z-index isn't right because the SELECT drop lists overlap parts of the DIV. This is only in...

Namespacing, OOP JS, Am I doing this right?

My problem is with objInfo(). How can I return an object via a passed-in variable? I'm trying to namespace my code and use private/public vars. Bonus Q: How would you otherwise improve the code? // Namespace all my code var bab = new function() { // Declare cat object function cat() { this.eyes = 2; this.legs =...

Data storage with javascript on clients computer?

Anybody knows ways to store data with javascript clients computer? Except using cookies. May be there is such lib ? By the way the data I want to be stored isn't secret if that matters. ...

Why is this JavaScript code invalid in Firefox?

I accidentially typed in \s instead of " ", while(cname.charAt(cname.length-1) == "\s") Aren't special characters resolved in all string literals? Also, what is a proper regular expression to cut off all tabs and spaces from EOL? The my /(.*)[\s\t]/ selector just won't work! So I had to fallback to while(if.. substr). ...

Uploading a binary string in WebKit/Chrome using XHR (equivalent to Firefox's sendAsBinary)

I'm working on a webapp that uses several cutting-edge WebKit features. It essentially does this: reads a local file with the FileReader, unzips each file into a string using a JavaScript unzip library, and POSTs each file using XMLHttpRequest. This works great for text files, but unfortunately it corrupts binary files (in this case, ima...

Is is possible to transform all js alert messages in modal window?

I'm working on an old site and i would avoid searching&replacing and i was wondering if it is possible to reaplce all alert massages function alert('some msg'); with a jquery modal window... i'm not asking how to do the modal window but if i can create a protoype to replace the function alert.. thanks ...

how to extend javascript classes

Why Child class doesn't have echo() method? Parent = function(){ this.name = 'abc'; } Parent.prototype.echo = function(){ alert(this.name); } Child = function(){ $.extend(this, Parent); } var x = new Child(); x.echo(); What should I do to inherit from parent class in Javascript? ...

Regular Expression to match <a> tags without http://

how to match html "a" tags, only the ones without http, using regular expression? ie match: blahblah... < a href=\"somthing\" > ...blahblah but not blahblah... < a href=\"http://someting\" > ...blahblah ...

How can I print javascript objects?

I have an object var object= {} I put some data in the object and then I want to print it like this document.write(object.term); the term is a variable that changes depending on different situations. When I try printing this it comes up with undefined. How would it be done? Update: this is the code I am dealing with. I guess it ...

Retrieving character position in case of a mouse over event

I'm looking for a way to retrieve the character position when moving the mouse pointer over a div containing text. So basically, if this is the text: The quick brown fox jumps over the lazy dog and I move my mouse over the first 'b' (in 'brown'), then I would basically like to have the ability to return the position of 'b' in an ...

Custom fancybox - can't click link in title

I've created a custom Fancybox implementation that displays the title on the left-hand side of the image. The problem is that inside any galleries, links inside the title of the image can't be clicked because the fancybox-left link sits above it and blocks the click. You can click the first link in the gallery because the left button doe...

Floating Menu in PrototypeJS

Hi, can someone please help me make a floating menu in prototypeJS? I found documentation to do it in jQuery, like here: net.tutsplus.com/tutorials/html-css-techniques/creating-a-floating-html-menu-using-jquery-and-css/ and here: manos.malihu.gr/jquery-floating-menu, but can't figure out where to start for prototypeJS. So I got it work...

ie9 .... close window, run flex function

I have Flex 4 & an amazon payment button, the way Miti shows here: http://miti.pricope.com/2009/07/11/using-amazon-flexible-payment-system-with-flex/ As he shows, when the payment process is done there is an html button that appears in the popup that calls a javascript funtion. This javascript funtion will close the popup window, return...