I want to use the same string in my img "src" in my "onclick" as a parameter to a function. What's the easiest way to do this? It works fine if I type it out both times but it doesn't look nice.
Here is an example so you can see what I mean...
<img src="/images/image1.jpg" onclick="doStuff('/images/image1.jpg')"/>
I'm wondering if th...
Basically, is there a way to 'cycle' through child elements.
i.e.:
some text
some more text
even more text
I want to get the text from the first '<'li'>', perform a few operations, then move on to the next one and next one until I have gone through all of the child elements. Is this possible?
...
I have ONE external JavaScript file containing jQuery, Cufon, fonts, and the replace functions. I need this file to be loaded twice once on page load and again 3 seconds after page load. Is this possible?
...
I'm aware that there is a Cross site forgery attack that can be performed on a request that returns an array by overloading the Array constructor. For example, suppose I have a site with a URL:
foo.com/getJson
that returns:
['Puff the Dragon', 'Credit Card #']
This would normally be Javascript eval'd by my own site after an XHR re...
How would you go about validating 2 different regular expressions in jQuery or JS?
My JS Code:
function validate(){
var MyField = document.getElementById('MyField');
if (MyField.value == null || !MyField.value.toString().match(/^(\d{3})-?\d{2}-?\d{4}$/) || !MyField.value.toString().match(/^(\d{2})-?\d{7}$/));
alert('Ivalid ...
I have a view that takes a Ruby Date, performs some formatting on it to output just the time in the format [5:30 PM]. Then by default it adds 30 minutes to that so the result is similar to the following output:
5:30 PM - 6:00 PM
and the code in the haml file looks like:
=format_time( @time ) + " - " + format_time( Time.parse( @time )....
I have a working Map function that uses a little bit of jQuery to
fetch JSON data. I have been trying for hours to update the function
for use with Maps 3.X API to no avail. I'm not very well versed with
Javascript and I made this function sometime last year.
Basically the function requires some parameters to query a url and get
JSON da...
I have an object structure/hierarchy like the one below:
var obj = {
dimensions : {
x : 100,
y : 100,
w : 300,
h : 400,
cmp : function () {
return this.x + this.y;
}
},
definition : {
base : {
rect1 : {
// how do I get th...
I have couple of questions about the javascript for loop.
First question:
for (i=0; i<=2; i++) {;}
console.log(i);
Output is 3. Shouldn't it be 2?
Second question:
for (var i=0; i<=2; i++) {
setTimeout(function(){console.log(i);}, i*1000);
}
Timeouts are set correctly: 0, 1000 and 2000. But the output is 3,3,3 (should be 0, ...
The ExtJS grid is awesome. However, the GPL license is not. Is there a similar alternative available under a more flexible license? It must have inline cell editing.
...
This things works perfectly
<select name="selectbox" onchange="alert(this.value)>
But I want to select the text. I tried in this way
<select name="selectbox" onchange="alert(this.text)>
It shows undefined.
I found how to use dom to get text. But I want to do this in this way, I means like using just this.value.
...
I have a code like this where I am trying to add an event handler to some button. I would like to use a global variable & store its current value in callback closure & not its reference.
var globalNum="dummy";
function A()
{
$("#button").click(function()
{
$("#button").append(globalNum);
});
}
globalNum="dummyAgain";
Now i...
Hi,
is it possible to use Raphael to manipulate an embedded svg? I used Raphael in the past to draw shapes, but haven't actually seen it being used to manipulate an existing svg image. If not, is there anything else that allows me to easily change colours, add events, etc to polygons of an embedded svg?
Cheers,
Max
...
Is it possible with JavaScript to find a given string of text on a webpage, and then calculate its distance (in pixels) from the top of the page? If so, an example would be appreciated.
...
I want to show progress bar just lightbox image shows and it should display 100 % progress bar status when i'm posting data from one page to other.
How can i do that?
...
Hello,
I am writing a simple form submit function for a specific site.
The script fills the specific form on the current page and submits the form. It MUST also fill the second form which appears after the first form is submited and submit this form too.
That is there are 2 forms that must be filled and submitted.
Problem however, is t...
Hey guys, I need help with GallerificPlus integration in drupal. Here is the code:
<script type="text/javascript" src="misc/gallerificPlus.js"></script>
<link rel="stylesheet" href="misc/galleriffic.css" type="text/css" />
<div id="galleriffic-container">
<div class="slider-content">
<div class="slideshow-container">
<div id="controls"...
Trying to use cdata to store css but chrome throws "Uncaught SyntaxError: Unexpected token <" for the first line below:
var default_style = <![CDATA[
.TTContent table td.Mission img { max-height: 15px;}
]]>.toXMLString();
Does anyone knows why?
P.s. the css is much longer in reality
Many thanks,
...
How to find whether javascript is supported by user's browser or not
...
hi
i want to set the cookie before the login lik:if the user fails to login by typing wrong user id or password
in 15 minutes then he should be restricted for the nest 15 minutes to login..
using Javascript i have set a cookie i want that if the user has exceeded 15 minutes from his first trail then he should recieve an alert or messag...