Search Results

Search found 23794 results on 952 pages for 'serverside javascript'.

Page 56/952 | < Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >

  • Is there anyway to prevent onbeforeunload event from triggering when using internet explorer

    - by newName
    I have a function that is suppose to trigger when user closes their browser and I have put the code in the "window.onbeforeunload" function. The thing is every time if I reloads the page in Internet Explorer, the onbeforeunload event will also trigger which is a problem because I only wants it to trigger only when the user closes or navigates away from the current page but not on a page refresh/reload. Therefore I'm not sure if onbeforeunload is intended to trigger even on a page refresh/reload and if it is intended to, then is there another way to work round it? Thanks

    Read the article

  • javascript to jquery

    - by Angeline Aarthi
    How do I write the following line which is in javascript in jQuery? var variablename = new functionname('some variable'); This is my js code: var rt = new ResizeableTextbox('myRT'); I need to use this in the following code segment: if($(this).text() =='String') { $("<label id=labelstr"+stringinc+" >"+label+"</label>").appendTo(".menu li"); $("<input id=inputstr"+stringinc+" type= 'text' ></input>").appendTo(".menu li"); //in place of this I need that javascript code. } How do I do that? The function Resizeable is defined in a separate js file. Please help me out.

    Read the article

  • implementing SRX Segmentation Rules in JavaScript

    - by Sourabh
    Hello , I want to implement the SRX Segmentation Rules using javascript to extract sentences from text. In order to do this correctly I will have to follow the SRX rules. eg. http://www.lisa.org/fileadmin/standards/srx20.html#refTR29 now there are two types of regular expressions if found sentence should break like ". " if found sentence should not break like abbreviation U.K or Mr. For this again there are two parts before breaking after breaking for example if the rule is <rule break="no"> <beforebreak>\s*[0-9]+\.</beforebreak> <afterbreak>\s</afterbreak> </rule> Which says if the pattern "\s*[0-9]+.\s" is found the segment should not break. how do I implement using javascript, my be split function is not enough ?

    Read the article

  • asp.net MVC Partial Views how to initialise javascript

    - by Simon G
    Hi, I have an edit form that uses an ajax form to submit to the controller. Depending on the data submitted I redirect the user to one of two pages (by returning a partial view). Both pages rely on javascript/jquery and neither use anything common between the pages. What is the best way to initialise these javascripts on each page? I know there is the AjaxOption OnComplete but both pages are quite dynamic depending on the Model passed and I would rather keep the javascript for both pages seperate rather than having a common method. Thanks

    Read the article

  • prototype/javascript - firefox not firing keypress/keydown event unless focus is in textbox

    - by Chloraphil
    The following works fine on IE6, IE7, and chrome. Not working on ff 3.0.7. <html><head> <script src="prototype.js" type="text/javascript" ></script> <script type="text/javascript"> Event.observe(window, 'load', function(){ Event.observe(document.body, 'keydown', myEventHandler); alert('window load'); }); function myEventHandler(evt) { alert(evt); } </script> </head> <body > <input type="text" /><br><br> </body></html> EDIT: By "not working" I mean myEventHandler is not firing in firefox. EDIT2: Furthermore, it works fine when focus is on the input element. I want it fire for all keydowns.

    Read the article

  • How do I pan the contents of a div when the right mouse button is dragged?

    - by Shaunwithanau
    I need a cross browser way of capturing the right mouse click, preventing the default context menu and making it where when the user drags the mouse they can pan the contents of a div. This is largely similar to Google maps in that they will grip the contents and drag to see what they want. No external libraries please. I am already capturing the events, and know that this will prevent default actions: if (evt.preventDefault) { evt.preventDefault(); } else { evt.returnValue = false; } But this doesn't prevent the context menu AFAIK. Edit: I really am unsure about how to prevent the context menu and what the best way to manipulate the scroll bars would be? examples would be great

    Read the article

  • Dynamic Jquery Accordion

    - by kwek-kwek
    How do I default an accordion to be closed on start-up. here is the sample view here Here is the code: <script> $(function() { $("#accordion").tabs("#accordion div.pane", {tabs: 'h3', effect: 'slide'}); }); </script> <script> // add new effect to the tabs $.tools.tabs.addEffect("slide", function(i, done) { // 1. upon hiding, the active pane has a ruby background color this.getPanes().slideUp("slow").css({backgroundColor: "#fff"}); // 2. after a pane is revealed, its background is set to its original color (transparent) this.getPanes().eq(i).slideDown("slow", function() { $(this).css({backgroundColor: 'transparent'}); // the supplied callback must be called after the effect has finished its job done.call(); }); }); </script>

    Read the article

  • Identifying dynamically generated elements

    - by Hulk
    In the following code, <script> function val() { //get alltextarea to validate } $(document).ready(function() { var html= '<form>' html += '<textarea name="test" id="test"'; html += '<textarea name="test1" id="test1"'; html += 'form'; $('#get_div').append(); }); </script> <div id= "get_div"></div> <input type="button" onclick="val();" The two textareas are dynamically generated.Now how to validate it in function val.When i do $('#test').val() or document.getElementbyId(test).value I could not find the values of the textareas Thanks..

    Read the article

  • IE8 Debugger: how to load external javascript files?

    - by Chris Barnhill
    I have downloaded and installed IE8. I was playing around with the debugger, but I could not figure out how to load external javascript files. It displays the javascript from the main page, but I need to debug the script in the external files. I have googled various articles that show a screenshot of an IE8 debugger with a drop-down for selecting which script to debug, but my debugger does not feature this. Can anyone help me with this? Thanks.

    Read the article

  • Using "class/object" MooTools-style events in jQuery

    - by Infinity
    One of the nice things about MooTools, is that it lets you easily assign/fire events to objects, for example: var playerSingleton = new (new Class({ Implements: [Events], initialize: function() {}, setVolume: function() { // do some stuff.. this.fireEvent('volumeChanged') } })); // Somewhere else... playerSingleton.addEvent('volumeChanged', function() { // do something when volume changes }); playerSingleton.setVolume(75); // bam our event fires. How would something like this be done with jQuery? I know there's .bind and .trigger, but it seems like the only way to do this is to bind/fire events to the window object: $(window).bind('volumeChanged', fn); Is there anything better than this, more like the MooTools approach? Thanks!

    Read the article

  • Using Microformats but protecting your email (with Javascript).

    - by Lukas Oppermann
    Hey guys, I am using microformats for a project and with this I have the following Problem. I use a Javascript to protect the email addresses, but when saving the microformats as a vCard it puts the javascript code in the email address field. //<![CDATA[ document.write("<n uers="znvygb:vasb100irner56arg">vasb100irner56arg<057n>".replace(/[a-zA-Z]/g, function(c){return String.fromCharCode((c<="Z"?90:122)>=(c=c.charCodeAt(0)+13)?c:c-26)}))//]]> Does anyone have any idea how to still protect the email address but use microformats? Thanks in advance.

    Read the article

  • Javascript library to reliably delay-load java applets

    - by paleozogt
    I'd like to delay-load a Java Applet in the same way that SwfObject loads Flash SWFs-- you supply it a div id and it replaces the div's contents. This would allow the whole page to load before the Applet starts. However, I'd also like to use a best-practices Javascript library like deployJava.js or applet-fu. The problem with these libraries is that they only use document.writeln-- if you use them after the DOM loads they will clobber the page. Are there any Applet-loading JavaScript libraries that allow for delay-loading?

    Read the article

  • To see javascript object properties and functions with intellisense in VS.NET 2008

    - by uzay95
    I am creating classes in external files.And adding them with <script src='../js/clsClassName.js' type='text/javascript'></script> tags. When i created an object from this class I can't access its props, and functions with intellisense. Is there any way to achieve this? Sample javascript class: // clsClassName.js function ClassName(_param1, _param2, _param3) { this.Prop1 = _param1; this.Prop1 = _param2; this.Prop3 = _param3; } ClassName.prototype.f_Add = function(fBefore, fSuccess, fComplete, fError) { } ClassName.prototype.f_Delete = function(fBefore, fSuccess, fComplete, fError) { } Any help would be greatly appreciated...

    Read the article

  • Model-View-Controller in JavaScript

    - by Casey Hope
    tl;dr: How does one implement MVC in JavaScript in a clean way? I'm trying to implement MVC in JavaScript. I have googled and reorganized with my code countless times but have not found a suitable solution. (The code just doesn't "feel right".) Here's how I'm going about it right now. It's incredibly complicated and is a pain to work with (but still better than the pile of code I had before). It has ugly workarounds that sort of defeat the purpose of MVC. And behold, the mess, if you're really brave: // Create a "main model" var main = Model0(); function Model0() { // Create an associated view and store its methods in "view" var view = View0(); // Create a submodel and pass it a function // that will "subviewify" the submodel's view var model1 = Model1(function (subview) { view.subviewify(subview); }); // Return model methods that can be used by // the controller (the onchange handlers) return { 'updateModel1': function (newValue) { model1.update(newValue); } }; } function Model1(makeSubView) { var info = ''; // Make an associated view and attach the view // to the parent view using the passed function var view = View1(); makeSubView(view.__view); // Dirty dirty // Return model methods that can be used by // the parent model (and so the controller) return { 'update': function (newValue) { info = newValue; // Notify the view of the new information view.events.value(info); } }; } function View0() { var thing = document.getElementById('theDiv'); var input = document.getElementById('theInput'); // This is the "controller", bear with me input.onchange = function () { // Ugly, uses a global to contact the model main.updateModel1(this.value); }; return { 'events': {}, // Adds a subview to this view. 'subviewify': function (subview) { thing.appendChild(subview); } }; } // This is a subview. function View1() { var element = document.createElement('div'); return { 'events': { // When the value changes this is // called so the view can be updated 'value': function (newValue) { element.innerHTML = newValue; } }, // ..Expose the DOM representation of the subview // so it can be attached to a parent view '__view': element }; } How does one implement MVC in JavaScript in a cleaner way? How can I improve this system? Or is this the completely wrong way to go, should I follow another pattern?

    Read the article

  • onclick event from XML Nodes

    - by user256007
    My Documents are a mixture of XML and HTML Tags. where HTML tags are pulled from xhtml namespace and mine are from various namspaces. I wanna take user interaction events from XML Nodes of my Document. I First tried <do:landingTime xhtml:onclick="fnc">20:48:29.45</do:landingTime> with no Luck. But <xhtml:span onclick="fnc"> works. So is there any solution/tricks/hacks/backdoor to take events from my xml Nodes.

    Read the article

  • can you explain this jquery method from jquery.js

    - by mrblah
    Trying to understand how jquery works under the covers, what's the difference between: jQuery.fn and jQuery.prototype jQuery = window.jQuery = window.$ = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context ); }, and then: jQuery.fn = jQuery.prototype = { init: function( selector, context ) {

    Read the article

  • detect focus on browser address bar?

    - by jedierikb
    Is there a way to detect when focus has been put onto the address-bar or the browser-search-bar? I ask because I am trying to keep focus on one element in my document, but adding a blur() listener to that element works too well in safari mac -- you can't put focus on the address-bar!

    Read the article

  • how to call the methos

    - by vicky
    for (i = 0; i < 4; i++) { DeCheBX = $('MyDiv').insert(new Element('input', { 'type': 'checkbox', 'id': "Img" + obj[i].Nam, 'value': obj[i].IM, 'onClick': 'shohide()' })); document.body.appendChild(DeCheBX); DeImg = $('MyDiv').insert(new Element('img', { 'id': "Imgx" + obj[i].Nam, 'src': obj[i].IM })); document.body.appendChild(DeImg); } function shohide() { for (i = 0; i < 4; i++) { ($('Img' + obj[i].Nam).checked == true) { alert("press" + obj[i].Nam); } } }

    Read the article

  • Add client side javascript code and ASP.Net validation on a asp.net button

    - by Vinni
    Hello guys, I wanted to write javascript code on "OnClientClick" of the asp.net button and also I want the asp.net validation to be run for that button. but when i mix these both validation is not working. please help me out. Below is my code ASPX <asp:Button ID="btnAddToFeatureOffers" runat="server" Text="Add to Feature Offers" OnClick="btnAddToFeatureOffers_Click" ValidationGroup="vgAddOffer" OnClientClick="add();" /> javascript function add() { var selectedOrder = $('#ctl00_MainContent_ddlFeaturedHostingType option:selected')[0].index; var offer = $('#<%=txtOrder.ClientID%>').val(); var a = $("<a>").attr("href", "#").addClass("offer").text("X"); $("<div>").text(offer).append(a).appendTo($('#resultTable #resultRow td')[selectedOrder - 1]); }

    Read the article

  • How can I detect if the browser has encountered a JavaScript error ... in JavaScript?

    - by RichH
    For automated testing reasons I want to detect if the browser has encountered JavaScript errors for a page. The type of things that would cause the red numbers in the bottom right in Firebug or yellow warning icon in the Internet Explorer status bar. These JS errors could come from any one of a large numbers of scripts. How in JavaScript can I detect these browser errors? Cross browser solutions prefered, but hey, I'll take anything! As a bonus it would also be great to know the script that caused the error.

    Read the article

  • Buttons OnClick Event not firing when it causes a textboxes onChange event to fire first

    - by user48408
    I have a few textboxes and button to save their values on a webpage. The onchange event of the textboxes fires some js which adds the changed text to a js array. The ok button when clicked flushes this to the database via a webservice. This works fine except when the onchange event is caused by clicking the ok button. In this scenario the onchange of the textboxes still fires but the onClick event of the button does not. Any ideas? textboxes look something like <input name="ctrlJPView$tbcTabContainer$Details$JP_Details_Address2Text" type="text" value="test" id="ctrlJPView_tbcTabContainer_Details_JP_Details_Address2Text" onchange="addSaveDetails('Jobs###' + document.getElementById('ctrlJPView_tbcTabContainer_Details_JP_Details_Address2Text').value + ');" style="font-size:8pt;Left:110px;Top:29px;Width:420px;Height:13px;Position:absolute;" /> My save button <input type="button" name="ctrlJPView$btnOk" value="OK" onclick="saveAmendments();refreshJobGrids();return false;__doPostBack('ctrlJPView$btnOk','')" id="ctrlJPView_btnOk" class="ControlText" style="width:60px;" /> UPDATE: I guess this comes down to one of two things. 1) Something is happening before the onClick of the button gets called to surpress that call such as an inadvertent return false; or 2) the onClick event isn't firing at all. Now I've rem'd out everything actually inside the functions that are being called beforehand but the problem persists. But if i remove the call altogether it works (???)

    Read the article

  • Javascript undefined variable

    - by djairo
    I have a problem with a javascript error: $("#slider") is undefined How can i solve this problem? <script type="text/javascript"> $(document).ready(function() { $("#slider").easySlider({ controlsBefore: '<p id="controls">', controlsAfter: '</p>', prevId: 'prevBtn', nextId: 'nextBtn' }); }); </script> This is my html <div id='slider'> <table> <tr> <td width='325'>hello</td> <td width='325'>hello</td> </table> </div>

    Read the article

  • How do I refresh TinyMCE for the code that I add with JavaScript

    - by Sam Kong
    Hi, I need to insert code for flash to TinyMCE with JavaScript. If I insert the same code using HTML menu of TinyMCE, it automatically add flash icon to the editor. But if I insert the code using JavaScript, the actual code is inserted but it shows nothing on the screen. One trick I found is toggle TinyMCE to normal textarea and back to TinyMCE. Then, it shows the flash icon. Is there a better way to do that? Thanks. Sam

    Read the article

< Previous Page | 52 53 54 55 56 57 58 59 60 61 62 63  | Next Page >