Search Results

Search found 10381 results on 416 pages for 'delegate and events'.

Page 110/416 | < Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >

  • How To Alter This Code So That It Only Redirects If There Is No Mouse Movement

    - by user1426261
    I have the following java script which redirects the user to another website (google in this case). <script type="text/JavaScript"> window.setTimeout("location=('http://www.google.com');",5000); </script> However, although i want the website to redirect to another website, i dont want it to redirect for no reason. My aim is for the website to redirect automatically on the condition that the cursor hasnt been moved for a little while. is this possible?

    Read the article

  • how to hook a callback to click event of star rating control

    - by mohang
    I am using jQuery star rating control found at http://www.fyneworks.com/jquery/star-rating/#tab-Overview . I am using 5 stars, each star having a particular value from 1 to 5. The control is getting displayed and behaving properly. However, I have a requirement of getting the value of the star clicked, immediately after a star is clicked. I do not know how to do it. I appreciate your help.

    Read the article

  • Jquery - removing an image before the client browser attempts to download it

    - by ajbrun
    Hi there, I wonder if anyone could help me with a problem I've been having. I have a number of large images available, but due to space limitations, I can't create multiple copies of these at various sizes. I have used PHP GD functions to resize the images to the sizes I need and output them to the browser. This works, but obviously takes some processing time, which therefore impacts pages load times. I'm fine with this, but I only want to show the image once it's fully loaded, and have a loading gif in its place until that time. I'm using jquery to do this. The problem I'm having is making the page functional whether the client has javascript enabled or not. If JS is not enabled, I want standard img tags to be outputted, otherwise the images are removed and replaced with a loading gif until they have been fully loaded. The link below shows a simple non-javascript unfriendly example of a what I want to do (try turning JS off): http://jqueryfordesigners.com/demo/image-load-demo.php I've been testing the basics using the code below. The attr() function will be replaced with something like remove(). This is just a test to make something happen to the image before the browser tries to load it. $(document).ready(function() { $( "#Thumbnails .thumbnail img" ).attr('src', '#'); }); In IE, this works correctly - the image source is replaced with "#" BEFORE the client browser gets a chance to start downloading the image. In firefox however, it downloads the image, and THEN changes the source. It seems to me that firefox is loading the jquery onready event later than it should. As far as I know, this should be executed before the standard onload event and before anything has started loading. If it helps, I'm testing it with a good number of images on screen (81). Am I doing something wrong?

    Read the article

  • Why is post() not updating the DOM after it returns? Wierd timing problem observed.

    - by Sephrial
    Hi all, I have the following code that is really bugging me, I'm thinking perhaps the post() function needs to be blocking. I am new to jQuery(latest version) and AJAX, but I'm using ColdFusion which returns some HTML in the data variable. var dataResult; var statusResult; $.post('fh_result.cfm',$('#myform').serialize(),function(data,status){ dataResult = data; statusResult = status; }); //alert(statusResult); if ('success' == statusResult) { alert(statusResult); $('#result').html(dataResult); } When I uncomment out the first alert, it returns 'undefined' but then it goes into the if block and the next alert box it says 'success'. If I comment out that line it doesn't make it into the if statement at all. My guess is that I want to make this a blocking call or something because I want to insert the data on the page after the post. I also have a problem when I re-write the top code as follows: var dataResult; var statusResult; $.post('fh_result.cfm',$('#myform').serialize(),function(data,status){ dataResult = data; statusResult = status; alert(statusResult); $('#result').html(dataResult); }); //alert(statusResult); Now in this case, the alert says 'success' when I comment out the second alert box. When I uncomment it out, I get one alert that says success and the other that says undefined, but this time it updates the DOM with the result of the postback as desired. How can I do this without the alert box?

    Read the article

  • why this simple javascript doesnt work on friefox and chrome?

    - by user1647406
    why this simple code i have written wont work on fire fon and chrome but it works carefully on IE ? whats wrong whit this javascript code ? i just want to find a way too get selected checkbox text ( or label) and use it by $_post on another page . sorry for my bad english . <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <script type="text/javascript" language="javascript"> function ReadCheckbox() { var temp = ''; var radio; var popupTag ; for (var i=1 ; i<5 ; i++) { radio = document.getElementById('chk'+i); if(radio.checked == true){temp += radio.value} } document.getElementById('aaaa').value = temp; } </script> </head> <body> <label>What is your Site Address ?</label><br/> <label>NetNic.ir</label><input id="chk1" type="checkbox" value="NetNic.ir" /> <label>SarirWeb.Com</label><input id="chk2" type="checkbox" value="SarirWeb.Com"/> <label>LearnCD.ir</label><input id="chk3" type="checkbox" value="LearnCD.ir"/> <label>AnimLand.ir</label><input id="chk4" type="checkbox" value="AnimLand.ir"/> <br /> <br/> <textarea rows="2" name="aaaa" cols="20"></textarea> <input type="button" onclick="ReadCheckbox()" value="???" style="height:32px; width:83px;"/>

    Read the article

  • jQuery: How to use modifier keys on form submit?

    - by Svish
    Say I have a form that looks like this: [ Animal name input field ] Add button If I type a name and hit enter, an animal with the given name is added to a table. Works fine. What I would like now is to call the current way of working "quick add" and add a new feature called "slow add", which I am not quite sure how to do. Basically what I want is that if for example the shift key is held down when enter or the button is clicked, I want the form submit method to do something slightly different. In my case I want it to open up a form where more details on the animal can be added before it is added to the table. Problem is I'm not quite sure how to do this. I have tried add a FireBug console.info(eventData) in my current submit function and I have found that the eventData contains an altKey, shiftKey and controlKey property, but they are always undefined even when I hold those keys down. So, does anyone know how I can do something special in my submit handler when certain modifier keys were pressed when the form was submitted?

    Read the article

  • How do I bind a click to an anchor without a framework (javascript)

    - by Stomped
    I know this is easily done in jQuery or any other framework, but that's not really the point. How do I go about 'properly' binding a click event in pure javascript? I know how to do it inline (I know this is terrible) <a href="doc.html" onclick="myFunc(); return false">click here</a> and this causes my javascript to execute for a JS enabled browser, and the link to behave normally for those without javascript? Now, how do I do the same thing in a non-inline manner?

    Read the article

  • Can you use Javascript to detect a file download window created server side?

    - by Zacho
    I have a jQuery plugin I use to dynamically create and render a form on a default.aspx asp.net page, then submit it. The page it gets submitted to is a pdf.aspx page. The page builds a PDF then uses Response.Write to write the file (application/pdf) to the browser. I use the same method to render XLSX files to the browser as well. It works really great, but I need a callback or some event to tell the button when to stop spinning. This prevents the user from continuously clicking the Excel or PDF buttons. Does anyone know a way to detect the file dialog window when it was not created using javascript? I am also open to other methods of callback from the server side as well.

    Read the article

  • jQuery: Apply css to image on click event

    - by DasRakel
    I want basically the same as http://stackoverflow.com/questions/530701/jquery-select-image a row of images that you can select one of. But I'm trying to style the one I select, and store it. var selectedicon = ""; function selecticon(){ $('#iconselect').children().click(function(){ $(".selectedicon").removeclass("selectedicon"); selectedicon = $(this).attr("src"); $(this).addclass("selectedicon"); }); } on this <div id="iconselect"> <img src="/red-dot.png" class="selectedicon" /> <img src="/green-dot.png" /> <img src="/blue-dot.png" /> <img src="/orange-dot.png" /> </div> What am I doing wrong?

    Read the article

  • how to watch input buttons with specified name?

    - by user393087
    For example I have long list of buttons: <input type=button name=clickbutton onclick='dosomething(this)'> But instead of putting call to the same funcion in every button it would be more rational to add a single listening event that would wait for click of that button with this name. But again, there are maany this buttons so I need pass clicked object to a function. For example this function must update a textarea field that is adjacent (nextSibling) to this button.

    Read the article

  • Actionscript: Switching back into previous function from event handler function

    - by J.Ded.
    I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards. The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?

    Read the article

  • Bind event to a div appearing

    - by AndyC
    Can I create an event so I can execute some javascript whenever an element with a specific ID becomes visible or appears on the page? The element comes from a remote resource (so isn't in MY html code but appears on page load) and I'd like some code to run when it appears (and only if it appears, it may not appear every load). Thanks!

    Read the article

  • Inputs inside ListView doesn't change values from old to recently set on ItemUpdating event

    - by Tema
    Hi, I would appreciate if someone help me to understand this situation. I do not know why but when i edit selected ListView item (containing few TextBoxes) and then press Update button in the ItemUpdating event i always get old values instead of those which were typed recently. Why? I do not use Page_Load event so i do not need check on PostBack I try to get value before i bind data from DB to ListView, so it can't override recently typed values I tried to get TextBoxes values in different Event handlers - ItemCommand, ItemUpdating, ItemDataBound - result si always the same Collection NewValues and OldValues are always empty (i think this is because i don't use SqlDataSource control) The only one way i can get new values - is to check Request, but in this case i can't use control validators ... so probably it is bad idea to work with only request. This is the code of ItemUpdating method: ListViewItem editItem = AdminUsersListView.EditItem; Guid userId = new Guid((editItem.FindControl("UserId") as HiddenField).Value); Hashtable dataUpdate = new Hashtable { { "UserName", Request[ (editItem.FindControl("UserNameNew") as TextBox).UniqueID ] }, { "Email", Request[ (editItem.FindControl("Email") as TextBox).UniqueID ] }, { "IsApproved", Request[ (editItem.FindControl("IsApproved") as CheckBox).UniqueID ] == "on" }, { "IsLockedOut", Request[ (editItem.FindControl("IsLockedOut") as CheckBox).UniqueID ] == "on" } }; var x1 = dataUpdate["UserName"]; // this is corrent new value from Request var x2 = (editItem.FindControl("UserNameNew") as TextBox).Text; // this is WRONG! OLD! value from TextBox ... Why??? using (Entities entities = new Entities()) { aspnet_Membership membershipItem = entities.aspnet_Membership.Where(MBS => MBS.UserId == userId).FirstOrDefault(); membershipItem.Email = dataUpdate["Email"].ToString(); membershipItem.LoweredEmail = membershipItem.Email.ToLower(); membershipItem.IsApproved = Convert.ToBoolean(dataUpdate["IsApproved"]); membershipItem.IsLockedOut = Convert.ToBoolean(dataUpdate["IsLockedOut"]); entities.SaveChanges(); aspnet_Users userItem = entities.aspnet_Users.Where(USR => USR.UserId == userId).FirstOrDefault(); userItem.UserName = dataUpdate["UserName"].ToString(); userItem.LoweredUserName = userItem.UserName.ToLower(); entities.SaveChanges(); } AdminUsersListView.EditIndex = -1; AdminUsersListView.DataSource = _getDataList(); AdminUsersListView.DataBind(); Thanks, Art

    Read the article

  • Trying to use json to populate areas of my website using mysql, php, and jquery.

    - by RyanPitts
    Ok, so this is my first attempt at doing anything with JSON. I have done a lot with PHP and MySql as well as jQuery and JavaScript...but nothing with JSON. I have some data in a MySql database. In the codes below i am using a PHP file to retrieve the data from the MySql database and using json_encode to format it to JSON. This file is being called by the JavaScript that runs when the page loads (well, it runs on document.ready actually). I then use jQuery to access the JSON keys and values to fill in areas of the page "dynamically". Here is the code snippets i am using (excuse my "noobness" on writing these snippets, still learning all this). This is my script that is on my HTML page test.php: <script type="text/javascript"> $(document).ready(function(){ $.getJSON("json_events.php",function(data){ $.each(data.events, function(i,events){ var tblRow = "<tr>" +"<td>" + events.id + "</td>" +"<td>" + events.customerId + "</td>" +"<td>" + events.filingName + "</td>" +"<td>" + events.title + "</td>" +"<td>" + events.details + "</td>" +"<td>" + events.dateEvent + "</td>" +"<td><a href='assets/customers/testchurch/events/" + events.image + "'>" + events.image + "</a></td>" +"<td>" + events.dateStart + "</td>" +"<td>" + events.dateEnd + "</td>" +"</tr>" $(tblRow).appendTo("#eventsdata tbody"); }); }); $.getJSON("json_events.php",function(data){ $.each(data.events, function(i,events){ $("#title").html("First event title: " + events.title + " ..."); }); }); }); </script> This is the code for the php file being called by the above JS: json_events.php <?php require_once('includes/configread.php'); $arrayEvents = array(); $resultsEvents = mysql_query("SELECT * FROM events"); while($objectEvents = mysql_fetch_object($resultsEvents)) { $arrayEvents[] = $objectEvents; } $json_object_events = json_encode($arrayEvents); $json_events = "{\"events\": " . $json_object_events . " }"; echo $json_events; require_once('includes/closeconnread.php'); ?> This is my JSON that is held in the variable $json_events from my php file json_events.php: { "events": [ { "id": "2", "customerId": "1004", "filingName": "testchurch", "title": "Kenya 2011 Training Meeting", "details": "This meeting will be taking place on Sunday, February 10th @ 6pm. Get ready for our annual Kenya trip in 2011. We have been blessed to be able to take this trip for the past 3 years. Now, it's your turn to bless others! Come to this training meeting to learn how to minister to the people in Kenya and also learn what we'll be doing there.", "dateEvent": "2011-02-10", "image": "kenya2011.jpg", "dateStart": "2010-09-04", "dateEnd": "2011-02-10" }, { "id": "6", "customerId": "1004", "filingName": "testchurch", "title": "New Series: The Journey", "details": "We will be starting our new series titled "The Journey". Come worship with us as we walk with Paul on his 2nd missionary journey.", "dateEvent": "2011-01-02", "image": "", "dateStart": "2010-09-06", "dateEnd": "2011-01-02" } ] } This is my HTML on test.php: <table id="eventsdata" border="1"> <thead> <tr> <th>id</th> <th>customerId</th> <th>filingName</th> <th>title</th> <th>details</th> <th>dateEvent</th> <th>image</th> <th>dateStart</th> <th>dateEnd</th> </tr> </thead> <tbody></tbody> </table> <div id="title"></div> I have two questions really... Question 1: Does this code look like it is written correctly at first glance? Question 2: I want to be able to select only the title from the first event in the JSON array. The code i am using now is selecting the second events' title by default it seems. How can i accomplish this?

    Read the article

  • jQuery Mobile button js control

    - by David
    I have a button that is not triggering event in jQuery mobile. It was working but I had to remove the css. It was screwing up my all my ul lists. Any help would greatly appreciated Here is the code for the button at the bottom of the form : <div class="next"> <a class="btnNext">Next &gt;&gt;</a> </div> Which is supposed to do this on a separate js file: init: function(){ $('.btnNext').onclick(function(){ if ($('input[type=radio]:checked:visible').length == 0) { return false; } $(this).parents('.questionContainer').fadeOut(500, function(){ Here is the css I removed: a { border: 1px solid #000; padding: 2px 5px; font-weight: bold; font-size: 10px; background: #FFF; cursor: pointer; } a:hover { background: none; }

    Read the article

  • Javascript Shift+Enter (Firefox)

    - by Stephen MCGinley
    Hi guys, Had a look and found some things on this, but nothing seems to work as I'd like it. Initially I had my solution working with internet explorer and chrome, but not firefox (which is unsatisfactory for me to not have working) What I'm looking for is a simple text area, which sends data on enter key, but creates a new line on Shift+Enter. The following is what I have function goReturn(e,str) { var e = (window.Event) ? e.which : e.keyCode; if (e.shiftKey && e=="13") { document.getElementById("wall").value = document.getElementById("wall").value+"\n"; } else if(e=="13"){ // ...continue to send data } } This sends the data on enter, but also sends the data on shift and enter (which is the problem I have). Thanks for any assistance

    Read the article

  • How can I enter only numbers in TextBox using JavaScript without disable right click ?

    - by Space Cracker
    I want to allow numbers only to be allowed for a textbox and I already do it onkeydown event by allow only numbers and prevent ctrl+V but I have two problems : if I make right click then paste so any char can be entered and I want a solution without disable right click by oncontextmenu="return false;" if I drag and drop any text it will be entered Is there any solution that can work in all browsers without problem ?

    Read the article

  • How dangerous is e.preventDefault();, and can it be replaced by keydown/mousedown tracking?

    - by yc
    I'm working on a tracking script for a fairly sophisticated CRM for tracking form actions in Google Analytics. I'm trying to balance the desire to track form actions accurately with the need to never prevent a form from not working. Now, I know that doing something like this doesn't work. $('form').submit(function(){ _gaq.push('_trackEvent', 'Form', 'Submit', $(this).attr('action')) }); The DOM unloads before this has a chance to process. So, a lot of sample code recommends something like this: $('form').submit(function(e){ e.preventDefault(); var form = this; _gaq.push('_trackEvent', 'Form', 'Submit', $(this).attr('action')); //...do some other tracking stuff... setTimeout(function(){ form.submit(); }, 400); }); This is reliable in most cases, but it makes me nervous. What if something happens between e.preventDefault();and when I get around to triggering the DOM based submit? I've totally broken the form. I've been poking around some other analytics implementations, and I've noticed something like this: $('form').mousedown(function(){ _gaq.push('_trackEvent', 'Form', 'Submit', $(this).attr('action')); }); $('form').keydown(function(e){ if(e.which===13) //if the keydown is the enter key _gaq.push('_trackEvent', 'Form', 'Submit', $(this).attr('action')); }); Basically, instead of interrupting the form submit, preempting it by assuming that if someone is mousing down or keying down on Enter, than that form is submitted. Obviously, this will result in a certain amount of false positives, but it completely eliminates use of e.preventDefault();, which in my mind eliminates the risk that I might ever prevent a form from successfully submitting. So, my question: Is it possible to take the standard form tracking snippet and prevent it from ever fully preventing the form from submitting? Is the mousedown/keydown alternative viable? Are there any submission cases it may miss? Specifically, are there other ways to end up submitting besides the mouse and the keyboard enter? And will the browser always have time to process javascript before beginning to unload the page?

    Read the article

  • Preventing click event with jQuery drag and drop

    - by Sasha Yanovets
    I have an elements on page that are draggabe with jQuery. These elements have click event wich navigates to another page (ordinary links for example). What is the best way to prevent click from firing on dropping such element, while allowing clicking it in not drag and drop state? I have this problem with sortable elements, but think it is good to have solution for general drag and drop. I've solved the problem for myself. After that found that same solution exists for Scriptaculous, but maybe someone have a better way to achieve that.

    Read the article

  • Does jQuery.on() work for elements that are added after the event handler is created?

    - by orokusaki
    I was under the impression all this time that .on() worked like .live() with regards to dynamically created elements (e.g. I use $('.foo').on('click', function(){alert('click')}); and then an element with the class foo is created due to some AJAX, now I'm expecting a click on that element to cause an alert). In practice, these weren't the results I got. I could be making a mistake, but could somebody help me understand the new way to achieve these results, in the wake of .on()? Thanks in advance.

    Read the article

  • jQuery - Programmatically Trigger Event

    - by Sonny
    I need to programmatically trigger a click event that's being handled by jQuery. Here's the current code: var $thumbs = $('#PhotoGalleryThumbs .tile'); var $zoom = $('#PhotoGallery #PhotoGalleryZoom img'); var $description = $('#PhotoGallery #PhotoGalleryDescription'); $thumbs.click(function(event) { event.preventDefault(); var $thumb = $(this); $thumb.addClass('selected') .siblings().removeClass('selected'); $zoom.attr('src', $thumb.children('a').attr('href')); $description.html($thumb.find('img').attr('alt')); }); I am having a mental block working out how to create a function out of the event handling code and then arbitrarily calling it for an element in the $thumbs object.

    Read the article

  • Can I modify an ASP.NET AJAX History Point?

    - by Nick
    I'm using ASP.NET 3.5 with AJAX and have enabled history on the Script Manager. I have 2 pages, Default.aspx and Default2.aspx. I'm using the AJAX History on the Default.aspx page and saving history points on the server-side. There are some dropdowns on Default.aspx that I don't want to save a history point for each change but would like to save the latest state so that when I click on a link on Default.aspx that navigates to Default2.aspx, when I click the back button on Default2.aspx to return I want the dropdowns to reflect what they were prior to clicking on the hyperlink. So what I'd like to do is modify the history point that I originally set on one of my ajax async postbacks on the client-side before the page navigates away to Default2.aspx. There is a location.hash javascript property that looks like it may do what I want but when I modify the value the Script Manager Navigate event is firing. Is there a way to prevent this event from firing? And would this then do the job?

    Read the article

< Previous Page | 106 107 108 109 110 111 112 113 114 115 116 117  | Next Page >