javascript

How to remove first element of an array in javascript?

var arr = [1,2,3,5,6]; I want to remove the 1st element of the array so that it becomes: var arr = [2,3,5,6]; How? Edit To extend this question, what if I want to remove the 2nd element of the array? ...

Calling/Inserting functions before jQuery's document.ready

Hi all: I need to be able to insert or call a function before document.ready() is called in jQuery. I'm invoking the document.ready function from another file, which theoretically gives me control over when document.ready is called. Source file (.js): $(document).ready(function () { // some code... }); Technically, however, as ...

How to display a side bar menu

Using CSS Style Sheet for my Web page. I want to use a side bar menu in my web page. If i click the menu, the lift of sub menus will display on the left side. Html Code. <ul id="navlist"> <li><a id="n1" href="">Home</a></li> <li><a id="n2" href="">News</a></li> <li><a id="n3" href="">Events</a></li> <li><a id=...

Javascript escape quotes

This is so stupid, but I can NOT figure this one out. I'm outputting values from a database (it isn't really open to public entry, but it is open to entry by a user at the company -- meaning, I'm not worried about XSS.) I'm trying to output a tag like this: <a href="" onclick="DoEdit('DESCRIPTION');">Click Me</a> DESCRIPTION is actu...

Javascript HAML engine

I'm looking for a javascript 'port' of haml supporting the following features: Templates stored in files. JSON input. Supports "collections" [{Booking},{Booking},{Booking}] for iterated processing. Essentially I'd like the functionality as sinatra_more's templates. Does anyone know of something that fits the bill? ...

Populate 1 form field based on another

Hi There, Is there an easy way to populate one form field with duplicate content from another form field? Maybe using jQuery or javascript? Thanks, Jack ...

When To Refresh/Replace Cache in RSS Reader

For a simple rss reader, I am storing the results of queries in a client side (google gears) database. So, myapp.php?query=xyz is stored in one column, and the result xml is stored in the next column. Then, when myapp.php?query=xyz is requested, I first attempt to load from the cached content in the second column. I need to figure ...

How can I make JavaScript make (produce) new page?

I would like to make a button on a page that can call a JS function in the same page. the function will need to produce (open) new window which its HTML code was given from the JS function itself. How can I do that? The purpose of this is to produce a print friendly page out of a specific page. Please notice: No AJAX can be used. ...

Flash Lite 3.1 + javascript

I know almost nothing about actionscript. Is it possible for Flash Lite 3.1 to use the flash.external.ExternalInterface to allow javascript interaction? If it is possible, can someone explain why jPlayer (open source) doesn't work on the Wii? I have been looking for a flash mp3 player that will work on the Nintendo Wii and which suppo...

Jquery on curl fetched data

I have a div which is being populated through curl from another html page .Now the data is populating correctly but i want to use jquery or javascript on the ids or classess of the fetched data. I tried using livequery ,binding but of no use. Can you please help me . ...

page onload alerts

i want to show an alerts when a page loads .but i wat it to show only once in a session so that the users does not get disturbed. please help me with some javascript codes. in hope robin . ...

YUI Custom Event for Dropdown value pre-selection ?

I have a dropdown field and its value is pre-selected as soon as its rendered(Say, its a Country field in a signup form). And I have other dropdowns or other components which change the selected value of the first dropdown dynamically. Now I want to fire a method with every "value getting selected" in the dropdown. Is it possible? To pu...

Restricting open dialog box to certain files using javascript.

When uploading photos and videos, the open dialog box should default to file suffixes that are relevant. e,d when i uploading images, it should show only file with extension .jpeg, jpg, gif, png, bmp etc. And same with videos.. Thanks. ...

How can a javascript function be fired when a user types text into an input field or pastes text into it?

$(document).ready(function() { $("input[id^='question']").live('keyup',function(ev){ id=this.id.substr(8); if (ajaxCallTimeoutID != null) clearTimeout(ajaxCallTimeoutID); ajaxCallTimeoutID = setTimeout(function(){subjectivecheck(id)}, 1000); }); }); There is a problem. When a user pastes text into an input field, the func...

Write to a textfile using Javascript

Under Firefox, I want to do something like this : I have a .htm file, that has a button on it. This button, when I click it, the action will write a text inside a local .txt file. By the way, my .htm file is run locally too. I have tried multiple times using this code, but still cant make my .htm file write to my textfile: function s...

How to efficiently build a random list from a given list without recurrences in JS?

I have a comma separated string, out of which I need to create a new string which contains a random order of the items in the original string, while making sure there are no recurrences. For example: Running 1,2,3,1,3 will give 2,3,1 and another time 3,1,2, and so on. I have a code which picks a random item in the original string, and t...

Decode the string encoded through php in javascript

Hi, I am working on a facebook page in which i have used ajax & response is returned in json format. I have encoded the string in php. Now i want to decode that string in javascript. foreach($feedbackdetails as $feedbackdetail) { $str.= '<div class="tweet"> <img style="cursor:pointer;" id="imgVoteUp" src="http://myserver/facebook/vote...

How can JavaScript make new page that contains more JavaScript?

I'm opening new page using JS and writing into it the HTML code, however when I try to write JS inside the new page using document.write() function it doesn't work. Apparently the main JS closes as soon as the it sees /script> which is intended for the JS of the new page that will be opened. Is there away around this? var opened = win...

Creating Javascript History like Object in Coldfusion

I want to create a History Object for my Website, It should be Similar to Javascript history object. I want to use this Object to Creating Previous/Next nevigational Links for my Website. The Problem with Javascript History Object is that it is based on the Window object, not a website specific. And Using this Object clicking on "Prviou...

Accessing a javascript object with jQuery

After creating an object with JavaScript I am looking to access it with jQuery to manipulate it. Here is some code to make things clearer: ObjectFunction = function(content) { this.content = content } ObjectFunction.prototype = { showobject : { return this.appendTo(document.body)} } obj = New ObjectFunction() What I would like ...