It sounds a lot more complicated than it really is.
So in Perl, you can do something like this:
foreach my $var (@vars) {
$hash_table{$var->{'id'}} = $var->{'data'};
}
I have a JSON object and I want to do the same thing, but with a javascript associative array in jQuery.
I've tried the following:
hash_table = new Array();
$.eac...
I'm trying to read the contents of the clipboard using Javascript. With Internet Explorer it's possible using
window.clipdData.getData("Text")
Is there a similar way of reading the clipboard in Firefox, Safari and Chrome?
...
I'm trying to dynamically add some textboxes (input type=text) to a page in javascript and prefill them. The textboxes are coming up, but they are coming up empty. What is the proper way to pre-fill a textbox. Ideally I'd love to use the trick of creating a child div, setting the innerhtml property, and then adding that div to the par...
I'm working on a project that combines .NET with some legacy ASP code via COM interop. The legacy ASP is written in JScript - files look like this helloworld.asp example.
<%@Language="JScript"%>
<html>
<head>
<title>Jscript ASP Page</title>
</head>
<body>
<h1>JScript ASP</h1>
<p>This is JScript ASP at <%=new Date()%></p>
<%
va...
I am trying to link to a file that has the '#' character in via a window.open() call. The file does exist and can be linked to just fine using a normal anchor tag.
I have tried escaping the '#' character with '%23' but when the window.open(myurl) gets processed, the '%23' becomes '%2523'. This tells me that my url string is being esca...
I have an array i've create in Javascript. The end result comes out to element1,element2,,,element5,element6,,,element9.... etc
Once passed to coldfusion, it removes the null elements, I end up with element1,element2,element5,element6,element9
I need to maintain these spaces, any ideas? My problem may begin before this, to explain in...
I have a rails app that has picked up a bit of traction, but I have a serious headache to deal with. It's a basic sort of asset manager application - users upload their photos, .pdfs, videos, etc., and the system allows them to manage how that asset is presented.
I started with a fairly standard rails view - just what gets generated by...
Hello All,
I am looking for reference documentation for designMode in Firefox 2/3 and IE 6/7/8. Does anyone have links to good references?
...
Which algorithm does the JavaScript Array.sort() function use? I understand that it can take all manner of arguments and functions to perform different kinds of sorts, I'm simply interested in which algorithm the vanilla sort uses.
...
Hi
I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can't seem to find anything on Google so I am wondering if i...
I am building a Flex Application that calls a .aspx page on the same webserver which builds a PDF report using SQL Reporting Services. When the report is built it prompts the user to open or save the PDF.
We are trying to find a way to display a Progress Bar to let the user know that the report they requested is being built, and then de...
When debugging JavaScript in Visual Studio 2008 and I use the ? command in the command window to list a JavaScript object's members I always get that ellipses {...}. Example:
>? Page_Validators
{...}
[0]: {object}
[1]: {object}
[2]: {object}
[3]: {object}
[4]: {object}
[5]: {object}
length: 6
I'm assuming...
Hello Javascript experts
Today I had a discussion with a colleague about nested functions in Javascript:
function a() {
function b() {
alert('boo')
}
var c = 'Bound to local call object.'
d = 'Bound to global object.'
}
In this example, trials point out that b is not reachable outside the body of a, much like c is. ...
Finding out what's selected in real browsers is as simple as:
var range = {
start: textbox.selectionStart,
end: textbox.selectionEnd
}
But IE, as usual, doesn't understand. What's the best cross-browser way to do this?
...
Using jQuery, how would you show() every div.foo on a page in a random order, with a new one appearing every X milliseconds?
Clarification: I want to start with all these elements hidden and end with all of them showing, so it wouldn't make sense to show() the same element twice.
I originally thought I'd make an array listing all the e...
I have a script that slides a div down from behind the menu, when people click on the tab. However its in jquery and I want to use mootools (lots of reasons I wont go into here). However im stuck with mootools 1.1 at present. But for some reason my attempt is not working :(
The html
print("code sample");
<div id="panel">
<form a...
I am working on a web page that is using jQuery. I have an ajax call that gets data from the server an updates a div. Inside that data there is a jQuery function; however, the function is not being called after the data is loaded into the page. I have the proper js files include in the page already.
This is what is returned from the aja...
Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <script> and/or </script> tags up within document.write() calls?
I noticed that Amazon does this as well, for example:
<script type='text/javascript'>
if (typeof window['jQuery'] == 'undefined') document.write('<scr'+'ipt type="te...
I am playing around with MVC and have started setting up an existing site we have built in standard .Net Forms.
I am only including a JS file and as all the requests are being routed via .Net it is trying to compile it.
It is the standard compilation error you would see with invalid c#:
CS1012: Too many characters in character literal...
<?php
function toconv(string)
{
$gogo = array("a" => "b","cd" => "e");
$string = str_replace(
array_keys( $gogo ),
array_values( $gogo ),
$string
);
return $string;
}
?>
How can I implement that in JavaScript?
...