Search Results

Search found 30511 results on 1221 pages for 'javascript events'.

Page 23/1221 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Prevent Javascript Execution in JQuery html()

    - by Mahan
    well i do have a div that contains some more html and a lot of javascript on it <div id="mydiv"> <p>Hello Philippines</p> my first time in Philippines is nice <script type="text/javascript">alert("how was it became nice?");</script> well i experienced a lot of things <script type="text/javascript">alert("and how about your Japan's trip?");</script> well its more nicer ^^ but both countries are good! hahah </div> now what i want there is to put the non-javascript code and javascript code in two separate variables var html = $("#mydiv").html(); but my problem here is my javascript is executing..which makes me stop to create the code i want which is the storing of javascript and non-javascript to two different variables. now my questions is how can i stop the javascript codes from executing when they are get inside the div? how can i store the javascript and non-javascript code into two different variables safely? NOTE: i need the stored javascript for later execution

    Read the article

  • How many of you *really* surf around without JavaScript enabled? [closed]

    - by Stephen
    I've decided to rephrase the question. After some deliberation on Meta, I've realized that my question needs to be a bit more focused. The question: Should we (web developers) continue to spend effort progressively enhancing our web applications with JavaScript, ensuring that features gracefully degrade, thereby ensuring accessibility? Or should we spend that time focused on new features or other areas of development? The subtext of that question would be: How many of our customers/clients/users utilize our websites or applications with JavaScript disabled? Do you have any projects with requirements that specifically demand JavaScript functionality (almost all of mine do), and do those requirements also demand graceful degradation? For the sake of asking this question, I pulled up programmers.stackexchange.com without JavaScript enabled, and I was greeted with this message: "Programmers - Stack Exchange works best with JavaScript enabled". It was difficult to log in, albeit the site seemed to generally work okay. (I wasn't able to vote up any questions.) I think this is a satisfactory approach to development. Imagine the effort involved in making all of the site's features work with plain old HTML and server-side logic. OTOH, I wonder how many users have been alienated by this approach. We've all been trained (at least the good developers among us) to use progressive enhancement and to ensure our web applications' dynamic features degrade gracefully. Is this progressive enhancement just pissing into the wind, or do some of our customers actually utilize certain web services without JavaScript enabled? I mean, like really, not figuratively or presumptuously.

    Read the article

  • remove a:hover using javascript (not using jquery... don't ask)

    - by Cyprus106
    I thought this would be pretty simple.... Basically, it's a 5-star rating system. When a user clicks, for example, three stars... I want to freeze those three stars right where they're at. I've been trying to simply remove the hover for the a href so it stays what it was at... maybe that's not the right method. I've exhausted absolutely everything I can think of... By the way this is straight javascript, not jquery or anything. It's crazy, I know but all of the JS was written straight.... I've got this class: .star-rating li a{ display:block; width:25px; height: 25px; text-decoration: none; text-indent: -9000px; z-index: 20; position: absolute; padding: 0px; } .star-rating li a:hover{ background: url(images/alt_star.png) left bottom; z-index: 2; left: 0px; } .star-rating a:focus, .star-rating a:active{ border:0; -moz-outline-style: none; outline: none; } .star-rating a.one-star{ left: 0px; } .star-rating a.one-star:hover{ width:25px; } and this code: <ul class='star-rating'> <li><a href="#" onclick="javascript: vote(<?=$id;?>, 1); disableStars(); return false;" title='1 star out of 5' id="1s" class='one-star'>1</a></li>

    Read the article

  • how to update div tag in javascript with data from model for onsubmit form asp.net mvc

    - by michael
    In my page i have a form tag which submits to server ,gets data and redirects to same page. problem is the the div tag which has the data from server is not getting updated. how to do that in javascript <% using (Html.BeginForm("Addfile", "uploadfile", FormMethod.Post, new { id = "uploadform", enctype = "multipart/form-data" })) { %> <input type="file" id="addedFile" name="addedFile" /><br /> <input type="submit" id="addfile" value="Addfile" /> <div id="MyGrid"> //data from the model(server side) filelist is not updating</div> what will be the form onsubmit javascript function to update the div tag with the data from the model. and my uploadfile controller get post methods are as [AcceptVerbs(HttpVerbs.Get)] public ActionResult Upload() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult AddFile(HttpPostedFileBase addedFile) { static List<string> fileList = new List<string>(); string filename = Path.GetFileName(addedFile.FileName); file.SaveAs(@"D:\Upload\" + filename); fileList.Add(filename); return("Upload",fileList); } thanks, michaela

    Read the article

  • How is a functional programming-based javascript app laid out?

    - by user321521
    I've been working with node.js for awhile on a chat app (I know, very original, but I figured it'd be a good learning project). Underscore.js provides a lot of functional programming concepts which look interesting, so I'd like to understand how a functional program in javascript would be setup. From my understanding of functional programming (which may be wrong), the whole idea is to avoid side effects, which are basically having a function which updates another variable outside of the function so something like var external; function foo() { external = 'bar'; } foo(); would be creating a side effect, correct? So as a general rule, you want to avoid disturbing variables in the global scope. Ok, so how does that work when you're dealing with objects and what not? For example, a lot of times, I'll have a constructor and an init method that initializes the object, like so: var Foo = function(initVars) { this.init(initVars); } Foo.prototype.init = function(initVars) { this.bar1 = initVars['bar1']; this.bar2 = initVars['bar2']; //.... } var myFoo = new Foo({'bar1': '1', 'bar2': '2'}); So my init method is intentionally causing side effects, but what would be a functional way to handle the same sort of situation? Also, if anyone could point me to either a python or javascript source code of a program that tries to be as functional as possible, that would also be much appreciated. I feel like I'm close to "getting it", but I'm just not quite there. Mainly I'm interested in how functional programming works with traditional OOP classes concept (or does away with it for something different if that's the case).

    Read the article

  • Possible to capture all events in a web browser?

    - by David
    I am working on a pet project and am at the research stage. Quick summary I am trying to intercept all form submits, onclick, and every single keydown. My library of choice is either jquery, or jquery + prototypejs. I figure I can batch up the events into a queue/stack and send it back to the server in time interval batches to keep performance relatively stable. Concerns Form submits and change's would be relatively simple.. Something like $("form :inputs").bind("change", function() { ... record event... }); But how to ensure I get precedence over the applications handlers as I have a habit of putting return false on a lot of my form handlers when there is a validation issue. As I understand it, that effectively stops the event in its tracks. My project For my smaller remote clients I will put their products onto a VPS or run it in my home data center. Currently I use a basic authentication system, given a username/password they see the website and then hopefully send me somewhat sane notes on what is broken or should be tweaked. As a better solution, I've written a simple proxy web server that does the above but allows me to have one DNS entry and then depending on credentials it makes an internal request relaying headers and re-writing URLS as needed. Every single html/text or application/* request is compressed and shoved into a sqlite table so I can partially replay what they've done. Now I am shifting to the frontend and would like to capture clicks, keydown's, and submits on everything on the page.

    Read the article

  • Is there a way to get SSL certificate details using JavaScript?

    - by sHz
    Hi all, I'd like to gather certain details of an SSL certificate on a particular web-site. I know this is straightforward using the openssl tool on Linux/MacOSX. However is the same or similar possible in JavaScript? I understand that the browser handles socket connections and that the SSL handshake occurs prior to any party sending data. However in an XMLHTTPRequest, I'd like to know if its possible to get these details as some sort of response code etc?

    Read the article

  • Combining mousedown and mousemove events together with Javascript (JQUERY?)

    - by webzide
    Dear experts, I would like to combine a the mousedown and mousemove and mouseup events together. Basically the application of this would be making a UI for selecting elements. Like selecting icons in windows when the mouse is clicked down and as you move it, a dotted border dynamically moves with it. I know this is possible with the predefined UI of Jquery. But I am building a web application that requires the integration of this and would like to know the technique. I spend hours on this and it just doesn't work. here's is the code i have so far and the logic behind it: $(document).bind('mousedown', function (evt) { evt = (evt) ? evt : event; startX = evt.clientX; startY = evt.clientY; div = document.createElement("div"); div.style.position = "absolute"; div.style.left = startX + "px"; div.style.top = startY + "px"; div.style.border = "1px dotted #DDDDDD"; $(document).bind('mousemove', function(evt){ evt=(evt) ? evt: event; alert("TESTING OF THIS WORKS"); }); }); $(document).bind('mouseup',function(evt) { var evt = (evt) ? evt : event; var endX = evt.clientX; var endY = evt.clientY; difX = (endX - startX); difY = (endY - startY) if ((difX || difY) > 0) { div.style.width = difX + "px"; div.style.height = difY + "px"; document.body.appendChild(div); } $(this).unbind('mousemove'); }); As you can see I have placed an event binding of mousemove into the event function of mousedown so that it can only be invoked when the mouse is down. but the problem is, once that event is binded, it does not come off. The borders does not move dynamically as expected. Maybe my logic is entirely messed up. If anyone could point me the the right direction that would be great. THanks in advance.

    Read the article

  • Three ways of ataching to events with dojo. What exactly is the difference?

    - by Mark
    Is the difference here just various syntactical sugars or is there a reason to use one approach over the other? They all work, and to be a little more confusing what is the difference between this and evt.currentTarget? the CSS #reportDetails table tr:hover td, #reportDetails table tr.hover td { background: #aae4e2; color: #333333; } Sample html <div id="reportDetails"> <table> <tr> <td> something</td> <td> soemthing else</td> </tr> <tr> <td> something2</td> <td> soemthing else2</td> </tr> </table> </div> dojo.behavior script dojo.require("dojo.behavior"); if (dojo.isIE <= 6) { dojo.behavior.add({ '#reportDetails tr': { onmouseover: function(evt){ dojo.addClass(evt.currentTarget, "hover");}, onmouseout: function(evt){dojo.removeClass(evt.currentTarget, "hover"); } } }); } dojo.behavior.apply(); dojo.query forEach script if (dojo.isIE <= 6) { dojo.addOnLoad(function() { dojo.query("tr", "reportDetails").forEach(function(node){ node.onmouseover=function(){dojo.addClass(node,"hover");} node.onmouseout=function() {dojo.removeClass(node,"hover");} } }); }); } dojo.query ataching straight to the events if (dojo.isIE <= 6) { dojo.addOnLoad(function(){ dojo.query("tr", "reportDetails") .onmouseover(function(evt){dojo.addClass(evt.currentTarget, "hover");}) .onmouseout(function(evt){dojo.removeClass(evt.currentTarget, "hover");}); }); } I am assuming that evt.currentTarget and node could all be replaced with this and still work. I believe there is no real difference between 2 and 3 but the first one might actually use a different approach.

    Read the article

  • Trace PRISM / CAL events (best practice?)

    - by Christian
    Ok, this question is for people with either a deep knowledge of PRISM or some magic skills I just lack (yet). The Background is simple: Prism allows the declaration of events to which the user can subscribe or publish. In code this looks like this: _eventAggregator.GetEvent<LayoutChangedEvent>().Subscribe(UpdateUi, true); _eventAggregator.GetEvent<LayoutChangedEvent>().Publish("Some argument"); Now this is nice, especially because these events are strongly typed, and the declaration is a piece of cake: public class LayoutChangedEvent : CompositePresentationEvent<string> { } But now comes the hard part: I want to trace events in some way. I had the idea to subscribe using a lambda expression calling a simple log message. Worked perfectly in WPF, but in Silverlight there is some method access error (took me some time to figure out the reason).. If you want to see for yourself, try this in Silverlight: eA.GetEvent<VideoStartedEvent>().Subscribe(obj => TraceEvent(obj, "vSe", log)); If this would be possible, I would be happy, because I could easily trace all events using a single line to subscribe. But it does not... The alternative approach is writing a different functions for each event, and assign this function to the events. Why different functions? Well, I need to know WHICH event was published. If I use the same function for two different events I only get the payload as argument. I have now way to figure out which event caused the tracing message. I tried: using Reflection to get the causing event (not working) using a constructor in the event to enable each event to trace itself (not allowed) Any other ideas? Chris PS: Writing this text took me most likely longer than writing 20 functions for my 20 events, but I refuse to give up :-) I just had the idea to use postsharp, that would most likely work (although I am not sure, perhaps I end up having only information about the base class).. Tricky and so unimportant topic...

    Read the article

  • What's the problem of this piece of JavaScript code?

    - by Yousui
    Hi guys, The following piece of JavaScript code is a cross browser way to add/remove event handler. It will save a deleting method as a property of an HTML element object. Now it works well in FireFox but not in IE6. I can't find out why so I came here for help. Great thanks. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>pop</title> </head> <body> <input type="text" name="input1" id="input1" value="" /> <div id="result"> </div> <div id="result2" style="width:200px;height:100px;border:1px solid red;"> </div> <button id="stop" name="stop">click me</button><button id="stop2" name="stop2">click me</button> <script type="text/javascript" charset="utf-8"> function handler(e){ e = e || window.event; var key_code = e.keyCode || e.charCode || e.which, source = e.srcElement || e.target; document.getElementById("result").innerHTML = "" + key_code; } function handler2(e){ e = e || window.event; var key_code = e.keyCode || e.charCode || e.which, source = e.srcElement || e.target; document.getElementById("result2").innerHTML = e.button; } function add_event(o, event_type, callback, capture){ o = typeof o === "string" ? document.getElementById(o) : o; if(document.addEventListener){ add_event = function(o, event_type, callback, capture){ o = typeof o === "string" ? document.getElementById(o) : o; capture = typeof(capture) === "undefined" ? false : true; o.addEventListener(event_type, callback, capture); o.removes = o.removes || {}; o.removes[event_type] = function(){ o.removeEventListener(event_type, callback, capture); }; if(!o.remove_event){ o.remove_event = function(type){ if(typeof type === "undefined"){ return; } o.removes[type](); } } } }else if(document.attachEvent){ add_event = function(o, event_type, callback, capture){ o = typeof o === "string" ? document.getElementById(o) : o; capture = typeof(capture) === "undefined" ? false : true; o.attachEvent(event_type, callback); o.removes = o.removes || {}; o.removes[event_type] = function(){ o.detachEvent(event_type, callback); } if(!o.remove_event){ o.remove_event = function(type){ if(typeof type === "undefined"){ return; } o.removes[type](); } } } } add_event(o, event_type, callback, capture); } add_event("input1", "keyup", handler); add_event("input1", "click", handler2); add_event("stop", "click", function(){ document.getElementById("input1").remove_event("keyup"); }); add_event("stop2", "click", function(){ document.getElementById("input1").remove_event("click"); }); </script> </body> </html>

    Read the article

  • JavaScript frameworks and CSS frameworks: JQuery, YUI, neither, or something else?

    - by Eric Johnson
    I haven't done web development for about 6 years. I'm trying to get back into it and there is a lot of new stuff out there. I've chosen to write my next project with Perl and Catalyst. I keep hearing about various JavaScript and CSS frameworks. I know very little about these frameworks so maybe this question is overly broad and open ended. What are the strengths, weaknesses, and popularity of the various frameworks? Should I be using YUI, JQuery, neither, or something else?

    Read the article

  • where is the best place to place a javascript snippet to alter the DOM of a page before it renders

    - by icepack
    I have a few dynamic pages and I want to alter certain elements before the page has fully rendered. My snippet is something like document.body.getElementById("change").innerHTML = "<img src..."; I do not have access to change the content server side. Where is the best place to put the snippet to have the code run before the page it has rendered? Rather, is putting the javascript in either the HEAD (inside the window.onload event?) or before the closing BODY(not inside an event listener) optimal?

    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

  • Is it possible to generate Events and Hooks in Lua for any game without built-in support?

    - by pr0tocol
    Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls? The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game. Brief examples: Events: - An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something). Hooks: - An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer. I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts. Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

    Read the article

  • The Main Purpose of Events in C#

    - by Tarik
    I've been examining one of my c# books and I just saw a sentence about Events in C#:  The main purpose of events is to prevent subscribers from interfering with each other. Whatever it means, yeah actually events are working pretty much like delegates. I've been wondering why I should use events instead of delegates. So is there any one who can explain the bold part? Thanks in advance.

    Read the article

  • How to get keypressed, keydown events from DataGridView data cells

    - by extropy
    Hi. I need to recieve the key press events during cell editing in DataGridView control. From what I have found on the net the DataGridView is designed to pass all key events from DataGridView to the cell editing control and you cannot get these events easily. I found this peace of code http://www.codeproject.com/KB/grid/DataGridCellEvents.aspx that traps those events for DataGrid control, but that does not work for DataGridView.

    Read the article

  • JavaScript: How can I delay running some JS code until my JS file downloaded?

    - by Henryh
    I have the following code: <script type="text/javascript"> function addScript(url) { var script = document.createElement('script'); script.src = url; document.getElementsByTagName('head')[0].appendChild(script); } addScript('http://example.com/One.js'); addScript('http://example.com/Two.js'); addScript('http://example.com/Three.js'); addScript('http://example.com/Four.js'); ... // run code below this point once Two.js has been downloaded and excuted </script> How can I detect when one of my JavaScript files has been downloaded and executed so that I can use it?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >