javascript

JQuery UI Accordion - Sortable Problems

Hello, I'm using this code to make the accordion sortable, and to make the active accordion panel move to the top of the stack: $(function() { var stop = false; $("#ccaccordion h3").click(function( event ) { if ( stop ) { event.stopImmediatePropagation(); event.preventDefault(); s...

how to get the 'droppable' s offset().left and offset().top without using jquery, use raw javascript .

for some reason , i can't use jquery . this is my code: <!DOCTYPE html> <html> <head> </head> <body > <style type="text/css"> #draggable { position: absolute; width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px; border: 1px so...

Can't include facebook inside my codeigniter project

Hi guys. I wanted to include the facebook login inside my application. This is the sample code which I was provided with: <?php require 'facebook.php'; // Create our Application instance (replace this with your appId and secret). $facebook = new Facebook(array( 'appId' => 'my api goes here', 'secret' => 'my api secret goes ...

User cp1252 as Javascript charset in IE

I am having a HTML site declared and encoded as UTF-8. My Javascript sources are encoded with cp1252. So i use this to set the encoding <script src="my_cp1252_encoded_file.js" charset="cp1252" ></script> This works in Mozilla but not in IE. Ideas? ...

How should I create Javascript that works on different platforms?

I'm working on a project that basically shall result in something like "source-to-source compiler" for javascript. Actually this is just the question if it shall result in some kind of compiler. Here's what I want to do: I write Webapps in a generic way that shall be transformed into mobile device specific apps. So basically it's just l...

Are these two ways of constructing an object in JavaScript equivalent?

Given: function A(name) { this.name = name; } is: var a1 = new A("A1"); exactly equivalent to: var a1 = {}; A.call(a1, "A1"); a1.__proto__ = A.prototype; ? Thanks ...

Integrating reCAPTCHA with existing PHP script

Hi, I have a php script which uses the following line to submit a form : <form action = "javascript:void(null);" onsubmit = "load_ajax();" name = "myform"> Now, to protect bots from misusing the form I want to implement reCAPTCHA as described here : http://www.darksideofthecarton.com/2008/12/15/validating-recaptcha-with-jquery-and-a...

jgrid validation.

Hi, i have to put the validation on jgrid cell. Like user cannot be able to enter the any value in calender cell even not the numeric value. How can i prevent script injection in grid cells. Thanks ...

dynamically create table with time increments

I need to create a table with just 1 column containing times (starting from 4hrs) which increase in increments of 10 seconds for each row. So it needs to look something like this: 04hrs 00mins 00secs - 04hrs 00mins 09secs 04hrs 00mins 10secs - 04hrs 00mins 19secs 04hrs 00mins 20secs - 04hrs 00mins 29secs ..... 06hrs 59mins 50secs - ...

Self modifying html-JavaScript file.

I would like to have a html file with JavaScript, which (file) is able to modify its context. In more details, I imagine it like that. I have a html file, which I open with a browser. I have a text area there where I type my text and press submit button. As a result of that, the context of the form saved somewhere in the html file. What ...

Can I get on Javascript resource to load another one?

I have a scenario where I want a web page to contain a <link> to one Javascript resource, and have that resource load two other Javascript resources from the same webserver. Is this possible? Can it be done in a browser-independent fashion? This may sound a bit unusual, but there are complicated reasons why I'd like to be able to do t...

Naming an anonymous function

Is it possible to somehow set a name for anonymous functions? There is no need to add function names to the namespace for anonymous functions but I would like to avoid seeing a large amount of (?) in my javascript debugger so I can keep the call stack trace informative. Also can I safely pass normal declared functions as arguments inst...

Get caret position using jCaret Plugin in IE

I have problem with jCaret plugin in IE. jCaret downloads I want to get the caret position inside a textarea. My code looks like this: $('.myTextArea').click(function(){ var myCaretPos = $(this).caret().end; }); The problem in IE is that I only get correct result if the textarea is only one line, but if there are more than on...

jQuery: Selecting the text when p contains a listpoint

Hi all, I've got some comments in a guestbook. p containins '(In [ 'sometimes. The '(In [' sometimes contains a list. <div class="comment searchable"> <p> (In <a class="changeset" href="/../" sets mynumber">[Phonebook]</a>) </p> <ul><li><tt>Name</tt>, <tt>Number</tt> </li></ul> <p>is <a class="is new entry" href="/../mynumber">new ...

I have a login form with an event of clicking the enter key to submit the form, it is not working in IE

I have a login form with an event of clicking the enter to submit the form, it is not working in IE <form name="login" action="" method="post"> <ul> <li class="col1">E-mail Address</li> <li class="col2"><input name="email_address" type="text" class="textfiled" /></li> <li class="col1">Password</li> <li class="col2"><inpu...

"Moving" select values

I have two selects in my Spring form. The other contains all the possible values for user to select, and the other should show that the user has picked. Idea is, that the value moves from select box to another when clicking a button. I assume this can be done with Javascript, but is there any example how to get it work with Spring 3? The...

Get element by tag (with obscure character)

I could use a little help defining the method of getting a tag name when the tag name contains an obscure character. artist=(x[i].getElementsByTagName("content:encoded")[0].childNodes[0].nodeValue); I tried and failed with: artist=(x[i].getElementsByTagName("content" + : + "encoded")[0].childNodes[0].nodeValue); The full js current...

how do i select all a tags with href="#xyz"

hi guys, using pure javascript can i select all a tags with href="#xyz". And also i would like to trigger some event while clicking on that element too... how can i do that? PS: pure javascript means without using jquery or other frameworks ...

jQuery JavaScript Encoding HTML

How on earth do you encode HTML with jQuery/JavaScript? Havn't found any working solution after hours of Googling and surfing this site. This: jQuery('<div/>').text(value).html(); does not work with jQuery! ...

Call client script from button with submit behaviour false ?

How do I call a client script function from a server side button click(with submit behaviour set to false) . protected void Button4_Click(object sender, EventArgs e) { //System.Threading.Thread.Sleep(2000); lbDateTime.Text=System.DateTime.Now.ToString(); ClientScript.RegisterClientScriptBlock(this.GetType(),"success","saveSu...