I've written the following:
var pages=["[www.facebook.com] Facebook is cool. ","[www.bbc.co.uk] British broadcasting corporation. "];
function findScoreC2(s){
var scores=[];
var percentageScores=[];
var contentsArray=[];
s=s.toLowerCase();
for(i=0;i<pages.length; i++){
contentsArray=pages[i].substring(pages[i].indexOf("]...
Hi
I'm looking for a very light weight (small library) that can act as a JavaScript tab
I've looked at both JQuery's Tabs and Tabber.
Both look great and function flawlessly but they are both semi large downloads for what they just do.
Both, even with minimized and GZIP'd run around 18kb in size.
Does anyone know of a smaller, light...
I'm trying to load some ajax content into a table, unfortunately it's only loading the last row multiple times instead of loading each new rows.
This is the code I'm using:
function periodicRefresh()
{
$.ajax({
type: 'GET',
url: 'include/ajaxActions.php',
data: "action=displayLastEvent",
success: fu...
I've implemented this method in Javascript and I'm roughly 2.5% out and I'd like to understand why.
My input data is an array of points represented as latitude, longitude and the height above the WGS84 ellipsoid. These points are taken from data collected from a wrist-mounted GPS device during a marathon race.
My algorithm was to conve...
Hi! I'm trying to reuse parts of some JQuery code I've used before for another website, but for some reason, this use of it is causing the whole page to be blank. When I comment the JQuery code out, it displays as intended. The code is below (this is inside my <head> element):
<head>
<!-- Jquery Stuff -->
<script type="text/javasc...
I searched Google for HTML/CSS/JavaScript training videos but I am not able to decide which one is better. I have subscription of LearnVisualStudio.NET and the videos are value for money. Are there any similar videos for HTML/CSS/JavaScript?
...
Does anyone know of a lightweight (small file size) HTML background color fader?
Something like the below pseudo-JavaScript
fadeDiv('div_element_to_fade','hex_start_color','hex_end_color','speed_of_fade');
...
Does anyone have a good reason to use one over the other? As far as I can tell, create/append node simply prevents you from creating invalid code, while innerHTML allows you to inject multiple nodes at once.
Given that I need to insert several tags, it seems to make sense to use innerHTML. Does anyone have a different take?
...
I want to change the background color of 'exampleDiv' from the original white background to when I call the code below to immediate change the background yellow and then fade back to the original white background.
$("#exampleDiv").animate({ backgroundColor: "yellow" }, "fast");
However, this code does not work.
I have only the JQuery...
I'm using window.onload to call my JavaScript code that has to be executed after the page is fully loaded. From what I read this is the recommended method to call such scripts.
However, it does not work for some Ajax sites, www.bing.com for instance - window.onload is called before the pages is fully rendered.
Any suggestions?
...
How to set a JavaScript function as handler in the event onclick in a given field of a Django Form. Is this possible?
Any clue would be appreciated.
...
I need to port some JS code which involves Math.random()*2147483648)^(new Date).getTime(). While it looks like for smaller numbers, the python function and the JS function are equivalent in function, but with large numbers like this, the values end up entirely different.
Python:
2147483647^1257628307380
=1257075044427
Javascr...
I have a timer in my javascript which needs to emulate clicking a link to go to another page once the time elapses. To do this I'm using jquery's click() function. I have used $().trigger() and window.location also, and I can make it work as intended with all three.
I've observed some weird behavior with click() and I'm trying to unders...
I'm currently creating an iPhone web application for piano chords, and I wanted to add an option that would let the user press a Play button and play the selected chord. However, I'm not sure how to do this, or if it's even possible.
Basically, is there any way to programmatically (through Javascript) play a sound file (wav, mp3,...) in...
I have a JavaScript array of houses like so,
{
'homes' :
[{
"home_id" : "1",
"address" : "321 Main St",
"city" : "Dallas",
"state" : "TX",
"zip" : "75201",
"price" : "925",
"sqft" : "1100",
"year_built" : "2008",
"account_type_id" : "2",
"num_of_beds" : "2",...
I have a Django form that needs to do some client-side validation before submitting the form. This is the code in the template:
<form action="/{{ blog_entry.id }}/addComment/" method="post">
{{ commentForm.name.label_tag }}
{{ commentForm.name }}
<span id="spanNameReq" style="color:Red; display:none;">Required</span>
<br />
{{ com...
Here is my main page code:
<form><iframe name="iframe_pic" src="iframe.html"></iframe></form>
Here is my iframe.html:
<script type="text/javascript">
function reset_imageform(){
f = document.getElementById("pic_form");
f.src=f.src;
}
</script>
</head>
<body><form name="pic_form" id="pic_form" enctype="multipart/fo...
Basically I want to check what url the user is on and compare it to a default value and then run a statement
Let's say my url is http://stackoverflow.com/questions/ask, I'm trying to do this, and it's not working:
<script type="text/javascript">
if(document.location.href('/questions/ask') > 0)
{
[do this];
}
Thanks for...
I have set the target of the "pic_form" to a div (pic_target).
The form (pic_form) and the div (pic_target) are both inside the same iframe (iframe_pic).
Whatever I set the target to of the "pic_form", a new page pops up and there is my php script (imageUpload.php) output... WHY?
Here is my main page code:
<form><iframe name="i...
i have string stored in python variables, and i am outputting a html that contains javascript, and the i need to create javascript variables.
for ex, in python
title = "What's your name?"
i use Cheetah to generate the html.
Cheetah code:
var title = '$title';
how do i escape this correctly so that a correct javascript variable is ...