javascript

Focus is not coming in javascript

I have a button in aspx. In its onclientclick I called a javascript function which is written in JScript.js. Following is my javascript: function ChangeBG() { alert("hi"); } I called this above function in button click. I had put breakpoint in javascript. But onclicking on button, alert is coming, but control is not going to breakp...

How difficult/time consuming is to build a vertical editor?

this editor is horizontal http://tinymce.moxiecode.com/examples/simple.php and I seem to find only horizonal editors, has anyone came across a vertical editor? any examples? how long would it take to build? I mean the toolbar is horizontal and I want to use a vertical one instead? (I don't mean for languages) I heard it's very difficult...

How to validate currency value using JavaScript?

I have some input fields in a page and i want to validate if they contain currency values such as $100 or with euro. Any one have an idea or example? ...

What is the most convenient way to stop an Ajax-object in prototype from swallowing exceptions?

Consider this code: new Ajax.Request('?service=example', { parameters : {tags : 'exceptions'}, onSuccess : this.dataReceived.bind(this) }); If an exception occurs anywhere in the dataReceived-function when it is called by the Ajax-object, it is swallowed by some exception handling code and the whole process then silently termi...

CSS & Javascript rollup file(s)

The Yahoo User Interface library offers rollup support if you use their CDN. I'm using Zend Framework 1.8.0 and was wondering whats he best way to go about replicating this so as all our css or javascript files can be rolledup into one tag - thus one http request. I am using the standard MVC components with a .htaccess file that rewri...

javascript to get paragraph of selected text in web page

Hi, After highlighting text, I would like to obtain the paragraph in which the selected text resides. var select = window._content.document.getSelection(); Any pointers please? ...

How fast does it take to write a simple, custom editor?

by simple I mean, having buttons: 1.bold, 2.italic, 3.numbered list 4.bullet point list 5. indent left 6. indent right 7. spell check (obviously supported by ready made js component) by custom I mean: having custom icons - so really just custom design no frameworks, written from scratch, lightweight, compatible with major browsers ...

How to get selection HTML and selection parent?

Several of years ago, I added "smart quoting" to a web forum. Basically, user selects a part in previous conversation and clicks a button to quote it. Script gets the HTML of the quote and goes up the DOM tree to figure out who said that. I could only do it for IE, although I remember trying hard. But then, there was no stackoverflow.c...

How to cancel drop event in YUI drag & drop utility?

We are using drag & drop utility between one source and multiple targets. We have a restriction that one of the target can only have one child element while the other ones can have multiple items. I have tried subscribing dragDropEvent of the proxy item and returning false in case the destination target has multiple child elements, wit...

I need some help with the Load function in JQuery

I currently have links w/ class="ajax" that I want to retrieve the element with id="test" from the file "data.html" in the same directory, and put that content into the id="content" div on my page: <script> $(document).ready(function(){ $("a.ajax").click(function(event){ $("#content").load("/data #test"); }); }); </script> <...

IE8 simple alert is failing!?

Why isn't the following piece of code working in IE8? <select> <option onclick="javascript: alert('test');">5</option> Quite bizarre - no alert is shown in IE8. I do not see the error icon in the left corner as well. Of course it works in FF and Opera. Any ideas? ...

jQuery Morph Classes

Im not sure if the title is what im trying to describe but ill have a go. I have two classes "big_green" and "small_blue" big_green = 100x100 green box small_blue = 50x50 blue box i remember there used to be a js library that allowed you to tween classes, i think it was mootools. Anyway, is there any way in jQuery to animate the cha...

First Column of a Grid is the headers?

Is there a way (using jquery, yui or some other js library) to display a grid that has the headers in the first column? That is, I would have something like: Name Geoffrey EMail GMan67@.. Username GJFM Instead of: Name EMail Username Geoffrey GMan67@.. GJFM G-Man ...

How can I "escape" quotes in javascript?

I don't know if "escaping" is the right word (please tell me what the right word/phrase is) but in Ruby you can say something like text = "This is visit number #{numVisits} to this website" so you can skip concatenation etc. I'm working in JQuery and have a bit like this: $(document).ready(function(){ $("a.ajax").click(function(...

Javascript function wrapper fails?

I am looking to add functionality to a jQuery method. I have the code $('li.s').appendTo('#target'); There are multiple elements which match li.s, and I can see it's grabbed correctly using Firebug. The append method works fine without my wrapper. However, with my wrapper (which shouldn't change anything about the function): var o...

Rails escaping quotation mark in link_to_function partial

I have a little piece of rails code which lets users enter a review. If one already is written it displays the current review with a link to edit it. <div id="text_area"> <% if @user_rating.review.blank? %> <%= render :partial => "reviews/text_area" %> <% else %> <%= simple_format @user_rating....

How to combine variables with Jquery?

Hey Guys, Got the following code: $(document).ready(function() { $('a.add-item').click(function() { if ($(this).parent().find('input').attr('value', '0')) { $(this).parent().find('input').attr('value', '1') } }); }); What I would like to do is to create a variable and increment it and...

Logarithmic slider

I have a slider with steps 0-100; I want the range to be from 100 to 10,000,000. I've seen some functions scattered around the net but they're all in C++; i need it in javascript. Any ideas? ...

mouseover() mouseout() jQuery add/removeClass problem

I am trying to create a simple mouseover effect using a combination of mouseover, mouseout, addClass, and removeClass. Basically, when the user mouses over an element, I want to apply a different border (1px dashed gray). The initial state is "1px solid white". I have a class called "highlight" which simply has "border: 1px dashed gra...

target a specific page in iframe

hi, I'm running the CMS indexhibit, indexhibit uses an iframe to load it's content. http://www.therussianfrostfarmers.com/ My homepage has WordPress loaded into this iframe, which works ok, i've got some scrollbar issues, but that another problem. Currently, when ppl find a WP post through there search engine, the user is redirected t...