Search Results

Search found 23708 results on 949 pages for 'javascript'.

Page 17/949 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • variable declaration in javascript [migrated]

    - by ShaggyInjun
    I have been doing something like this for a while and I have never seen any errors. But, unfortunately, I have never been able to explain why this works. The first line creates a variable which points to a function. The second line just adds func2 to func1 separated by a dot and defines a function. If I add a var in front of func1.func2 then I see a compilation error. func1.func2 = function(){}; Error SyntaxError: missing ; before statement var func1.func2 = function(){}; What type was func1 on first line 1 and what did it become on line 2. var func1 = function(){}; func1.func2 = function(){}; Thanks Venkat

    Read the article

  • Change player in javascript game [migrated]

    - by KLUSTER
    Game: onClick startbutton mathrandom for first player who starts the game. 4 Pictures: 2 of it player1 and player2. another 2 Player turn. need help: on button click next player turn function game(){ var PlayerTurn; PlayerTurn=parseInt(Math.random()*2); if(PlayerTurn==0){PlayerTurn=1;window.document.player1.src="Cache/Player3.PNG";} else{PlayerTurn=0;window.document.player2.src="Cache/Player4.PNG";} } Any help is appreciated.

    Read the article

  • Edit value of n number of <td> using jquery or javascript [on hold]

    - by Yousaf
    Hello Guys I am trying to edit the value of n number of td but i am onlt able to edit 1 value how can edit n number of tds i dont know how many rows could be in table here is my current code i want to do it dynamically HTML <input type="text" name="editValue" id="editValue" value="" /> <br> <table id="testing"> <tr> <td id="tdid">Value1</td> <td><a href="#" id="button" >Edit</a></td> </tr> <tr> <td >Value2</td> <td><a href="#">Edit</a></td> </tr> </table> Jquery $("#button").on('click', function(){ var r = $("#tdid").text(); $("#editValue").val(r); }); Here is working example http://jsfiddle.net/M5Gkb/6/

    Read the article

  • Visual Studio 2010 and javascript debugging in external javascript files (embedded and minified).

    - by OKB
    Hi, The asp.net web application I'm working on is written in asp.net 3.5, the web app solution is upgraded from VS 2008 (don't know if that matter). The solution had javascript in the aspx files before I moved the javascript to external files. Now what I have done is to set all the javascript files to be embedded resource (except the jquery.js file) and I want to minify them when building for release by using the MS Ajax Minifier. I want to use the minified javascript files when I'm in the RELEASE mode and when I'm in DEBUG mode I want to use the "normal" versions. My problem now is that I'm unable to debug the javascript code in debug mode. When I set a break point a javascript function, VS is not breaking at all when the function is executed. I have added this entry in my web.config: <system.web> <compilation defaultLanguage="c#" debug="true" /> </system.web> Here how I register the jquery in an aspx-file: <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server"> <Scripts> <asp:ScriptReference Path="~/Javascript/jquery.js"/> </Scripts> </asp:ScriptManagerProxy> External javascript registration in the code-behind: #if DEBUG [assembly: WebResource("braArkivWeb.Javascript.jquery.js", "text/javascript")] [assembly: WebResource(braArkivWeb.ArkivdelSearch.JavaScriptResource, "text/javascript")] #else [assembly: WebResource("braArkivWeb.Javascript.jquery.min.js", "text/javascript")] [assembly: WebResource(braArkivWeb.ArkivdelSearch.JavaScriptMinResource, "text/javascript")] #endif public partial class ArkivdelSearch : Page { public const string JavaScriptResource = "braArkivWeb.ArkivdelSearch.js"; public const string JavaScriptMinResource = "braArkivWeb.ArkivdelSearch.min.js"; protected void Page_Init(object sender, EventArgs e) { InitPageClientScript(); } private void InitPageClientScript() { #if DEBUG this.Page.ClientScript.RegisterClientScriptResource(typeof(ArkivdelSearch), "braArkivWeb.Javascript.jquery.js"); this.Page.ClientScript.RegisterClientScriptResource(typeof(ArkivdelSearch), JavaScriptResource); #else this.Page.ClientScript.RegisterClientScriptResource(typeof(ArkivdelSearch), "braArkivWeb.Javascript.jquery.min.js"); this.Page.ClientScript.RegisterClientScriptResource(typeof(ArkivdelSearch), JavaScriptMinResource); #endif StringBuilder sb = new StringBuilder(); Page.ClientScript.RegisterStartupScript(typeof(ArkivdelSearch), "initArkivdelSearch", sb.ToString(), true); } } In the project file I have added this code to minify the javascripts: <!-- Minify all JavaScript files that were embedded as resources --> <UsingTask TaskName="AjaxMin" AssemblyFile="$(MSBuildProjectDirectory)\..\..\SharedLib\AjaxMinTask.dll" /> <PropertyGroup> <ResGenDependsOn> MinifyJavaScript; $(ResGenDependsOn) </ResGenDependsOn> </PropertyGroup> <Target Name="MinifyJavaScript" Condition=" '$(ConfigurationName)'=='Release' "> <Copy SourceFiles="@(EmbeddedResource)" DestinationFolder="$(IntermediateOutputPath)" Condition="'%(Extension)'=='.js'"> <Output TaskParameter="DestinationFiles" ItemName="EmbeddedJavaScriptResource" /> </Copy> <AjaxMin JsSourceFiles="@(EmbeddedJavaScriptResource)" JsSourceExtensionPattern="\.js$" JsTargetExtension=".js" /> <ItemGroup> <EmbeddedResource Remove="@(EmbeddedResource)" Condition="'%(Extension)'=='.js'" /> <EmbeddedResource Include="@(EmbeddedJavaScriptResource)" /> <FileWrites Include="@(EmbeddedJavaScriptResource)" /> </ItemGroup> </Target> Do you see what I'm doing wrong? Or what I'm missing in order to be able to debug my javascript code? Best Regards, OKB

    Read the article

  • Rendering javascript at the server side level. A good or bad idea?

    - by davidhong
    I want to make it clear first: This isn't a question in relation to server-side Javascript or running Javascript server side. This is a question regarding rendering of Javascript code (which will be executed on the client-side) from server-side code. Having said that, take a look at below ASP.net code for example: hlRemoveCategory.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this?');") This is prescribing the client-side onclick event on the server-side. As oppose to: $('a[rel=remove]').bind('click', function(event) { return confirm('Are you sure you want to delete this?'); } Now the question I want to ask is: What is the benefit of rendering javascript from the server-side code? Or the vice-versa? I personally prefer the second way of hooking up client-side UI/behaviour to HTML elements for the following reasons: Server-side does what ever it needs to already, including data-validation, event delegation and etc; and What server-side sees as an event is not necessarily the same process on the client-side. i.e., there are plenty more events on client-side (just look at custom events); and What happens on client-side and on server-side, during an event, could be completely irrelevant and decoupled; and What ever happens on client-side happens on client-side, there is no need for the server to know. Server should process and run what is given to them, how the process comes to life is not really up to them to decide in the event of the client-side events; and so and so forth. These are my thoughts obviously. I want to know what others think and if there has been any discussions on this topic. Topics branching from this argument can reach: Code management: is it easier to render everything from server-side? Separation of concern: is it easier if client-side logic is separated to server-side logic? Efficiency: which is more efficient both in terms of coding and running? At the end of the day, I am trying to move my team to go towards the second approach. There are lot of old guys in this team who are afraid of this change. I just wish to convince them with the right facts and stats. Let me know your thoughts.

    Read the article

  • Javascript - is this a grey area for anyone else?

    - by Anonymous -
    I have a firm understanding of HTML, CSS, PHP, MySQL (and to some extent apache/linux) and find that one of the things missing from my 'web development knowledge base' is javascript - creating richer user interfaces. I'd like to learn Javascript before I look at any frameworks (I've used light javascript/jquery before, but that's besides the point). Can anyone recommend a firm book or online documentation from 'absolute beginner' to 'expert' for javascript? I seem to be finding too many 'display the time' and 'hello world' tutorials...

    Read the article

  • Where can I find a professional image gallery built on a javascript framework?

    - by user278457
    I'm looking to find a galleria replacement, hopefully using jQuery but other javascript frameworks such as prototype or mootools are fine too. I used galleria a while back, and I need a similar product now. Unfortunately, the devkick.com domain seems to have disappeared in the meantime and I'm wary of using products that aren't actively maintained. I'm willing to pay up to $50 per site for licensing costs, if the product meets my needs. I'm specifically looking for a gallery with the following features: Every image in the gallery preloads asap, not as the user clicks "next" Minimalist default css to keep my subsequent styling headaches down, preferably a "darkroom" style by default, much as galleria looks Each element that constructs the image gallery should be simple and logical to reference with CSS As easy to install as adding a css class to a single unordered list No dependencies other than the core jQuery/other library, including "easing" and other effects must be optional Works on browsers back to IE6, Firefox 3, Safari (and iPhone), Chrome, Opera Has a javascript API that lets me trigger callback functions on common events such as "user clicks next" or "image loads" degrades gracefully without javascript, either displays images as a list, or just displays the first image in the list bonus: The gallery can display other content, such as video or external sites, like the modal boxes at shadowbox-js.com well documented minimal bandwidth requirement - .js file should be ~10kb minified bonus: The gallery source is hosted on a reliable CDN like google's bonus: Thumbnails for images do not appear until the main image has loaded bonus: includes ability to set parameters with JSON to change common behaviours, such as slide/fade transitions or automatic image switch every X seconds

    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

  • Creating HTML5 Offline Web Applications with ASP.NET

    - by Stephen Walther
    The goal of this blog entry is to describe how you can create HTML5 Offline Web Applications when building ASP.NET web applications. I describe the method that I used to create an offline Web application when building the JavaScript Reference application. You can read about the HTML5 Offline Web Application standard by visiting the following links: Offline Web Applications Firefox Offline Web Applications Safari Offline Web Applications Currently, the HTML5 Offline Web Applications feature works with all modern browsers with one important exception. You can use Offline Web Applications with Firefox, Chrome, and Safari (including iPhone Safari). Unfortunately, however, Internet Explorer does not support Offline Web Applications (not even IE 9). Why Build an HTML5 Offline Web Application? The official reason to build an Offline Web Application is so that you do not need to be connected to the Internet to use it. For example, you can use the JavaScript Reference Application when flying in an airplane, riding a subway, or hiding in a cave in Borneo. The JavaScript Reference Application works great on my iPhone even when I am completely disconnected from any network. The following screenshot shows the JavaScript Reference Application running on my iPhone when airplane mode is enabled (notice the little orange airplane):   Admittedly, it is becoming increasingly difficult to find locations where you can’t get Internet access. A second, and possibly better, reason to create Offline Web Applications is speed. An Offline Web Application must be downloaded only once. After it gets downloaded, all of the files required by your Web application (HTML, CSS, JavaScript, Image) are stored persistently on your computer. Think of Offline Web Applications as providing you with a super browser cache. Normally, when you cache files in a browser, the files are cached on a file-by-file basis. For each HTML, CSS, image, or JavaScript file, you specify how long the file should remain in the cache by setting cache headers. Unlike the normal browser caching mechanism, the HTML5 Offline Web Application cache is used to specify a caching policy for an entire set of files. You use a manifest file to list the files that you want to cache and these files are cached until the manifest is changed. Another advantage of using the HTML5 offline cache is that the HTML5 standard supports several JavaScript events and methods related to the offline cache. For example, you can be notified in your JavaScript code whenever the offline application has been updated. You can use JavaScript methods, such as the ApplicationCache.update() method, to update the cache programmatically. Creating the Manifest File The HTML5 Offline Cache uses a manifest file to determine the files that get cached. Here’s what the manifest file looks like for the JavaScript Reference application: CACHE MANIFEST # v30 Default.aspx # Standard Script Libraries Scripts/jquery-1.4.4.min.js Scripts/jquery-ui-1.8.7.custom.min.js Scripts/jquery.tmpl.min.js Scripts/json2.js # App Scripts App_Scripts/combine.js App_Scripts/combine.debug.js # Content (CSS & images) Content/default.css Content/logo.png Content/ui-lightness/jquery-ui-1.8.7.custom.css Content/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png Content/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png Content/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png Content/ui-lightness/images/ui-icons_222222_256x240.png Content/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png Content/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png Content/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png Content/ui-lightness/images/ui-icons_ffffff_256x240.png Content/ui-lightness/images/ui-icons_ef8c08_256x240.png Content/browsers/c8.png Content/browsers/es3.png Content/browsers/es5.png Content/browsers/ff3_6.png Content/browsers/ie8.png Content/browsers/ie9.png Content/browsers/sf5.png NETWORK: Services/EntryService.svc http://superexpert.com/resources/JavaScriptReference/ A Cache Manifest file always starts with the line of text Cache Manifest. In the manifest above, all of the CSS, image, and JavaScript files required by the JavaScript Reference application are listed. For example, the Default.aspx ASP.NET page, jQuery library, JQuery UI library, and several images are listed. Notice that you can add comments to a manifest by starting a line with the hash character (#). I use comments in the manifest above to group JavaScript and image files. Finally, notice that there is a NETWORK: section of the manifest. You list any file that you do not want to cache (any file that requires network access) in this section. In the manifest above, the NETWORK: section includes the URL for a WCF Service named EntryService.svc. This service is called to get the JavaScript entries displayed by the JavaScript Reference. There are two important things that you need to be aware of when using a manifest file. First, all relative URLs listed in a manifest are resolved relative to the manifest file. The URLs listed in the manifest above are all resolved relative to the root of the application because the manifest file is located in the application root. Second, whenever you make a change to the manifest file, browsers will download all of the files contained in the manifest (all of them). For example, if you add a new file to the manifest then any browser that supports the Offline Cache standard will detect the change in the manifest and download all of the files listed in the manifest automatically. If you make changes to files in the manifest (for example, modify a JavaScript file) then you need to make a change in the manifest file in order for the new version of the file to be downloaded. The standard way of updating a manifest file is to include a comment with a version number. The manifest above includes a # v30 comment. If you make a change to a file then you need to modify the comment to be # v31 in order for the new file to be downloaded. When Are Updated Files Downloaded? When you make changes to a manifest, the changes are not reflected the very next time you open the offline application in your web browser. Your web browser will download the updated files in the background. This can be very confusing when you are working with JavaScript files. If you make a change to a JavaScript file, and you have cached the application offline, then the changes to the JavaScript file won’t appear when you reload the application. The HTML5 standard includes new JavaScript events and methods that you can use to track changes and make changes to the Application Cache. You can use the ApplicationCache.update() method to initiate an update to the application cache and you can use the ApplicationCache.swapCache() method to switch to the latest version of a cached application. My heartfelt recommendation is that you do not enable your application for offline storage until after you finish writing your application code. Otherwise, debugging the application can become a very confusing experience. Offline Web Applications versus Local Storage Be careful to not confuse the HTML5 Offline Web Application feature and HTML5 Local Storage (aka DOM storage) feature. The JavaScript Reference Application uses both features. HTML5 Local Storage enables you to store key/value pairs persistently. Think of Local Storage as a super cookie. I describe how the JavaScript Reference Application uses Local Storage to store the database of JavaScript entries in a separate blog entry. Offline Web Applications enable you to store static files persistently. Think of Offline Web Applications as a super cache. Creating a Manifest File in an ASP.NET Application A manifest file must be served with the MIME type text/cache-manifest. In order to serve the JavaScript Reference manifest with the proper MIME type, I added two files to the JavaScript Reference Application project: Manifest.txt – This text file contains the actual manifest file. Manifest.ashx – This generic handler sends the Manifest.txt file with the MIME type text/cache-manifest. Here’s the code for the generic handler: using System.Web; namespace JavaScriptReference { public class Manifest : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/cache-manifest"; context.Response.WriteFile(context.Server.MapPath("Manifest.txt")); } public bool IsReusable { get { return false; } } } } The Default.aspx file contains a reference to the manifest. The opening HTML tag in the Default.aspx file looks like this: <html manifest="Manifest.ashx"> Notice that the HTML tag contains a manifest attribute that points to the Manifest.ashx generic handler. Internet Explorer simply ignores this attribute. Every other modern browser will download the manifest when the Default.aspx page is requested. Seeing the Offline Web Application in Action The experience of using an HTML5 Web Application is different with different browsers. When you first open the JavaScript Reference application with Firefox, you get the following warning: Notice that you are provided with the choice of whether you want to use the application offline or not. Browsers other than Firefox, such as Chrome and Safari, do not provide you with this choice. Chrome and Safari will create an offline cache automatically. If you click the Allow button then Firefox will download all of the files listed in the manifest. You can view the files contained in the Firefox offline application cache by typing about:cache in the Firefox address bar: You can view the actual items being cached by clicking the List Cache Entries link: The Offline Web Application experience is different in the case of Google Chrome. You can view the entries in the offline cache by opening the Developer Tools (hit Shift+CTRL+I), selecting the Storage tab, and selecting Application Cache: Notice that you view the status of the Application Cache. In the screen shot above, the status is UNCACHED which means that the files listed in the manifest have not been downloaded and cached yet. The different possible values for the status are included in the HTML5 Offline Web Application standard: UNCACHED – The Application Cache has not been initialized. IDLE – The Application Cache is not currently being updated. CHECKING – The Application Cache is being fetched and checked for updates. DOWNLOADING – The files in the Application Cache are being updated. UPDATEREADY – There is a new version of the Application. OBSOLETE – The contents of the Application Cache are obsolete. Summary In this blog entry, I provided a description of how you can use the HTML5 Offline Web Application feature in the context of an ASP.NET application. I described how this feature is used with the JavaScript Reference Application to store the entire application on a user’s computer. By taking advantage of this new feature of the HTML5 standard, you can improve the performance of your ASP.NET web applications by requiring users of your web application to download your application once and only once. Furthermore, you can enable users to take advantage of your applications anywhere -- regardless of whether or not they are connected to the Internet.

    Read the article

  • Why does the JavaScript need to start with ";" ?

    - by TK
    I have recently noticed that a lot of JavaScript files on the web starts with ; immediately following the comment section. For example, this jQuery plugin's code starts with /** * jQuery.ScrollTo * Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com * Dual licensed under MIT and GPL. * Date: 9/11/2008 .... skipping several lines for brevity... * * @desc Scroll on both axes, to different values * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } ); */ ;(function( $ ){ Why does the file needs to start with ;? I see this convention on server-side JavaScript files as well. What is an advantage and disadvantage of doing this?

    Read the article

  • What are the main advantages of adding your custom functions to a javascript libraries namepsace?

    - by yaya3
    It is fairly well known in JavaScript that declaring variables within the global scope is a bad thing. So code I tend to work on contains namespaced JavaScript. There seems to be two different approaches taken to this - Adding your application specific functions to the libraries' namespace e.g. $.myCarouselfunction Creating your own namespace e.g. MyApplication.myCarouselFunction I wanted to know whether or not there is a 'better' solution or if they tend to meet somewhere close in terms of pros and cons. The reason for me personally deciding not to go with the library is for Seperation / Isolation / Lack of conflict with library code and potential plugins that are likely to share that namespace. But I am sure there is more to this. Thanks

    Read the article

  • Any difference between lazy loading Javascript files vs. placing just before </body>

    - by mhr
    Looked around, couldn't find this specific question discussed. Pretty sure the difference is negligible, just curious as to your thoughts. Scenario: All Javascript that doesn't need to be loaded before page render has been placed just before the closing </body> tag. Are there any benefits or detriments to lazy loading these instead through some Javascript code in the head that executes when the DOM load/ready event is fired? Let's say that this only concerns downloading one entire .js file full of functions and not lazy loading several individual files as needed upon usage. Hope that's clear, thanks.

    Read the article

  • 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

  • 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

  • Get the coordinates of a drop event in Javascript?

    - by Sebastián Grignoli
    I made a javascript library that lets me drag a marker from a dragzone to one or more dropzones. The problem is... the mouseup event happens over the marker I'm dragging, no te dropzone. How can I detect in wich dropzone was the marker dropped, and in wich coordinates? Here's my script: http://dl.dropbox.com/u/186012/demos/dragger/drag.html

    Read the article

  • Where is a good javascript reference for object event handlers?

    - by GregH
    I am relatively new to Javascript and constantly need to look up how to handle various events for objects. For example, I have a table containing a few text fields and need to know when somebody starts typing in any of the text boxes. Is there any good concise reference on the web anyplace that documents all of the objects and event handlers associated with all objects? I'd like to be able to look up the object and see all of the events I can handle for that object.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >