javascript

Move an item up/down a select

Hi, I'm wondering if it's possible to change the order of things in a select control without having to totally rebuild it? Is there a javascript function where I can change the "index" of a specific option in the select? Thanks ...

Server or CLIENT side Custom ASP.Net Controls???

Hello ! I am an undergraduate student , and working on my Final Year project these days. I have some queries related to Custom Controls as follows: I am designing a text box field which will have three or more functions as follows : Either it will allow numeric characters only Or it will allow an email address to be taken as input Or i...

Same JQuery click function for numerous links

Good beautiful afternoon everyone, I've been stalking the JQuery fourms trying to get a good clean solution to this problem, however, I can't seem to knock this one out. I have a page that has multiple links with various attributes (these attributes will be pulled in from a database): index.php <html <head> <script type='text/javas...

How to get the current time/timezone of the user visiting my website?

I am working on an application which utilizes PHP (Zend Framework) and JavaScript (jQuery). I'm trying to get the current time of the user visiting the site. Is this possible? How can this be done? ...

From where can i get Light Window 2.0 or similar?

Hi, After seeing tons of web site using modal window with a nice expansion animation i wanted to use it also. I googled it and found that many people recommend to use Light Window 2.0 For example http://www.ajaxdaddy.com/lightwindow.html but all sites linked to http://stickmanlabs.com/ are broken and i can't get Light window 2.0 Is an...

Javascript disable button event completely.

Hi I would like to know if its possible to do something similar to the example shown below. // Script A $('.submitButton').click(function() { if (not valid) { $(this).attr("disabled", "disabled"); } }); // Script B $('.submitButton').click(function() { // Do something else here }); I would like to know whether you ca...

How do I use Dojo CDN + my.name.space.widget?

I want to use a CDN version of Dojo but I also want to use my collection of widgets in my own name space. How do I make the two play together? ...

Javascript Browser Issue

I'm new to javascript, my script is designed to display either one image or the other image with a 50/50 chance. It worked in safari but not in firefox, this cuts out too many customers for the website I'm designing for. Any help would be appreciated, especially if anyone could say how to make sure it would work across all browsers. Oth...

Hide HTML element by id

Hopefully there's a quick and dirty way to remove the "Ask Question" (or hide it) from a page where I can only add CSS and Javascript: <div class="nav" style="float: right;"> <ul> <li style="margin-right: 0px;" > <a id="nav-ask" href="/questions/ask">Ask Question</a> </li> </ul> </div> ...

run function at ready and keyup event

Is there another in jquery to run a function at page load and at a keyup event instead of the way I'm doing it? $(function() { totalQty(); $("#main input").keyup(function() { totalQty(); }); }); ...

How can you pass JSON Object of option parameters to open a new window?

the window.open() object has some funky parameter list... is there a way to do something like window.open({options..}); Thoughts? ...

Calculating the average

This is a related question to one I posted earlier... I'm trying to sum all the input elements that begin with 'pull' and place that total in the 'totalpull' input field. I have that part working. Now, I'm trying to calculate the average if a user enters something manually in the 'totalpull' input field and set each 'pull' input to tha...

Is it better to swap classes or swap content in jQuery

I was wondering which of these two scenario's works best for swapping between 2 stated. Let's say for temporary disable a button. I think the first and most easy way is just to have both pieces of html already in place. And when clicked the a class of none is swapped, like this: css: .none{display:none;} html init: <div class"somecss ...

jQuery: Showing source of one <div> in another with a regular expression

Ok I give up and would really appreciate it if you guys could cast their eye over this for me? I'll try not to ramble. Goal is to have a 'rendered-view' showing 'rendered' HTML (clickable links) and 'source-view' showing the actual HTML of whatever is in the rendered view. When a link is clicked it is made not a link any more and simply...

Javascript image load: get error status

Hi, I am loading a image trough javascript: myimage.src = "/mycontroller/mymethod"; myimage.alt = "image"; myimage.onload = function(){ $('body').append(myimage); }; But, somethimes my controller method should return an error, with the http status 500. So, the content-type will not be "image/png" anymore. Will be text. There's...

Javascript global variable question

I wanted to show problem with this video. Please watch... I've 2 pages. Second page is sending selected pictures to the opener window(first one) using fResimleriEkle function. I'm setting every element of array to another array variables (ArrResimler and ArrMetinler). But when i fire the fAlbumOlustur function by clicking to button, i...

An rss parser tutorial

Know any updated ones that are good? ...

onclick multiple event handling for external javascript

The problem: making a very simple style switcher with js (without inline event handling). This is probably easy to do. I've confused myself with handling multiple onclick events however and just proped everything up with inline. Anyone know how to handle multiple onclick events? The Html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ...

Disregarding speed and compatibility, why not use only classes and never use IDs in HTML/CSS ?

I use only classes and never use IDs. Many people like to use IDs for different reasons. I've seen many questions regarding IDs vs classes on stackoverflow, but no one addressed pure code organization point of view disregarding compatibility and runtime performance. From code organization point of view, I think that using IDs is bad ju...

What is the difference between globally declaring a function and using window.myfunc = myfunc

What is the difference between the following 2 examples of code: (function(){ var myFunc = (function(){ //do something })(); window.myFunc = myFunc; })(); and var myFunc = (function(){ //do something })(); ...