I have a button called 'create project', when user click the button, i want 2 things to happen
an ajax call to check if the user is allow to create a project
if allowed, then execute the button as normal, if not, then pop up a modal dialog saying he is not allowed to create a new project.
I have the following code
$('.create_proje...
This seems inconsistent, but probably is due to the fact that I'm new to javascript's prototype inheritance feature.
Basically, I have two base class properties, "list" and "name". I instantiate two subclasses and give values to the properties. When I instantiate the second subclass, it gets the list values from the first subclass i...
Why both
[] == false
and
![] == false
are true?
...
I know there are a few regex/lastIndex discrepancies but this one is new to me!
Expected behaviour: Creating a new regular expression (with literal/constructor) will, obviously, create a new RegExp object with a lastIndex property set to zero.
Actual behaviour: (in FF, Chrome): The lastIndex property seems to persist through multiple R...
I came across aSSL, which appears to be a couple of years old and was wondering if anyone has other examples of "secure" AJAX connection code? Obviously, this wouldn't be as secure as using a SSL certificate, but with the null character SSL attack out there (recently demonstrated against PayPal), would it be worthwhile to revisit someth...
I wrote a simple map implementation for some task. Then, out of curiosity, I wrote two more. I like map1 but the code is kinda hard to read. If somebody is interested, I'd appreciate a simple code review.
Which one is better? Do you know some other way to implement this in javascript?
var map = function(arr, func) {
var newarr = [];
...
Hello all,
I have a CSV file that is uplaoded to my server where a PHP script will parse and return output to JavaScript via AJAX.
The CSV file is made up of two rows. First row contains the column names and the second row contains the data. I am trying to write a script that will parse it in a form that will be usable by Javascript to...
Previously, Google's Friend Connect required users to upload a couple of files to their websites to enable cross domain communication and Facebook Connect still requires you to upload a single file to enabled it.
Now, Friend Connect doesn't require any file upload... I was wondering how they were able to accomplish this.
Reference:
htt...
Hey all,
Please tell me what is wrong with this code:
<script type="text/javascript" >
function createimg()
{
var img = new Image();
img.src='link/to/image';
img.alt='Next image'; img.id = 'span1'; img.style.zIndex = 10;
img.style.position = 'absolute'; img.style.display='block'; img.style.top =...
I have a C# application that generates an html document from transforming an xml file with an xsl file. In my xsl template I reference an external javascript file like this:
<script language="javascript" type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js" ></script>
after the transformation the previ...
Dear All,
in Javascript: Is there a way of checking if a mouseover event for some element has fired?
If yes, how?
T
...
Is it possible to capture the contents of either the Firefox or IE javascript error console? I'm thinking adding a feature where when a user clicks the 'Report A Bug' link on my site, it also sends along the contents of the console, incase there are any useful errors in it. That way I don't have to tell them to manually open it and copy ...
<script type="text/javascript">
$(document).ready(function(){
$("#trigger").click(function () {
$("#trigger-banner").toggle();
});
</script>
Help? Thanks!
...
I really don't want to use prototip or prototip2 because I have to pay for them and I only need to do one very simple alert. The user will submit a remote form and then a small alert will come up and fade out after 5 seconds or so. It doesn't even need any fancy styling. I'd ideally like to use scriptaculuos over jquery. I just have no i...
Hi Guys,
Say I have 2 divs:
<div>£ 21.99</div>
<div>£</div>
If I only want to select the div that contains the symbol only, how would I go about this?
I have tried:
if ($('div:contains("£")').length > 0)
{
$(this).addClass("pound");
}
...
I want to make a box on the page that contains a graph with a curve on it, then user can drag a few points around modifying the curve. Preferably javascript or something I can easy share variables with DOM and ASP.NET. I want to get out a certain number of the points. Creating new points and deleting them would be great too. This way I c...
My goal is to each div with a class of "main" to have a random background color. I have the script that generates the random color but, using jquery, I only seem to be able to apply it to all divs in the class. How can I select a div, apply the color, select the next div in the class, generate a new random color, apply it and repeat? Her...
There MUST be an easy way to do that! I didn't want to ask this question again if somebody already asked it but I couldn't find something similar in this site... anyway :
So I have a XML file :
<marker>This is a test & it's fun. é</marker>
So when I read this XML file with Javascript, I want to put it in a text input ...
Without using any JavaScript frameworks, how do I dynamically change the text within a SPAN element.
I know how to do this with a DIV, it would be the following:
document.getElementById('myDiv').innerHTML = '...'
What's the equivalent of this for a SPAN element?
...
I have created a greasemonkey script for a website. What the script does is adding a div at the end of the page.
document.body.insertBefore(myDiv, document.body.firstChild);
But now the site adds an iframe for google-ads, as a result my div appears in the iframe too, which is not what i want.How can i avoid the script to affect ifr...