Basically I was trying to replicate one of the things that xajax gave me with Jquery -> The ability to define what my response modifies server side without setting anything up client side. Works perfectly as is, but each time I want to call a different Jquery function, I have to add it to my if statements.
Each element in the response...
Currently browsers have incomplete caching implementation. It only allows to set expiration or keep immediate expiration. Important 3rd option to expire cache programmatically is missing. Without that 3rd option developers cannot deploy new version of code efficiently and reliably.
If they use 2nd option it is inefficient if they have ...
How do I append a row to a table using the prototype library.
This is part of a form so I would like to also find a way to increment the <input name="container[0]"> value. Is this possible?
...
I start with this markup:
<div>
<span>
<label for="Item[0]">Item #1</label>
<input type="text" value="" name="Item" id="Item[0]"/>
</span>
</div>
On each button click I want to add another section exactly as the one above but with an incremented index.
<div>
<span>
<label for="Item[0]">Item #1</label>
<input typ...
I am pretty new at Javascript so I may not be using the exact terminology.
Suppose that I define an object literal as such.
var myObj = {
someMethod:function() {
//can we have access to "someValue" via closure?
alert(someValue);
}
}
And then we assign the function to another object like this.
var myOtherObject = ...
I'm using the jHtmlArea jQuery plugin on my page and I'm making it visible onClick of a button. Now I'm trying to place the focus into the jHtmlArea editor once it's displayed, but just can't seem to get there.
I did find this blog post Setting Focus to Control in an IFRAME using jQuery which is talking about setting focus to an element...
This seems like a problem someone would've already solved in the year 2009, but I can't find a decent JavaScript library that will take a number like:
12345.58
And format it correctly based on a specific culture (ie, "nl-nl") or ISO currency code.
dojo showed promise, but it doesn't include many cultures by default, and actually wasn'...
I'm writing a simple jQuery plugin, but I'm having trouble being able to use multiple instances on a page.
For instance, here is a sample plugin to illustrate my point:
(function($) {
$.fn.samplePlugin = function(options) {
if (typeof foo == 'undefined')
{
alert('Already defined!');
} else {
var foo = 'bar';
...
I always thought that an if statement essentially compared it's argument similar to == true. However the following experiment in Firebug confirmed my worst fears—after writing Javascript for 15 years I still have no clue WTF is going on:
>>> " " == true
false
>>> if(" ") console.log("wtf")
wtf
My worldview is in shambles here. I cou...
I have a JavaScript application which opens an ExtJS Window, containing an ExtJS TabPanel, which has a tab containing a Data Grid, showing approximately 900 - 1000 rows, each with 7 columns of text fields. The grid may also be filtered to show about 100 rows at a time. When the window opens, navigating to this tab can cause Firefox or Sa...
Suppose I have a javascript variable "is_valid"
If the variable is 1, I'd like to display:
<div>It's valid!</div> ...and a big chunk of other code
Otherwise...
<div>NOT valid</div>...and a big chunk of other code
I do NOT want to use INNERHTML. I want to do it like this:
<script type="text/javascript">
if(is_valid == 1){
</sc...
I am dynamically adding X canvas elements to a page via jQuery like so:
$(document).ready(function() {
for(i=0;i<4;i++) {
var can = $(document.createElement("canvas"))
.attr("id","table"+i)
.addClass("table")
.attr("width",640)
.attr("height",480)
...
So, I have this pretty complex ajax thing going.
It loads new html (including div tags and all) to show up on the page.
I included a 'more' link to load additional data.
This more link links to my javascript function. The 'more' link is located in a div, which I gave a unique id. The next time the load function is called, I use documen...
I want to create a simple button that will inject a [b][/b] into a textarea.
How can I do this?
...
i need to create a frameborder=0 iframe with no scroll bars.
it needs to automatically resize it's width basedon the browser window's current width.
its height needs to be based on the document.length. so if its a long page, iframe needs to stretch way down.
this way, there is no scrollbar created in teh iframe.
...
I have a string such as
<html><body><div id="message">Hello World!</div></body></html>
and I would like to get the content of the #message element without parsing the HTML myself.
I thought maybe I could create a document object from a string in Gecko (this is for a Firefox add on) but I don't see any simple way.
I noticed that ther...
Here is a simplified version of my page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
var cbFuncInit = f...
I want to be able to have default text like "Enter content here..." appear when the editor first loads, but I want this text to disappear when the user clicks/focuses on the content area. Then, if they "blur" (move out) of the content area without inputting anything, I want the "default text" to re-appear in the editor.
After Googling a...
I'm trying to redirect a page using javascript output using php.
The problem I'm having is passing the ampersand as you can see below.
Input
$url = 'number=1&id='.$usrid->id;
echo "<script type='text/javascript'>
window.location = 'directory?$url';
</script>";
Output
The above return on browser address bar this:
http://www...
Switch cases are usually like
Monday:
Tuesday:
Wednesday:
etc.
I would like to use ranges.
from 1-12:
from 13-19:
from 20-21:
from 22-30:
Is it possible? I'm using javascript/jquery by the way.
...