I was trying to benchmark the gain/loss of "caching" math.floor, in hopes that I could make calls faster.
Here was the test:
<html>
<head>
<script>
window.onload = function()
{
var startTime = new Date().getTime();
var k = 0;
for(var i = 0; i < 1000000; i++) k += Math.floor(9.99);
var mathFloorTime = new Date().getTime() - s...
I have a two page site.
Each page contains a header with "tabs" at the top, to navigate between page 1 and 2.
When a tab is selected, I need the selected page to re-POST to the server, to quickly refresh before it is displayed.
I have a form on each page that allows a manual refresh from that page but need to submit that form from the...
Hi all,
I am writing a web app with asp.net, c# and jquery.
Most of the time I'm writing dynamic html to the browser and using different web services to get the content needed.
My call to the service:
function WriteProducts(currentIndex, selectedCategoryId, callback) {
var d = new Date();
MyAppServices.GetProducts(selectedCate...
Hi!
I've recently come up with the idea to create a tag cloud like animation shaped like the earth. I've extracted the coastline coordinates from ngdc.noaa.gov and wrote a little script that displayed it in my browser. Now as you can imagine, the whole coastline consists of about 48919 points, which my script would individually render (e...
This is my Javascript function which grabs an rss feed via the proxy script and then spits out the 5 latest rss items from the feed along with a link to my stylesheet:
function getWidget (feed,limit) { if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest()
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP")
...
For instance, I am setting an interval like
timer = setInterval(fncName, 1000);
and if i go and do
clearInterval(timer);
it does clear the interval but is there a way to check that it cleared the interval? I've tried getting the value of it while it has an interval and when it doesn't but they both just seem to be numbers.
...
I have two Select lists, between which you can move selected options. You can also move options up and down in the right list.
When I move options back over to the left list, I would like them to retain their original position in the list order, even if the list is missing some original options. This is solely for the purpose of making ...
I would like to implement windows style multi-selection:
when user holds CTRL key and selects several nodes of the tree.
Dynatree (from here http://wwwendt.de/tech/dynatree/doc/dynatree-doc.html) by default has checkboxes for node selection which my client doesn't seem to like.
My question is, is it possible to implement what I need ...
I asked this question a while back and was happy with the accepted answer. I just now realized, however, that the following technique:
var testaroo = 0;
(function executeOnLoad() {
if (testaroo++ < 5) {
setTimeout(executeOnLoad, 25);
return;
}
alert(testaroo); // alerts "6"
})();
returns the result I exp...
In a normal aspx page I've set up a jquery tab system. When a particular tab shows up I wire up an ajax call to get another html page with the following content. It is simply a form with some javascript inside of it.
<!-- demo.htm -->
<form method="post" action="post.aspx">
<div id="fields">
Class: <input id="txtclass" name=...
I have a variable that has this string:
<DIV><SPAN style="FONT-FAMILY: Tahoma; FONT-SIZE: 10pt">[If the confirmation is active the subscriber will receive this email after succesfully confirming. If not, this will be the first and only email he will receive.]</SPAN></DIV>
<p align=center>
<input class=fieldbox10 type = 'button' name...
I'm trying to get cross-domain Ajax to work. I downloaded a PHP proxy script from the Yahoo Developer site, ran it from command line and verified that it receives the XML from the server with a GET request.
Now, I'm trying to connect to the PHP script within JS with no results. I have the following:
<script type="text/javascript" src=...
Below javascript statements will cause error, if ga is not declared.
if (ga)
{
alert(ga);
}
The error is:
ga is not defined
It looks undeclared variable cannot be recognized in bool expression. So, why below statement works?
var ga = ga || [];
To me, the ga is treated as bool value before "||". If it is false, expression afte...
Hi,
I need to insert code for flash to TinyMCE with JavaScript. If I insert the same code using HTML menu of TinyMCE, it automatically add flash icon to the editor. But if I insert the code using JavaScript, the actual code is inserted but it shows nothing on the screen.
One trick I found is toggle TinyMCE to normal textarea and back ...
By using document.referrer we will get all the reference of URL in JavaScript, such as the following:
http://localhost/testwordpress/wp-admin/admin.php?page=thesis-options&upgraded=true
From this output how can we extract the query string part only:
?page=thesis-options&upgraded=true
Is there any method in JavaScript?
...
Hi, I have this HTML:
<div id="mytabs">
<ul id="main-tabs">
<li><a href="">Link</a></li>
<li><a href="">Link</a></li>
<li class="filter">
<ul id="filter-controls">
<li><a href="">Filter by something</a></li>
<li><a href="">Filter by something</a></li>
<li><a href="">Filter by something</a></li...
I'm trying to reverse engineer how facebook handles their notifications, where when you get a message you get instantly notified via the browser.
I've fiddled with it for a little bit and realized that there is always a pending GET request "listening" if you will to some sort of update from the server. This appears to be some sort of...
I am making a site with two Youtube videos. These videos use the raw embed code from Youtube. The site's design doesn't work with any of the default Youtube sizes, so I am writing code to automatically resize the video. Here is my code. There will never be more than these two tags on the page, otherwise I'd do a better job selecting t...
Disclaimer: JS novice
I have a JS widget that depends on JQuery. The widget's going to be embedded in a 3rd party site but I figure out how to avoid declaring dependency on jquery on the widget-hosting page:
3rd party's page:
<head>
<script
type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"&g...
I have two related questions...
How do I update an HTML element (let's say a p tag) with the correct date when I click on a day in the jQuery UI datepicker plug in?
If I have another way to selecte a date aside from the datepicker, how do I then update the datepicker's selected date (it's adds a class of "ui-state-active" to the date)?...