Search Results

Search found 4827 results on 194 pages for 'alert'.

Page 39/194 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • Can CoffeeScript Be Translated into This Piece of JavaScript?

    - by tangrui
    function abc() { var a = 1; var func = function() { var a = 2; } func(); alert(a); } Pay attention to the var, in the piece of code, the result of a will be 1, but if the var is omitted, the result will be 2, but I found Coffee not able to translate to this. For example the following: abc = -> a = 1 func = -> a = 2 return func() alert(a) return

    Read the article

  • Select statement to check multiple rows against 2 variables

    - by Duncan Cook
    I have the following table : alertID inspectorID datelive dateread 1 none 2012-11-06 10:36:03.350 NULL 2 none 2012-11-06 10:36:25.043 NULL 3 none 2012-11-06 10:36:42.433 NULL 1 31030 2012-11-06 10:37:19.193 2012-06-11 10:34:47.000 I want to select the alerts that dont have the inspectors ID against it AND where the alert ID doenst match the one that has the inspectorID against it, ie inspector has read alert 1 so i only want it to return alerts 2 & 3 Am using Classic ASP and MS-SQL Cheers

    Read the article

  • How do you hide an image tag based on an ajax response?

    - by Chris
    What is the correct jquery statement to replace the "//Needed magic" comments below so that the image tags are hidden or unhidden based on the AJAX responses? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>JQuery</title> <style type="text/css"> .isSolvedImage{ width: 68px; height: 47px; border: 1px solid red; cursor: pointer; } </style> <script src="_js/jquery-1.4.2.min.js" type="text/javascript"> </script> </head> <body> <div id='true1.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='false1.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='true2.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <div id='false2.txt' class='isSolvedImage'> <img src="_images/solved.png"> </div> <script type="text/javascript"> $(function(){ var getDivs = 0; //iterate div with class isSolvedImage $("div.isSolvedImage").each(function() { alert('div id--'+this.id); // send ajax requrest $.get(this.id, function(data) { // check if ajax response is 1 alert('div id--'+this.url+'--ajax response--'+data); if(data == 1){ alert('div id--'+this.url+'--Unhiding image--'); //Needed magic //Show image if data==1 } else{ alert('div id--'+this.url+'--Hiding image--'); //Needed magic //Hide image if data!=1 } }); }); }); </script> </body> </html>

    Read the article

  • Multiple Queues in jQuery

    - by kingjeffrey
    I am having problems using multiple queues in jQuery. Consider the following example: $('#example').click(function() { $(this).delay(1000, 'fx2').queue('fx2', function() { alert('here'); }); }); The alert never fires. Why?

    Read the article

  • Javascript setFullYear

    - by user187870
    var currentDate=new Date(); currentDate.setFullYear(2011); alert(currentDate); == this works, it sets the year to 2011 as expected. alert((new Date()).setFullYear(2011)); == this one doesn't work. Any idea why? Am I misunderstanding the syntax?

    Read the article

  • simple method that checks text is email with regular expression

    - by user223863
    Can't believe how difficult this seems to be all I want to is to validate a user inout using javascript to make sure that it is an email address. But can't get it to work: I am using: //validates a regulaer expression Utilities2.prototype.validateEmail = function(stringToValidateArg) { alert('about to check regexp'); var regExpPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; alert(regExpPattern.test(stringToValidateArg)); } But this always returns false, any ideas why is it because of the regular expression?

    Read the article

  • JavaScript Coding for Finding Shipping Total

    - by user2913279
    I am having a very hard time with this code. I have been working on it for days and cannot seem to figure it out. Please help!! Here are the specific I need for the code: Many companies normally charge a shipping and handling charge for purchases. Create a Web page that allows a user to enter a purchase price into a text box and includes a JavaScript function that calculates shipping and handling. Add functionality to the script that adds a minimum shipping and handling charge of $1.50 for any purchase that is less than or equal to $25.00. For any orders over $25.00, add 10% to the total purchase price for shipping and handling, but do not include the $1.50 minimum shipping and handling charge. The formula for calculating a percentage is price * percent / 100. For example, the formula for calculating 10% of a $50.00 purchase price is 50 * 10 / 100, which results in a shipping and handling charge of $5.00. After you determine the total cost of the order (purchase plus shipping and handling), display it in an alert dialog box. Here is the code I have: <!DOCTYPE> <head> <title>Calculate Shipping</title> <script type="text/javascript"> function parseInt() { var salesPrice = document.salesForm.Price.value; var minCharge = salesPrice + 1.50; var shipping = salesPrice * 10/100; if (salesPrice <= 25) window.alert('Your sales total including shipping is $' + minCharge); else window.alert('Your sales total including shipping is $' + salesPrice + shipping); } </script> </head> <body> <form name="salesForm"> <div > <p>Enter Your Purchase Price</p> <input type="text" name="Price" /><br /><br /> <input type="button" name="Calculate" value="Calculate Shipping" onclick="parseInt ()" /> </div> </form> </body> </html> Everything works except for the math in the alert box. It will show an incorrect total...

    Read the article

  • Can't get jQuery to get focus on cloned input fields

    - by Rebel1Moon
    I have a page that needs to create dynamic form fields as often as the user needs, and I am trying to use Ajax to tie it in to my database for faster form entry and to prevent user typos. So, I have put my Ajax returned data into popup div, the user selects, then the form field is filled in. The problem comes on the cloned fields. They don't seem to want to bring up the popup div when focused. I am thinking it is something to do with when they get created/added to the DOM. Here is my JS that creates the clones: $(document).ready(function() { var regex = /^(.*)(\d)+$/i; var cloneIndex = $(".clonedInput").length; $("button.clone").live("click", function(){ $(this).parents(".clonedInput").clone() .appendTo("#course_container") .attr("id", "clonedInput" + cloneIndex) .find("*").each(function() { var id = this.id || ""; var match = id.match(regex) || []; if (match.length == 3) { this.id = match[1] + (cloneIndex); } }); cloneIndex++; numClones=cloneIndex-1; //alert("numClones "+numClones); }); Here is where I expect to be able to get focus on the correct cloned field and call the popup. The baker_equiv0 id is original code, whereas baker_equiv1 is the first clone. $('#baker_equiv0').focus(function() { \\ THIS CODE WORKS $('.popup').fadeIn(500); $('#results').empty(); // document.enter_data.baker_equiv1.value="test"; THIS LINE WORKS //alert("numClones "+numClones); }); $('#baker_equiv1').focus(function() { // THIS DOESN'T EVER FIRE alert("numClones "+numClones); $('.popup').fadeIn(500); $('#results').empty(); }); Here is the HTML with the form: <label for="baker_equiv" class="">Baker Equivalent: <span class="requiredField">*</span></label> <input type="text" class="cinputsa" name="baker_equiv[]" id="baker_equiv0" size="8" ONKEYUP="get_equiv(this.value);"> If I put this in the HTML code above, it works fine: onfocus="alert(this.id)" I'd also be interested in how to adjust the JS code to work based on the id array created rather than having to copy code for each potential set of fields clones, i.e., baker_equiv[] rather than baker_equiv0, baker_equiv1, etc. Thanks all!

    Read the article

  • jQuery::Ajax success never occurs

    - by Legend
    I have an ajax call in the head section of my index.html $.ajax({ method: 'get', url : 'php/getRecord.php?color=red', dataType: "json", success: function (data) { alert(data); } }); For some reason, that alert never gets called. Am I doing something wrong? The PHP file does give me data when testing it directly.

    Read the article

  • openssl 0.9.8j connection issue

    - by Lambov
    I have a connection problem using openssl 0.9.8j. When I try to connect with s_client to one specified server openssl said: 640:error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3 _pkt.c:1060:SSL alert number 40 640:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:188 I tried option "no_ticket",I tried also "ssl2",all is useless. The problem occurs only when I try to connect to this server. Any ideas? Thanks!

    Read the article

  • VB6: assign javascript function to a dom element

    - by Fuxi
    hi, i'm using the mshtml library for parsing out html via MSHTML.HTMLDocument. my question: is there a way to assign a javascript function to a dom element? i've tried something like: div.onmouseover = "function(){alert('mouseover')}" and div.setattribute "onmouseover" , "function(){alert('mouseover')}" without success (no error but no effect either). anyone knows if its possible? thx

    Read the article

  • Is there a way to catch an attempt to access a non existant property or method?

    - by Tor Valamo
    For instance this code: function stuff() { this.onlyMethod = function () { return something; } } // some error is thrown stuff().nonExistant(); Is there a way to do something like PHP's __call as a fallback from inside the object? function stuff() { this.onlyMethod = function () { return something; } this.__call__ = function (name, params) { alert(name + " can't be called."); } } // would then raise the alert "nonExistant can't be called". stuff().nonExistant();

    Read the article

  • Loop through Javascript array, print with string.

    - by Adam
    I have a simple array like: var myArr=["one","two","three"]; an I have a counting loop, which increases the value of var "i" by one. What I want to do is print the next value from the array each time the loop runs, next to a text string, like so: alert('value number '+myArr[i]+); But for some reason I can't get this to work. The following code works, so I'm assuming I'm not calling the counter right: alert('value number '+myArr[0]+);

    Read the article

  • Make get function Sycronous / Javascript

    - by DDL449
    I'm experiencing a problem of $.get function. The url contains JSON this is my code: xyz = null $.get('http://www.someurl.com/123=json', function(data) { var xyz = data.positions[0].latitude; }); alert(xyz); //some more code using xyz variable I know that xyz will alert a null result because the $.get is asychronous. So is there any way I can use the xyz outside this get function? Thank you

    Read the article

  • on and off the user defined notification in status bar

    - by sairam333
    Hi i am displaying some alert message in the status bar depending up on my application condition.up to this the alert is displayed properly.But now i want if notification icon is appeared in the status bar when i saw once it(icon) will be removed from the status bar .and again it will be appeared depending up on condition .For this what can i do Give me some suggestions.Thanks in advance

    Read the article

  • what should be the good approach to write javascript code?

    - by Bhupi
    Hi, which should be the good approach to write javascript code and why? 1) var myClass = function(){} myClass.prototype.init = function(x, y){ this.width = x; this.height = y; } myClass.prototype.show = function(){ alert("width = "+ this.width+" height = "+ this.height); } 2) var myNewClass = { init : function(x, y) { this.width = x; this.height = y; }, show : function() { alert("width = "+ this.width+" height = "+ this.height); } }

    Read the article

  • MooTools is not a function js error

    - by Adriane
    hello whatever i append to $('click_filter1') it shows the error ... is not a function (for show(), hide(), toggle()) if i insert an alert, the alert gets executed, so the framework is init ok the element with the id exists for sure what can be the problem of this? why iam getting this error? $('click_filter1').addEvent('click', function() { $('click_filter1').show(); }.bind(this));

    Read the article

  • javascript htmlDivElement problem

    - by Fearghal
    Hi guys, I have a htmlDivElement (with no id) - and I'm trying to access and change the style of it.. Problem is everything I try returns 'Undefined' when i try to alert it Eg: alert (htmldivelementobject.className) I've also tried getAttribute but it returns the same thing... Where am I going wrong? F

    Read the article

  • Loop through array, print with string.

    - by Adam
    I have a simple array like: var myArr=["one","two","three"]; an I have a counting loop, which increases the value of var i by one. What I want to do is print the next value from the array each time the loop runs, next to a text string, like so: alert('value number '+myArr[i]+); But for some reason I can't get this to work. The following code works, so I'm assuming I'm not calling the counter right: alert('value number '+myArr[0]+);

    Read the article

  • Accessing class variable with string name?

    - by coure06
    I have a class like this $.fn.dimeBar = function(custom) { var var1 = 'test1'; var var2 = 'test2'; if(sometest){ //how can i access var1 or var2 here by using string name of variables //some thing like alert(this['var1']) -- should alert: 'test1' } }

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >