javascript

javascript : string contains ...

How can I check if one string contains another substring in Javascript? Usually I would expect a String.contains() method, but there doesn't seem to be one. Edit : thanks for all the answers :) however it seems that I have another problem :( when I use the ".indexof" method, Firefox refuses to start the javascript (this is for an ext...

mouseenter leave cause flicker in jQuery

The below code works but on mouse enter causes flicker $("#helptext").bind("mouseenter",function(){ $("p:first",this).text("helptext."); }).bind("mouseleave",function(){ $("p:first",this).text(""); }); The below code does not work /* $("helptext").mouseout(function(){ $("p:firs...

window.open with popup blocker

Hello, I am trying to open a certain page from my default page. All the code there is in the default page is: <script type="text/javascript"> window.open("StartPage.aspx", "", "fullscreen=yes"); </script> The problem is that the browser's popup blocker blocks this and I need allow the browser to open it. I want to avoid th...

remove default tab selection and also add scrollTo effect

var tabLinks = new Array(); var contentDivs = new Array(); function init() { // Grab the tab links and content divs from the page var tabListItems = document.getElementById('tabs').childNodes; for ( var i = 0; i < tabListItems.length; i++ ) { if ( tabListItems[i].nodeName == "LI" ) { var tabLink = getFirstChild...

UIWebView - scaling image independently from text

I would like to diplay HTML in iPhone UIWebView. My HTML looks like text text <img src.../> text text How can I cause the component (via JavaScript or Objective C) to fit the image size to a window - i.e text size will remain the same but image will be reduced/enlarged proportionally to prevent horizontal scrolling ? Thanks ...

How can I make vim's taglist plugin show useful information for javascript?

I've recently abandoned mouse-driven, platform-specific GUI editors and committed entirely to vim. The experience so far has been fantastic, but I'm stuck when it comes to Javascript. The ever-popular taglist utility (using Exuberant Ctags) has been great for everything but Javascript. With the language's overly-free form and structur...

Javascript: Workaround needed: Internet Explorer changes link text when changing the href

Hello all, I have a problem as follows: We're using a rich text editor (TinyMCE, but that's not important here, I think) in our application. Now, with Internet Explorer 8, we've noticed that if you type in content that looks like a web address: www.google.com ...IE helpfully converts it to a link by some native-to-browser function...

How to create a web widget for my website users to insert on their blog ?

Hello, For my wishlist site, I would like to propose widgets to my users in order to publish their wishlist on their blog or personal website. The idea is to propose a few lines of code to my users that they only need to copy/paste to insert the widget displaying their wishlist. What is the best way to create/develop a widget ? I ha...

Opera: Altering img src attribute does not automatically update display?

When using javascript to swap images the HTML is updated fine but what Opera actually displays is not unless you scroll or resize the window. A picture of what happens when you scroll explains it best. Any ideas? EDIT: The source of the problem seems to be that the image is inside a div that has float right. EDIT2: This http://trac....

Facebook Connect Publish Stream JS Help

My site allow users to login via Facebook Connect and also allows them to update a status field our site. I want to include a checkbox below the status update field that will allow them to post this update to their Facebook profile as well if they so choose. In order to do this I need the user to grant our application permissions to post...

How to achieve library-agnosticism when building a javascript framework ?

I've started looking into architecturing a javascript framework. I don't want to reinvent the wheel here, especially regarding browser quirks, and know that for that matter, I'll have to rely, at some point, on some commonly-used libraries to handle low-level concerns. The thing is, I'm not sure how i can depend on an external libr...

Dynamic JavaScript loading with compression

Hi, Although I am using the Zend framework, MooTools JS library and my questions revolves around them, this is a more generic question. I am working on a web app, in which I am using many elements which are sometimes useful on other pages (for example OpenLayers related MooTools classes). Mootools already allows this "segmentation" by...

How to create a Firefox add-on using Objective-C on Mac OS X?

More precisely my goal is to create an add-on (or plug-in?) which is able to communicate with my main Cocoa application using something like the NSDistributedNotificationCenter. I need to be able to inject JavaScript code into the current webpage and get return values from the JS calls when my add-on receives the request to do so by my m...

Drag-and-drop accordion panels? (ASP.Net)

Hello, I have a set of accordion panes(dynamically created) contained in an Accordion control. Basically, what I am wanting is for the user to be capable of dragging these accordion panels so that instead of A pane B pane C pane They can drag and drop it to be something like B pane A pane C pane Or whatever. Also, more importantl...

setTimeout(fn(), delay) doesnt delay as expected

hi all I must be missing something quite obvious here because something rather strange is happening I have a bit of js code that goes pretty much like this setTimeout(myFn(), 20000); If I m correct when I hit that line, after 20 seconds myFn should run right? in my case myFn is an ajax call and it happens quite fast ( not at 20sec...

Array.each outputs all methods

Why would... for(var k in this.errors) { $('error_list').insert({ bottom: new Element('li').update(k + ' :'+this.errors[k]) }) } ...output put all Prototype enumerable methods, plus what I've added to the array? I'm building an associative array: this.errors['email'] = 'Your email is invalid'; ...

Secured Client-Side script

Hello there I have got a particular requirement where some critical algorithms have to be handled in the client-side script and it got to be secured. Using javascript will just expose the algorithm. I am currently evaluating ways to secure the algorithm on the client script. Appreciate any suggestions and alternative approaches. One op...

ExternalInterface-passing dynamic arguments to Javascript function

I'm having a problem passing dynamic variables to a Javascript function using ExternalInterface. The variables don't seem to be resolved correctly //CODE START var customInfo :String='some custom info' ExternalInterface.call("funcName", 'arg1Name', ' "+customInfo+" ') //CODE END In Javascript, I get 'customInfo' literally, it isn't...

onClick does not work properly on p tag

Hi, I want to bind a click event to every <p> but it does not seem to work properly. When I run the script I instantly get three alerts. I only want to get them when clicking any of the three <p>'s. Can anyone tell me what I'm doing wrong? Edit: Sry this is what it looks like. The HTML is just as it should: <p class="special">text te...

Can I get a Javascript event from the selection of text outside of text or textarea?

I would like to know when a user selects text in an html page using Javascript. The text should not be editable. The onselect event seems to be only applicable to <textarea> and <input type="TEXT"> tags. The event is not fired if either tag is disabled. Is there a way around this with these tags? Is there a completely different appr...