Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
1,291,437
1,291,438
Javascript resize big image only works after F5
<p>I use this javascript to resize, to a max of 800px, a big (5Mb) image on a page:</p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function () { $('.detailImg').each(function () { var maxWidth = 800; // Max width for the image var maxHeight = 800; // Max height for the image var ratio = 0; // Used for aspect ratio var width = $(this).width(); // Current image width var height = $(this).height(); // Current image height // Check if the current width is larger than the max if (width &gt; maxWidth) { ratio = maxWidth / width; // get ratio for scaling image $(this).css("width", maxWidth); // Set new width $(this).css("height", height * ratio); // Scale height based on ratio height = height * ratio; // Reset height to match scaled image width = width * ratio; // Reset width to match scaled image } // Check if current height is larger than max if (height &gt; maxHeight) { ratio = maxHeight / height; // get ratio for scaling image $(this).css("height", maxHeight); // Set new height $(this).css("width", width * ratio); // Scale width based on ratio width = width * ratio; // Reset width to match scaled image } }); }); </code></pre> <p> </p> <p>When page is loaded the image is not resized. No errors on FireBug console. If I try to refresh the page with F5, the image get resized! If I try Ctrl + F5, images return at original size!</p> <p>Where is the problem? Why this javascript only works when the page is refreshed?</p>
javascript jquery
[3, 5]
2,036,004
2,036,005
Add validation method to "jquery validation plugin"
<p>Hello im using jquery validation plugin to validate my form. I want to add one more rule to the validation, but cant get it to work. <strong>Input value should be less or equal previous element value.</strong></p> <p>It is possible to do it ?</p> <p>Here is the code -</p> <pre><code>&lt;input type='text' value='&lt;?php echo $count; ?&gt;' class='input_in_stock' readonly="readonly" /&gt; &lt;input type='text' name='amount[]' id='&lt;?php echo rand(0,99).$id; ?&gt;' size='1' value='&lt;?php echo $count; ?&gt;' class='required input_count' /&gt; $(document).ready(function(){ $.validator.addMethod('positiveint', function (value) { return (value &gt; 0) &amp;&amp; (value != 0) &amp;&amp; (value == parseInt(value, 10)); }, 'Enter a positive integer value.'); $.validator.addMethod('notmorethan', function (value) { return (value &lt;= $(this).prev().val()); }, 'abc.'); $("#cartform").validate({ rules: { "amount[]": { required: true, positiveint: true, notmorethan: true } }, errorPlacement: function(error, element) { error.appendTo(element.next()); } }); }); </code></pre> <p>p.s. I used this jquery validation plugin fix to make it work with names like this[] <a href="http://www.codeboss.in/web-funda/2009/05/27/jquery-validation-for-array-of-input-elements" rel="nofollow">http://www.codeboss.in/web-funda/2009/05/27/jquery-validation-for-array-of-input-elements</a></p> <p>EDIT: found the solution</p> <pre><code>$.validator.addMethod('notmorethan', function (value, element) { return (value &lt;= $(element).prev().val() ); }, 'abc'); </code></pre>
javascript jquery
[3, 5]
4,946,730
4,946,731
How do I assign javascript variable to php variable?
<p>i have a javascript variable which have some value that variable value assign to php variable how i do this thing</p> <pre><code>&lt;script type="text/javascript"&gt; var view = true; var bcount=10; var wcount=10; var tcount=10; &lt;/javascript&gt; &lt;?php $whitelistcount=???? ?&gt; </code></pre> <p>in this code i have no use ajax and jquery only simple javascript and core php</p>
php javascript
[2, 3]
2,292,412
2,292,413
Jquery clone a table with specific row class
<p>Hey how can I clone the table named teamselectiontable with just the table rows that have the class "chosen", and modify another table and replace its contents with the table rows found. But keeping the class names of "row" in the appended table.</p> <pre><code>&lt;table id="teamselectiontable"&gt; &lt;tr class="chosen"&gt;content&lt;/tr&gt; &lt;tr class="something"&gt;content&lt;/tr&gt; &lt;tr class="something"&gt;content&lt;/tr&gt; &lt;tr class="something"&gt;content&lt;/tr&gt; &lt;tr class="something"&gt;content&lt;/tr&gt; &lt;tr class="chosen"&gt;content&lt;/tr&gt; &lt;tr class="chosen"&gt;content&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>To a table like below.</p> <pre><code>&lt;table id="talentselection"&gt; &lt;tr class="row"&gt;&lt;/tr&gt; &lt;tr class="row"&gt;&lt;/tr&gt; &lt;tr class="row"&gt;&lt;/tr&gt; &lt;/table&gt; </code></pre> <p>Thanks for any help.</p>
javascript jquery
[3, 5]
1,480,726
1,480,727
Hide li elements if href is empty
<p>I have:</p> <pre><code>&lt;ul class="webServicesURLS"&gt; &lt;li&gt;&lt;asp:HyperLink ID="restURL" runat="server" Text="REST" /&gt;&lt;/li&gt; &lt;li&gt;&lt;asp:HyperLink ID="bboxURL" runat="server" Text="BBox" /&gt;&lt;/li&gt; &lt;li&gt;&lt;asp:HyperLink ID="esbURL" runat="server" Text="ESB" /&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>In which the href link is added in code behind if such link is available in database. I want to hide the <code>&lt;li&gt;</code> that don't have any href links added to them, using jQuery, and in case I don't have any href links in them then hide the <code>&lt;ul&gt;</code>.</p>
c# jquery asp.net
[0, 5, 9]
4,735,364
4,735,365
How to check if value from a cell in a column is !=NULL?
<p>I'm trying on gridview updated to check if a cell from a certain column is != NULL ( to check if the user wrote something into the cell)</p> <p>My problem is I don't know how to get the "x column" value from cell.</p>
c# asp.net
[0, 9]
4,514,288
4,514,289
How to verify that the mouse over an element?
<p>Do you know how to check whether the mouse is over an element?</p> <p>Somethnig like this?</p> <pre><code>setTimeout(function() { if($(this).mouseover()) { // this not work return false; } else { $(this).hide(); } }, 1000); </code></pre> <p>Thanks.</p>
javascript jquery
[3, 5]
1,993,290
1,993,291
jQuery hasClass check on altered DOM
<p>I'm having trouble with the jQuery function 'hasClass'. It returns false while it should return true. The hasClass function is looking for an class which was added by javascript. So maybe the hasClass function can't find classes in altered HTML? If so, how can I fix it the best way?</p> <pre><code>$(".slides").mouseover(function(){ $(this).stop(true, true).animate({"width": "+=30px", "height": "+=30px", "margin-top": "+=15px"}, 200); }) $(".slides").mouseout(function(){ alert($(this).hasClass('activeSlide')); if(!$(this).hasClass('activeSlide')){ $(this).stop(true, true).animate({"width": "-=30px", "height": "-=30px", "margin-top": "-=15px"}, 200); } }); $("body").click(function(){ $(".activeSlide").removeClass("activeSlide"); }); $(".slides").click(function(){ $(".activeSlide").removeClass("activeSlide"); $(this).addClass("activeSlide"); alert("Set"); }); </code></pre>
javascript jquery
[3, 5]
2,035,708
2,035,709
Best approach optional settings jQuery plugin
<p>Take a <em>very</em> simple jQuery plugin boilerplate:</p> <pre><code>var _defaults = { foo: false }; function Plugin( settings ) { this.opts = $.extend( {}, _defaults, settings ); } </code></pre> <p>I have a <code>doSomething</code> method that can only run successfully if the option <code>foo</code> is set to <code>true</code> and there are other methods that may <code>doSomething()</code> at a certain point so I had a dilemma on where to place my <code>if</code> statement. First I thought:</p> <pre><code>Plugin.prototype = { doSomething: function() { // Do something that depends on foo }, method: function() { ... if ( this.opts.foo ) { this.doSomething() } }, method: function() { ... if ( this.opts.foo ) { this.doSomething() } } }; </code></pre> <p>But then for the sake of DRYness I decided to do this:</p> <pre><code>Plugin.prototype = { doSomething: function() { if ( this.opts.foo ) { // Do something that depends on foo } }, method: function() { ... this.doSomething(); }, method: function() { ... this.doSomething(); } }; </code></pre> <p>So now methods that may utilize <code>doSomething</code> run the function regardless of it being empty if <code>foo</code> is <code>false</code>.</p> <p>So my question is, what is a better approach? The second one is shorter but it has to look-up the method everytime even if it's not necessary just to perhaps run an empty function. So is the first one more efficient? </p> <p>Oh, and yes, I know probably this is micro-optimization and folks will say don't worry about it but I'm just curious...</p>
javascript jquery
[3, 5]
4,355,297
4,355,298
Jquery Error: $("[data-weight]") is null
<p>Stripped a ton of stuff to make it more readable, it throws an error on the line:</p> <pre><code>$('[data-weight]').each(function() { </code></pre> <p>Saying that it is null</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head id="ctl00_mainHead"&gt; &lt;script type="text/javascript" src="includes/jqueryv1.4.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function() { $('[data-weight]').each(function() { var usingMetric = false; var $this = $(this); var value = $this.attr("data-weight"); if (usingMetric) { $this.text(value + " KG"); } else { value = parseFloat(value) * 2.20462262; // Convert to imperial $this.text(value + " lbs"); } }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form name="aspnetForm" method="post" action="viewProduct.aspx?ID=3&amp;amp;action=added" id="aspnetForm"&gt; &lt;div class="productDetail"&gt; &lt;b&gt;Product Details&lt;/b&gt; &lt;/div&gt; &lt;strong data-weight="200"&gt;800 KG&lt;/strong&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Update</strong></p> <p>It's a follow on my this question:</p> <p><a href="http://stackoverflow.com/questions/3749900/using-javascript-to-display-weights">http://stackoverflow.com/questions/3749900/using-javascript-to-display-weights</a></p>
javascript jquery
[3, 5]
1,603,989
1,603,990
How can I load an apk dependency from the android market?
<p>I'm using google moderator as a simple way to collect feedback for my application. There's a google moderator app on the market that provides a better interface than the website for mobile users. </p> <p>Getting to the point: Is there a way to get it to install along with your application or a reasonable way to identify if another package is available so I can direct users to the market to download it? </p>
java android
[1, 4]
1,452,890
1,452,891
usage of jquery .live() to work with both present and future DOM
<p>I've my jQuery code as</p> <pre><code>$('#tarea').click(function() { // Do stuffs }); </code></pre> <p>This works fine for the button #tarea loaded along with this script. If the button #tarea had been loaded using ajax in future, than the above code doesn't work.</p> <p>Now I changed the code to</p> <pre><code>$('#tarea').live('click', function() { // Do stuffs }); </code></pre> <p>This time, the button #tarea if loaded along with the script doesn't work. But the script works with the button if generated using ajax.</p> <p>How do I write the script so that in both cases, it works??</p>
javascript jquery
[3, 5]
471,487
471,488
jQuery/Javascript: get full height of element?
<p>hey guys, my blog has a content div with an id of #content. When i Select it e.g. with Firebug it outlines the full height of the div. With all it's padding &amp; margin at the top and the bottom. </p> <p>jquery height() returns only the inner height of the element it self. </p> <p>how can i query the FULL height of the element. If there are other elements with a lot padding and margin in it i want ALL OF IT added up and as one value.</p> <p>Which method should i use?</p>
javascript jquery
[3, 5]
4,843,912
4,843,913
Alert message box is not displaying when a checkbox is checked
<p>I want to know whether at least on checkbox was checked, so I'm using the following code.</p> <pre><code>function CheckIfAtLeastOneBoxIsCheckedBeforeSavingForm() { var n = $('input[id*="ckHMreq"]:checked').length; alert(n); } </code></pre> <p>When no checkbox is checked, the alert message box displays 0. However, when at least one checkbox is checked then the alert message box doesn't even display. </p> <p>Any reason for that?</p> <h1>EDIT</h1> <p>This is the HTML produced by the browser</p> <pre><code>&lt;input id="contentMain_cklistPayroll_gvCKList_ckHMreq_0" type="checkbox" name="_ctl0:contentMain:cklistPayroll:gvCKList:_ctl2:ckHMreq" /&gt; </code></pre> <p>I also added "checked" to the jquery code. I still get 0 when no checkbox is checked and no message box when any checkbox is checked.</p>
jquery asp.net
[5, 9]
3,832,905
3,832,906
Is this a good asp.net website architecture choice?
<p>I am currently working on an asp.net website and I am using web forms. I have some experience building asp.net websites before using the server controls(grid view,charts,etc) and I feel they are slow. I tried some jquery suites that have all the controls(grid,chart,tree,etc), at least the ones I need, and I like them mostly because of their speed and improved user experience. I am planning to not use any asp server controls and use plain html and the jquery plugins instead on my website. </p> <p>Is it a good choice to not use any asp.net server controls and move most of the processing to client side?</p> <p>I know that if the client browser has javascript turned off, then my site won't work at all.</p> <p>But other than that, what problems I might face in view of our future plans to develop mobile application and/or implement MVC ?</p> <p>Why should I use asp.net server controls at all if every thing is finally rendered as html and when I can get/post data using jquery ajax requests?</p> <p>Any help is greatly appreciated. </p>
jquery asp.net
[5, 9]
1,049,071
1,049,072
Running .vbs script file in asp.net using process class
<p>I need to run a vbscript file in my asp.net application. This vbscript file generate a pdf and store it in specified location. I used process class and give the command it is working fine but when i host the application in IIS 7.0 it is not working rather it does not give any error too. I am using admin user.</p> <p>What could be the issue?</p>
c# asp.net
[0, 9]
1,467,293
1,467,294
JQuery tbody question - ASP.NET
<p>I have a aspx page that looks something like this:</p> <pre><code>&lt;table runat="server" id="tblTEst"&gt; &lt;tr id="trHeader" runat="server"&gt; &lt;/tr&gt; &lt;tr id="trRow1" runat="server"&gt; &lt;/tr&gt; &lt;tr id="trRow2" runat="server"&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>When I write my JQuery to say get a count of s, I need to do:</p> <pre><code>alert($('#' + strTableId).children('tbody').children('tr').length); </code></pre> <p>My question is when does the TBODY get added? When I do a InnerHTML, I do see the TBODY. I was wondering if this is something ASP.NET does?</p> <p><strong>EDIT Thanks for the answers. If it's added by the browser, do I need to worry about testing the code in multiple browsers to ensure compatibility of JQuery? I was under the impression, JQuery is compatible with all browsers and I would'nt have to worry about testing the code on different browsers.</strong></p>
asp.net jquery
[9, 5]
5,963,615
5,963,616
php header("location: test.php") not working. But java script redirect working
<blockquote> <p><strong>php header("location: test.php")</strong></p> </blockquote> <p>not working. But java script redirect working .</p> <p>I tried with header() doesn't redirects?</p> <blockquote> <p><strong>header("location: test.php");</strong></p> </blockquote> <p>but i tried with java script its working</p> <blockquote> <p><strong>window.location ="http://www.test.com/test.php"</strong></p> </blockquote> <p>what is the problem. please give some solution</p> <p>before calling header there no <strong>echo</strong> ( output commands )</p> <p>there is no error / warning messages</p> <p><strong>My exact code :</strong></p> <pre><code>if($contlogin &gt;0 &amp;&amp; $LoginID!="") { $_SESSION['LoginID'] = $LoginID; if($_SESSION['currentUrl']) { header("location: http://".$_SESSION['currentUrl']); } else { if($LoginID==1) { header("location:admin/index.php"); } else { header("location:dashboard.php"); } } } else { header("location:index.php?err=1"); } </code></pre>
php javascript
[2, 3]
875,698
875,699
Android getWindow to set the background of my activity according to Listpreference
<p>I've basically created a ListPreference where user would be able to choose from a list of options. After they have chosen one of the available option,the app will return to the main activity and the background image will change accordingly,however,it seems my app would't be able to detect the change in preference and change the background image.Can somebody please advice?Thanks!***Below snippet shows after my main activity resume,how it detects the change in preference and change the background image.</p> <pre><code>protected void onResume() { super.onResume(); listener = new SharedPreferences.OnSharedPreferenceChangeListener() { public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if(key.equals("listPrefwall")){ tv.setText(prefs.getString("listPrefwall", "ondon")); if(prefs.getString("listPrefwall", "ondon")=="ondon") { getWindow().setBackgroundDrawableResource(R.drawable.ondon); tv.setText("testing"); } else if(prefs.getString("listPrefwall", "ondon")=="japan") { getWindow().setBackgroundDrawableResource(R.drawable.japan); tv.setText("pivot"); } } } }; settings.registerOnSharedPreferenceChangeListener((OnSharedPreferenceChangeListener) listener); } </code></pre>
java android
[1, 4]
3,722,550
3,722,551
Looping through data in Javascript, combining new id's with old
<p>Many times I'm having to loop through data and add the new to the old, but I can never seem to get it right.. Here's what I have now, basically trying to concatinate together the previous number from the new number, ultimately building a comma delimited string of numbers:</p> <pre><code> function showItems(){ if(prev_numbers == undefined){ var prev_numbers = ''; }else{ prev_numbers = prev_numbers; } numbers = Math.floor(Math.random()*101); values = numbers +','+ prev_numbers; // Here is where some code would be that makes use of comma delimited numbers alert(values); prev_numbers = values; } setInterval(showItems, 1000); </code></pre>
javascript jquery
[3, 5]
208,446
208,447
Calling a private function of one object from the other in Javascript
<pre><code>var STICKIES = (function () { /* some code here*/ createSticky = function createSticky(data) { $('#color-picker'+data.id).ColorPicker({ color: '#0000ff', onShow: function (colpkr) { $(colpkr).fadeIn(500); return false; }, onHide: function (colpkr) { $(colpkr).fadeOut(500); </code></pre> <blockquote> <pre><code> // TODO: Call saveSticky from here </code></pre> </blockquote> <pre><code> return false; }, onChange: function (hsb, hex, rgb) { $('#'+data.id).css('background-color', '#' + hex); colorInHex = hex; } }); }, saveSticky = function saveSticky() { var that = $(this), sticky = (that.hasClass("color-pick") || that.hasClass("sticky-status") || that.hasClass("sticky-content") || that.hasClass("sticky-status-time")) ? that.parents('div.sticky'): that, obj = { id : sticky.attr("id"), top : sticky.css("top"), left: sticky.css("left"), text: sticky.children(".sticky-content").text(), createdDate: sticky.find(".sticky-status-time").text(), colorOfNote: rgb2hex(sticky.css("background-color")) } localStorage.setItem("sticky-" + obj.id, JSON.stringify(obj)); sticky.find(".sticky-status").css('color','grey').text("saved"); chkForNoNote(); }, /* some code here*/ return { open : openStickies, init : initStickies, "new" : createSticky, remove : deleteSticky }; }()); </code></pre> <p>// I am trying to save color while creating a sticky note. For this, in function onHide() i need to call <code>saveSticky().</code> <code>saveSticky()</code> happens to be the function of STICKIES and <code>ColorPicker()</code> to be the function of colorPicker. How shall I call saveSticky?</p>
javascript jquery
[3, 5]
5,169,469
5,169,470
js typing text to screen
<p>hey guys i have a problem with a function which runs just fine on my localhost by when i upload it to the server it doesn't work, could some one please point me to the solution:</p> <pre><code>var text = "some text"; var textArray = text.split(""); var looptimer; function letterloop(){ if (textArray.length &gt; 0){ $("#divx").append(textArray.shift()); } else { clearTimeout(looptimer); var div = $("&lt;a href=\"#\" onmousedown=\"javascript:continueOne();\" style=\"margin-top:70px; display:block; text-align:center;\" id=\"continue\" class=\"send_msg_blue\"&gt;continue&lt;/a&gt;").hide().fadeIn(4000); $("#div").append(div); return false; } looptimer = setTimeout("letterloop()",60); } letterloop(); </code></pre>
javascript jquery
[3, 5]
5,081,097
5,081,098
Possible to append html before and after template?
<p>Is it possible to append html before and after a <a href="http://api.jquery.com/jquery.tmpl/" rel="nofollow">JQuery.tmpl</a>?</p> <p>I would like to insert a nested table in</p> <pre><code>&lt;table id="accTable"&gt; &lt;tr class="row" id="12345"&gt; &lt;/tr&gt; &lt;!-- New row to be inserted here --&gt; &lt;/table&gt; </code></pre> <p>so I have done</p> <pre><code>var dat = []; $.each(result, function(key, value){ dat.push({ FROM: this.date, ID: key, }); }); var markup = "&lt;tr&gt; &lt;td&gt;${ID}&lt;/td&gt; &lt;td&gt;${FROM}&lt;/td&gt; &lt;/tr&gt;"; $.template("actTemplate", markup); $('#'+id).tmpl("actTemplate", dat).after('#'+id); </code></pre> <p>But somehow I need to append <code>&lt;tr&gt;&lt;td&gt;&lt;table&gt;</code> and prepend <code>&lt;/table&gt;&lt;/td&gt;&lt;/tr&gt;</code>.</p> <p>I have thought about adding that HTML to the existing, but it should happen in a button press, so until it is pressed would it look wrong. So I guess the append and prepend have to happen when the template is inserted...?</p> <p>Any suggestions on how to solve this?</p> <p><strong>Update</strong></p> <p>In this jsFiffle will a row be added/removed when "Details" is clicked. This is the row that I would like to replace.</p> <p><a href="http://jsfiddle.net/littlesandra88/hhMM6/" rel="nofollow">http://jsfiddle.net/littlesandra88/hhMM6/</a></p>
javascript jquery
[3, 5]
473,451
473,452
visual studio desktop application for iphone/Android apps
<p>i want to develop one desktop application using c# sql lite, this application i want to submit this app to Apple store in case of iphone/ likewise for Android. please let me know if it is feasible to do, if so please let me know the steps that need to be incorporated in order to achieve this.</p>
iphone android
[8, 4]
4,464,934
4,464,935
RedirectUrl info lost after doing postback in client-side code
<p>My login page works like this: when you enter it, javascript reads some info from you, writes it into some input and does submit so that the read data can be read and processed on server.</p> <pre><code>&lt;script language="javaScript" type="text/javascript"&gt; function getUserInfo() { var userInfo = xyz.GetSecureBox(); form1.info.value = userInfo; form1.read.value = "true"; form1.submit(); } &lt;/script&gt; </code></pre> <p>Server code authenticates user or not, depending on the provided data. </p> <p>The problem is that when you try to enter a different page, let's make it Default.aspx, you are redirected to login page with RedirectUrl parameter so that you can be authenticated. But after postback made i javascript the RedirectUrl information is lost. How can I preserve it? </p> <p>Well I can of course read that query string parameter in js and write it into some input. How can I access query string parameters in JS? And maybe there is a different way?</p>
asp.net javascript
[9, 3]
5,417,054
5,417,055
Element floats according to scroll
<p>I would like to know how can make make an ELEMENT float according to scroll . For example , when I scroll down , the element that is <code>position:fixed</code> and <code>left:0</code> will slowly come down into viewable top left area.</p> <p>Can this be done using jQuery?</p>
javascript jquery
[3, 5]
3,543,029
3,543,030
Access DataItem object on RepeaterItemCommand
<p>how I can to access my Repeater DataItem when a fire button command? I can see that DataItem return null.</p> <p>There is some possibility?</p>
c# asp.net
[0, 9]
5,925,917
5,925,918
How to change output HTML tag <b></b> to <strong></strong>?
<p>How to replace <code>&lt;b&gt;&lt;/b&gt;</code> tag with <code>&lt;strong&gt;&lt;/strong&gt;</code> tag to a specific div?</p> <p>ex: </p> <pre><code>&lt;div id="aaa"&gt;hello&lt;b&gt;wow&lt;/b&gt;!&lt;/div&gt; </code></pre> <p>using javascript to replace with</p> <pre><code>&lt;div id="aaa"&gt;hello&lt;strong&gt;wow&lt;/strong&gt;!&lt;/div&gt; </code></pre> <p>please help! thanks in advance.</p> <p><img src="http://i.stack.imgur.com/SIal1.png" alt="enter image description here"></p> <p><strong><em></strong> Why I'm try to do is change the output HTML code <code>&lt;b&gt;&lt;/b&gt;</code> to <code>&lt;strong&gt;&lt;/strong&gt;</code> , in order to get W3C validation. Can I do that? *</em></p> <p><strong>Or Is there any solution that can use ASP.NET+C# to do that?</strong></p>
c# javascript asp.net
[0, 3, 9]
3,672,380
3,672,381
Why won't my image display?
<p>Do y'all see anything wrong with my code below? I want my image to appear immediately after page opens but it only opens after the report is run. If this looks complete then could javascript help? Please let me know. Thanks.</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SelectionReport.aspx.cs" Inherits="Geocortex.Essentials.WebFramework.SelectionReportPage" Culture="auto" UICulture="auto" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head id="Head1" runat="server"&gt; &lt;title&gt;&lt;asp:Literal meta:resourcekey="Title1" runat="server" /&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;p&gt; &lt;asp:Image ID="Image1" runat="server" ImageAlign="Left" ImageUrl="~/Images/Loading.gif" style="z-index: 1; left: 254px; top: 15px; position: absolute" /&gt; &lt;/p&gt; &lt;gcx:SelectionReportViewer ID="SelectionReportViewer" runat="server" /&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p></p>
asp.net javascript
[9, 3]
1,057,471
1,057,472
Check File in the server is change or not
<p>I am trying to make an app that connect to the server. The app is used by some devices. If one of the devices upload something to the server, I would like other devices receive the notification about the server has something new. My question is, how to check the server is change or not? How often we must check the server? I wonder how the Online Messaging work, because someone send something, we receive the message ASAP Is the concept can be use with my app?</p>
java android
[1, 4]
2,055,424
2,055,425
What's Android Equivalent of iOS's Post Notification and Delegate function?
<p>I find the Post notification and delegate function are very useful in iOS. Once I finish a task I can notify other piece of code to do something, I am sending out notices for others to do the work.</p> <p>Post Notification is when you sending notice right away, whereas delegate is sometime down the line, it will send a notice.</p> <p>In Android, I know there's event Listener, but that's only passive listening, what about me ctively sending notices. </p> <p>Does Android has that in equivalent?</p>
iphone android
[8, 4]
3,185,852
3,185,853
add new div dynamically but click event is not working on new divs
<p>Im trying to make a button so that when I click on it it creates a new button after it then when I click on the next/new button it will create a button after itself but the click event only works on the first button, can you help?</p> <p>Here is my fiddle = <a href="http://jsfiddle.net/hyeFB/" rel="nofollow">http://jsfiddle.net/hyeFB/</a></p> <pre><code>// $(document).ready(function () { var myDiv = '&lt;div class="myButton"&gt;myButton&lt;/div&gt;'; $('#c').append(myDiv); $('.myButton').click(function () { $(this).after(myDiv); }); //});​ </code></pre>
javascript jquery
[3, 5]
5,272,918
5,272,919
What is an action message
<p>This is a really oblivious question. I am trying to figure out what an "action message" is? I assume it has something to do with javascript or java, but can't find anything about it on google.</p>
java javascript
[1, 3]
4,199,939
4,199,940
Is it possible to use a custom java class in an android app?
<p>I know Android apps are based off of Java, I was just wondering is it possible to use a custom Java class in an Android app. The class uses the following java libraries.: </p> <p><code>import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*;</code></p> <p>If not what are the equivalent Android libraries I would need for the translation?</p>
java android
[1, 4]
2,995,729
2,995,730
How to implement Windows service kind of infrastructure in ASP.NET
<p>I have limitations to host Windows Services in my web hosting provider. But i need run small task frequently.</p> <p>Do we have any other framework/api which provides similar infrastructure like "Windows Services" from ASP.NET?</p>
c# asp.net
[0, 9]
3,326,262
3,326,263
How to check element triggered by onBlur has certain class with jQuery
<p>HTML</p> <pre><code> &lt;input type="text" id="trainingFee" name ="training Fee" class="number error" value="" onblur="callMe()"&gt; </code></pre> <p>jQuery</p> <pre><code> function callMe(){ if($this.id).hasClass('error')){ alert("has error class"); } </code></pre> <p>}</p> <p>but this is not working. What am I doing wrong?</p>
javascript jquery
[3, 5]
71,745
71,746
Implication of Static Methods
<p>What is the implication when i used 70% of methods of my web application as Static Methods? I am facing the System out of memory exception in my application. Is the static method cresting the problem or some thing else.</p>
c# asp.net
[0, 9]
3,872,985
3,872,986
Process Involved in PHP Screen Scraping
<p>Can anyone tell me the process involved n PHP Screen Scraping of aspx page using POST Request? I want to download the data from a website and save it to Database.</p>
php asp.net
[2, 9]
4,339,347
4,339,348
Accessing key of an array on HTML check boxes
<p>I have a tree with checkboxes and their id has key for item and value as their value.</p> <pre><code>&lt;input type="checkbox" name="list_code[4]" id="list_code[4]" value="AG12345678" checked="checked"&gt; </code></pre> <p>When users select a tree element I can access those by</p> <pre><code>$('input[name^="list_code"]').each(function() { if ($(this).attr('checked')) list_code = $(this).val(); }); </code></pre> <p>I am able to get value <code>AG12345678</code> but I need to get key value too which is <code>4</code> from list_code[4] in this case. How can I access that value? </p>
javascript jquery
[3, 5]
5,410,253
5,410,254
What's the best JQuery book?
<p>I am a good javascript/asp.net developer, but i am just starting to learn JQuery, Whats the best book to learn JQuery? Books i like their style: Complete reference How to program</p>
javascript jquery asp.net
[3, 5, 9]
440,250
440,251
javascript method not compiling in IE but works fine when running debug
<p>I made this javascript method that I altered from an existing script that I found online that should rotate showing an indefinite number of <code>'.testimonial'</code> divs. The script works fine in chrome and firefox, but doesn't compile in internet explorer, unless you use f12 to start the debugging of the script. <strong>Is there a better way to write this script?</strong> I have looked online for ideas but haven't been able to find anything. I imagine that the issue is with the <code>console.log(testimonialCount);</code> statement, but am unsure of a better way to write it. Any help would be greatly appreciated. Thanks.</p> <pre><code>//rotate testimonials script jQuery('.testimonial').hide(); var testimonialCount = $('.testimonial').length; console.log(testimonialCount ); var currentItem = 0; var timeout; timeout = window.setTimeout((function(){switchDiv();})); switchDiv = function() { if (currentItem == testimonialCount - 1) { jQuery('.testimonial').eq(testimonialCount - 1).hide(); currentItem = 0; jQuery('.testimonial').eq(0).fadeIn(); timeout = window.setTimeout((function(){switchDiv();}),7000); } else { jQuery('.testimonial').eq(currentItem).hide(); currentItem = currentItem + 1; jQuery('.testimonial').eq(currentItem).fadeIn(); timeout = window.setTimeout((function(){switchDiv();}),7000); } } </code></pre>
javascript jquery
[3, 5]
4,189,533
4,189,534
How do i check after .hover has started in jQuery that the mouse is still hovering?
<p>I have li boxes that make this jQuery call when an end user hovers on them with his cursor:</p> <pre><code>$('.boxgrid.slidedown').hover(function(){ $(".cover", this).stop().animate({top:'-150px'},{queue:false,duration:300}); }, function() { $(".cover", this).stop().animate({top:'4px'},{queue:false,duration:300}); }); </code></pre> <p>Now i want to wait half a second after the user points his cursor so i could stall the slidedown effect. if the mouse is still hovering then the slidedown will continue, if not then nothing should happen.</p> <p>i tried using settimeout() without any luck. thank you.</p>
javascript jquery
[3, 5]
1,243,304
1,243,305
Dynamically adding divs through jquery
<p>I am adding elements like <code>div</code> dynamically in the page using jquery.The <code>div</code> CSS is <code>position : absolute</code> .Now my problem is when i add more than 1 div element at the same time than it all overlaps each other. Is there any way so that without changing my element's <code>position property</code> these are not overlaps?</p>
javascript jquery
[3, 5]
1,617,990
1,617,991
JQUERY outline textfield to show error
<p>I have a <code>textfield</code> and at the moment i disable the submit button when the <code>textfield</code> does not <code>hold three charactes</code>. What i want to do now is also outline the <code>textfield</code> <strong>bold red</strong> and still have the <code>submit</code> button disabled, however i cannot seem to be able to outline the <code>textfield</code> and disable the submit <code>button</code> at the same time.</p> <p>my code for disabling the submit button is as follows is it possible to be able to outline the <code>textfield</code> when the <code>length is &lt; 3</code> in this function to? </p> <p>thankfull for any help </p> <pre><code>$(function() { $('input[name="updateMessage"]').attr('disabled','disabled'); $('input[name="selectMessageForUpdate"]').keyup(function(){ if($('input[name="selectMessageForUpdate"]').val().length &lt; 3) { $('input[name="updateMessage"]').attr('disabled','disabled'); } else { $('input[name="updateMessage"]').removeAttr('disabled'); } }); }); </code></pre>
javascript jquery
[3, 5]
511,505
511,506
Convert Javascript Array to PHP
<p>I have a PHP script with curl's an external site which returns a javascript array that looks like this:</p> <p>array[0]='some stuff'</p> <p>array[1]='some more stuff'</p> <p>I would like to take this and convert it into a PHP array so I can reference it later down in the script for echoing. Is this the way to go about doing it? Is there a better way?</p> <p>Thanks!</p>
php javascript
[2, 3]
1,709,382
1,709,383
Bootstrap modal close button does not cause postback
<p>I have a boostrap modal, and here is the button to close it:</p> <pre><code> &lt;div class="modal-footer"&gt; &lt;asp:Button ID="btnClose" CssClass="btn" runat="server" Text="Close" data-dismiss="modal" aria-hidden="true" /&gt; &lt;/div&gt; </code></pre> <p>The Button and modal form are nested in an update panel. But it does not trigger a postback so the update panel does not do its thing. If I remove data dismiss then it will not close the modal.</p> <p>What could I do?</p>
c# javascript asp.net
[0, 3, 9]
1,008,569
1,008,570
Class variable in javascript class
<p>The solution to this <a href="http://stackoverflow.com/questions/84716/is-there-a-better-way-to-create-an-object-oriented-class-with-jquery" rel="nofollow" title="question">question</a> suggested the use of John Resig's class implementation. This solution covers all my needs except:</p> <p>How to declare a public global variable inside this class that can be accessed from outside?</p> <p>I would like to establish something like the following:</p> <pre><code> var MyClass = Class.extend({ EVENT_NAME : 'event-name', init : function() { // ... } }); // Now another file can directly read this value without creating the class object console.log( MyClass.EVENT_NAME ); </code></pre>
javascript jquery
[3, 5]
5,077,136
5,077,137
How do I assign a function to a global variable?
<p>I'm trying to pass the name of a javascript function to a global variable. I have a generic "CallMyWebService" function built around $.ajax(). The function's url, verb, contenttype, etc. are set based on the value of global variables. Immediately before the service function is called, the globals are set and after the globals reset to nothing. </p> <p>My generic "CallMyWebService" function is here:</p> <pre><code>function CallMyWebService() { $.ajax( { url : varUrl, type : varHttpVerb, cache : varCacheBool, data : varData, contentType : varContentType, processdata : varProcessData, dataType : varDataType, async : varAsync, success : varOnSuccess, error : varOnError, complete : varOnComplete } ) } </code></pre> <p>The problem I'm having is passing the function names to <code>varOnSuccess</code>, <code>varOnError</code>, and <code>varOnComplete</code>. If I have a function named <code>SuccessCallback()</code> and I want the the <code>result</code> of the service call passed to <code>SuccessCallback()</code>, how do I assign it to the <code>varOnSuccess</code> global variable? The variable assignment will take place in another function called <code>SetupServiceCall()</code>. In other words, in the <code>SetupServiceCall()</code> function how should <code>varOnSuccess =</code> be completed?</p>
javascript jquery
[3, 5]
4,181,489
4,181,490
How can I load a PHP file every 5 seconds with JavaScript
<p>I want a php program to be executed every 5 seconds using JavaScript. How can I do that?</p> <p>I tried using: </p> <pre><code>&lt;script type="text/javascript"&gt; setInterval( function (){ $.load('update.php'); }, 5000 ); &lt;/script&gt; </code></pre> <p>But it doesn't work.</p>
php javascript jquery
[2, 3, 5]
1,587,696
1,587,697
jquery, c# and server side data validation
<p>Ive been using jquery to post data and was wondering how best to perform serverside validation on the data. I check the values clientside but know its good practice to also check serverside. Ive seached online but cant really find any examples.</p> <p>Thanks in advance</p>
c# asp.net jquery
[0, 9, 5]
5,538,167
5,538,168
How do I detect my page control values are changed and what values are changed
<p>i have asked a similar question earlier, but this time i need a method that will detect any change made on any control of the page with old and new values in a combined string to maintain history of that particular change. Say if a user made in 4 fields of a page the method will be able to detect the change and create a string with change in old and new values.</p> <p>Note - My page controls are using Class Properties to display values.</p>
c# asp.net
[0, 9]
1,549,152
1,549,153
Create PriorityQueue from Comparator and Collection
<p>I have a Collection (a Set to be specific) and want to create a PriorityQueue from it. I also want my custom comparator, but there's no such constructor.</p> <pre> PriorityQueue(Collection c) PriorityQueue(int initialCapacity, Comparator comparator) </pre> <p><a href="http://developer.android.com/reference/java/util/PriorityQueue.html" rel="nofollow">http://developer.android.com/reference/java/util/PriorityQueue.html</a></p> <p>Is there any way to first create the PriorityQueue from the Collection and then add the Comparator later? If no, what's the most efficient way to add it "manually"?</p>
java android
[1, 4]
5,889,385
5,889,386
class cast exception while loading image from the url in android
<p>I'm using dynamic table layout, in that there is image, and textview. The data is coming from an XML document. What I want is that in table the layout at runtime, I have to get the parsed image and textview. I am getting the textview correctly but not the image. I used the method <code>LoadImageFromWebOperations</code> for loading the image, but it gets a class cast exception and error like this:</p> <pre><code>org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl$LimitedInputStream </code></pre> <p>What could be causing the exception?</p> <p><em>EDIT code from comment</em></p> <pre><code>private Drawable LoadImageFromWebOperations(String friend_image) { try { System.out.println("friend_image "+friend_image); InputStream is = (InputStream) new URL(friend_image).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; } catch (Exception e) { System.out.println("Exc at oadImageFromWebOperations "+e); return null; } } </code></pre>
java android
[1, 4]
4,367,940
4,367,941
Sound error is played when $(document).keydown is called using ALT + Some Key. [?]
<pre><code>$(document).keydown(function(e){ if(e.altKey &amp;&amp; e.keyCode == 77){ document.title = 'Something'; return false; } }); </code></pre> <p>The function is pretty simple, it's an event listener to get when the User press ALT M, then do something. But this code is playing a sound error when we hit ALT M, yes it changes the title as expected, but it also plays a sound error. (I'm testing on Windows 7 in Google Chrome)</p> <p>What should I do to make it not play this error?</p>
javascript jquery
[3, 5]
133,288
133,289
Jquery AutoComplete with inherited object paramater
<p>I am using jquery-1.9.0 and jquery-ui-1.10.0</p> <pre><code>var opts = { source: availableTags }; var optsA = Object.create(opts, { select: { value: function (event, ui) {} } }); var optsB = Object.create(opts, { select: { value: function (event, ui) {} } }); $("#tags1").autocomplete( optsB ); $("#tags2").autocomplete( optsA ); </code></pre> <p>I am trying to build up two seperate arguments lists for my autocompletes. The objects seem to be constructed correctly but the autocomplete doesnt seem to recognise my definition for the select in the inherited objects. </p>
javascript jquery
[3, 5]
3,207,037
3,207,038
Invoking button click event on one page from another page ASP.NET
<p>I have two aspx pages i.e. default1.aspx and default2.aspx. Default1 contains some controls, tables etc. I am showing Default2.aspx into anthor window using hyperlink, setting its target to _blank. What I need is to call a button event which is placed inside Default1.aspx as soon as Default2 is closed (i.e. as soon as the new window showing default2 is closed).</p> <p>Although, I know that this can be accomplished by showing the default2 into a modal popup i.e. show the default2 into a modal dialog and after that call the button event using javascript. But due to some reasons i am not permitted to do that.</p> <p>Could some one please show me how i could do that.</p>
asp.net javascript
[9, 3]
5,592,472
5,592,473
Why not able to use an int in javascript?
<p>The following code throws a javascript syntax error : </p> <blockquote> <p>Uncaught SyntaxError: Unexpected identifier</p> </blockquote> <pre><code>var num1 = 1; int num2 = 2; int total1 = num1 + num2; console.log('total1 is '+total1); </code></pre> <p>Why is this error thrown ? Can I not use ints in javascript ?</p>
javascript jquery
[3, 5]
1,833,968
1,833,969
Efficient Use of the ASP.NET RegisterStartupScript method
<p>When I load data in my code-behind, I find that often I want to run several javascript functions based on my data. It it more efficient to use a StringBuilder to compile all of my function calls and issue RegisterStartupScript one time, or is performance the same if I issue RegisterStartupScript everytime I need it?</p>
asp.net javascript
[9, 3]
2,616,506
2,616,507
increment variable according to numbers of clicks
<p>I have following code:</p> <p>javascript:</p> <pre><code>var counter = 0; var totalItems = 8; var restItems = $num-totalItems; if (restItems==22) { $('#next').click(function(e) { e.preventDefault(); counter++; updatestatus(); }); } function updatestatus() { totalItems = totalItems + 8 * counter; } </code></pre> <p>HTML:</p> <pre><code>&lt;input type = "button" id="next" value="click me"&gt; </code></pre> <p>what I want is that before I click the button, the totoalItems is equal to 8, and each time when I click it, the totoal item is added by 8, but at the moment that bit of code dosen't work and give me a very large number, any one could help me figure it out, thanks a lot.</p>
javascript jquery
[3, 5]
2,128,082
2,128,083
Selecting HttpHandler from custom HttpModule
<p>I have an HttpModule and I'd like to choose the HttpHandler for the current request, is that possible? Also <code>web.config</code> is not an option because the condition is not based on path or extension. My googling skills have failed me, no matter what keywords I use all the results are "IHttpHandler vs IHttpModule".</p>
c# asp.net
[0, 9]
765,019
765,020
Calling FormsAuthentication.SignOut() method using jquery
<p>I am using <code>Asp.Net/C#</code> in my project.I am using <code>Forms Authentication</code>.Currently I call <code>FormsAuthentication.SignOut()</code> on click of Asp.Net button.It works well , but my requirement is that I need to log out a user from horizontal menu option </p> <blockquote> <p>Logout</p> </blockquote> <p>That would be Html menu , so how do I call <code>FormsAuthentication.SignOut()</code> method when a user clicks Logout from the menu bar.Is there any solution possible or any other technique. Any suggestions are welcome. Thanks</p>
c# asp.net
[0, 9]
1,132,578
1,132,579
Sort order discrepancy in javascript key value objects
<p>I've set up a jsFiddle example of my problem: <a href="http://jsfiddle.net/3s6Qf/1/" rel="nofollow">Example</a></p> <p>Given this html:</p> <pre><code>&lt;select id="drop1" data-jsdrop-data="countries"&gt;&lt;/select&gt; &lt;select id="drop2" data-jsdrop-data="countries2"&gt;&lt;/select&gt;​ </code></pre> <p>And the following javascript:</p> <pre><code>var countries = {"1" : "Albania", "5" : "Australia","2": "United Arab Emerates"}; var countries2 = {"AL" : "Albania", "AU" : "Australia", "AE" : "United Arab Emerates"}; function loadJSOptions(selector, list) { $.each(list, function (key, value) { $(selector).append($("&lt;option&gt;&lt;/option&gt;").val(key).html(value)); } }); $(document).ready(function() { $('select[data-jsdrop-data]').each(function() { var selector = $(this); var listname = selector.attr("data-jsdrop-data"); var listvalue = null; eval("listvalue = " + listname + ";"); loadJSOptions(selector, listvalue); }); }); </code></pre> <p>​ Can anyone explain to me why the list with the Alpha key gets listed based on the order entered while the list with the numeric key gets sorted based on the key? If you look at the jsFiddle results, you'll see that drop1 shows Albania, United Arab Emerates, Australia while drop2 shows Albania, Australia, United Arab Emerates.</p> <p>Thanks for your help.</p>
javascript jquery
[3, 5]
2,533,947
2,533,948
jQuery(document).ready() does not fire
<p>Does anyone know why jQuery document ready might not fire on a website? I put exactly this script in footer and it simply doesn't fire (jQuery 1.8 is included in head section):</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(document).ready(function() { alert('test'); jQuery("#slideshow iframe").each(function(){ alert('test'); }); }); &lt;/script&gt; </code></pre> <p>There are no Javascript errors, console is empty and when I run this in Firebug's console it works:</p> <pre><code>jQuery("#slideshow iframe").each(function(){ alert('test'); }); </code></pre>
javascript jquery
[3, 5]
2,415,202
2,415,203
Does the browser "cache" javascript code?
<p>I was fine tuning a page that is heavy on jquery and stumbled across this website:</p> <p><a href="http://www.componenthouse.com/extra/jquery-analysis.html" rel="nofollow">http://www.componenthouse.com/extra/jquery-analysis.html</a></p> <p>When I click on the "Run Test" button the first time, the numbers are way higher than subsequent clicks. Is this because JS is cached by the browser? Can someone explain how this works internally? Can a user choose to not cache the JS?</p>
javascript jquery
[3, 5]
1,904,568
1,904,569
Delete image from Folder/Database using RowCommand/RowDeleting events
<p>I am uploading images and display them in a <code>Gridview</code>.I save the images in a folder and the name in the database.Now I want if I uploaded 3 pictures and have to delete one which I select.So I have picture 1 2 3. When I select picture 2 than this will be deleted..How can I do that? This is my code to upload my pictures:</p> <pre><code>string filename = Path.GetFileName(fileuploadimages.PostedFile.FileName); fileuploadimages.SaveAs(Server.MapPath("Images/" + filename)); SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["baza_chestionar"].ToString()); con.Open(); SqlCommand cmd = new SqlCommand("Insert into Images(ImageName,ImagePath) values(@ImageName,@ImagePath)", con); cmd.Parameters.AddWithValue("@ImageName", filename); cmd.Parameters.AddWithValue("@ImagePath", "Images/" + filename); cmd.ExecuteNonQuery(); con.Close(); Response.Redirect("~/upload.aspx"); </code></pre>
c# asp.net
[0, 9]
577,524
577,525
jquery if mouseover
<p>I have a img with a hover function to reveal an element. Some of this new element overlaps the img so if I then hover over the new element, because the cursor is no longer over the img, the element hides itself and then instantly reappears because the cursor is over the img again. I need to somehow ignore the mouseout command if the cursor is over the img which is within the new element (the only part of the new element which is overlapping the main image).</p> <p>It's a tricky one to explain but here's the code: </p> <p>jquery (with bit i'm not sure how to do)</p> <pre><code>$("div &gt; img").hover( function() { $(this).parent().find("span").slideDown(100); }, function() { if (user is hovering over the span) { // do nothing } else { $(this).parent().find("span").slideUp(100); } }); </code></pre> <p>html</p> <pre><code>&lt;div&gt; &lt;img src="/images/icons/dm.jpg" width="54" height="54" /&gt; &lt;span&gt;&lt;strong&gt;Test&lt;/strong&gt;&lt;br /&gt;test2&lt;img src="/images/arrow.png" width="19" height="17" /&gt;&lt;/span&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
254,528
254,529
Change the position of div on page refresh using jquery
<p>I have 3 <code>div</code>'s, by default I'm showing <code>1 2 3</code>. On each refresh the div position has to change like:</p> <ul> <li>1-2-3</li> <li>2-3-1</li> <li>3-1-2</li> <li>...</li> </ul>
javascript jquery
[3, 5]
2,500,595
2,500,596
Call jquery from php
<p>I have a form with Name : input and a submit. When pressed, it posts to the same php file. My first check is basically <code>if(!$name) { call jquery to insert error class }</code>. I have the jquery set up in a function but I'm not sure how to call the function from the if statement.</p>
php jquery
[2, 5]
3,568,581
3,568,582
How to use jQuery to make a call to c# webservice to get return value
<p>I want to use jQuery to make a call to a c# web service called c.ashx which checks whether that username is valid and returns an error message as a string.</p> <p>What should I put for data: and content type: if the return value of the c# webservice is a string value?</p> <pre><code> jQuery.ajax({ type: "GET", url: "/services/CheckUserName.ashx", data: "", contenttype: "", success: function (msg) { alert("success"); }, error: function (msg, text) { alert(text); } }); </code></pre>
c# jquery
[0, 5]
2,929,503
2,929,504
Match method doesnt work in a user function
<p>I have this function:</p> <pre><code>function checkMobile(){ return $('#js-mobile').val().trim().match(/^09[0-9]{9}$/); } </code></pre> <p>And this in-line code:</p> <pre><code> $('#js-mobile').val().trim().match(/^09[0-9]{9}$/); </code></pre> <p>I dont know why this code doesnt work in my function but work without function!</p> <p>See the Attachment</p> <p><img src="http://i.stack.imgur.com/ER8yW.png" alt="firefox - firebug console"></p>
javascript jquery
[3, 5]
891,214
891,215
How to convert this milliseconds into time (hh:mm a)?
<p>I have milliseconds like "1325085788" i want to convert it on hh:mm a . i know this but return me time 01:34 PM instead of 08:53 PM.Whats problem ? </p> <p>My code is :: </p> <pre><code>String created_on = "1325085788"; String pattern = "hh:mm a"; SimpleDateFormat dateFormat = new SimpleDateFormat(pattern); Date date = new Date(Long.parseLong(created_on)); String yourFormatedDate = dateFormat.format(date); System.out.println("--------&gt; " + yourFormatedDate); </code></pre> <p><strong>no timezone issue because it give me current time (in india) in iphone app</strong></p>
java android
[1, 4]
5,285,057
5,285,058
python convert str to javascript literal string
<p>I want to use python to generate javascript code dynamiclly. </p> <pre><code>def convert(jsstring=''): return 'function dosomething () { return %s.toLowerCase(); }' % jsstring </code></pre> <p>The problem is <code>jsstring</code> is a python string.</p> <p>How can i convert it back to javascript string literal to make <code>dosomething</code> a valid javascript function ?</p> <p>for example</p> <p>call</p> <pre><code>convert("javascript") </code></pre> <p>now output</p> <pre><code> function dosomething () { return javascript.toLowerCase(); } </code></pre> <p>which is not a valid javascript function</p> <p>expected output</p> <pre><code> function dosomething () { return "javascript".toLowerCase(); } </code></pre> <p>another example, call</p> <pre><code>convert("javascript\'") </code></pre> <p>expected output</p> <pre><code> function dosomething () { return "javascript\'".toLowerCase(); } </code></pre> <p>Thanks a lot.</p>
javascript python
[3, 7]
2,169,926
2,169,927
Styles missing in StreamWriter
<p>I see that when I use <code>StreamWriter</code> to write html to excel file, it is missing some styles like background color. Is it possible to get styles using <code>StreamWriter</code>? If Not, Can I use any other <code>StreamWriter</code>?</p> <pre><code>StringWriter _writer = new StringWriter(); HttpContext.Current.Server.Execute("VAMReport.aspx", _writer); String html = _writer.ToString(); fullpath = directoryPath + @"\" + fileName; StreamWriter SW; SW = File.CreateText(fullpath); SW.WriteLine(html.ToString()); SW.Close(); </code></pre>
c# asp.net
[0, 9]
4,565,632
4,565,633
Organizing script files
<p>I usually have jQuery code that is page specific along with a handful of functions that many pages share. One approach is to make seperate files for organizing, but i'm thinking that putting all the script in one file and making comments in the file for readability would also work. Then when the site goes live I can minify and obfuscate if needed.</p> <p>I think the question comes down to limiting http requests or limiting file size. Is one of these a bad habit?</p>
javascript jquery
[3, 5]
5,966,641
5,966,642
[PHP/JavaScript]: Get PHP session value in other file's JavaScript function
<p>I have a PHP file and it holds a value in this session variable: $_SESSION['image_value'].</p> <p>I want this session value in a JavaScript function. Actually, I want to match a string in my JavaScript function with this session value.</p> <p>Anyway I can do this?</p>
php javascript
[2, 3]
4,632,179
4,632,180
get id of a hyperlink inside datalist using javascript
<p>i have a datalist and inside it there is a dropdown list and hyperlink which is loaded dynamically,means if there is one user then there will be one dropdown and one hyperlink and there are two users then there will be two dropdown and two hyperlink.My requirement is when an onchange event occurs in a dropdown i want the id of the hyperlink assosiated with that dropdown in javascript.Can any one help me please.</p> <p>thanks </p>
javascript jquery asp.net
[3, 5, 9]
4,982,668
4,982,669
How to select elements within a variable using jQuery?
<p>Hey, I'm trying to make a simple image browser for TinyMCE which I am using in my CMS. As part of this I need to detect whether the user has selected an existing image, so I can display the "edit" form instead of the "choose an image form".</p> <pre><code>var selected_html = ed.selection.getContent(); var $elem = $(selected_html); console.log($elem); </code></pre> <p>The first function returns the user selected text from the editor window as a string of HTML. I then would like to use jQuery (although plain javascript is just ok too) to check if this string contains an img tag before subsequently grabbing the src and title attributes for editing.</p> <p>Now I've got as far as getting the html to turn into an object. But after this I can't manage to search it for the img element. After reading this (http://stackoverflow.com/questions/2352072/how-to-manipulate-html-within-a-jquery-variable) I tried:</p> <pre><code>$elem.find('img'); </code></pre> <p>But it just comes out as an "undefined" object...</p> <p>I think I'm missing something fairly obvious here (it is getting late), but after an hour I still can't figure out how to grab the img tag from the selection. :(</p> <p>Many thanks in advance.</p>
javascript jquery
[3, 5]
324,982
324,983
Android .setmesage with subscript or superscript text
<p>How does one display subscripts or superscripts in .setmessage?</p> <pre><code> show = new AlertDialog.Builder(mContext) .setTitle("Error") .setMessage( "Please enter a value for P&lt;sub&gt;&lt;small&gt;1&lt;/small&gt;&lt;/sub&gt;.") .setPositiveButton("OK", null).show(); </code></pre>
java android
[1, 4]
2,632,509
2,632,510
Alternative to .change in jquery?
<p>I'm trying to fire an ajax event, and passing the value of select list options as arguments in the ajax call. Unfortunately, I'm firing the call on the .change event, and it is passing the values of the select option before the new option has been selected (i.e passing the previously selected options values). Is there an event which will get the current values of the option selected? Much thanks in advance,</p> <pre><code>&lt;select id='theList'&gt; &lt;option&gt; Option 1&lt;/option&gt; &lt;option&gt; Option 2&lt;/option&gt; &lt;/select&gt; </code></pre> <p>In the JS:</p> <pre><code>$('#theList').change( function() { $.getJSON('Home/MethodName', { var1: Option1Value, var2: MiscValue}, function(data) { //Execute instructions here } )}); </code></pre> <p>I wanted to use .trigger, but I think that fires beforehand as well. </p>
javascript jquery
[3, 5]
3,148,097
3,148,098
JQuery: .index() returns -1
<p>Here's main part of html:</p> <pre><code> &lt;div id="table"&gt; &lt;div class="table_item"&gt;asd&lt;/div&gt; &lt;div class="table_item"&gt;asd&lt;/div&gt; &lt;div class="table_item"&gt;asd&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And JS (JQuery): </p> <pre><code>$(document).ready( function() { $(".table_item").click( function() { alert($("#table").index($(this))); }); }); </code></pre> <p>click handling works but I ALWAYS get -1 from .index.</p> <p>trying simply <code>$(this).index();</code> shows the same result. </p> <p>Please help! What's wrong with the code?</p>
javascript jquery
[3, 5]
3,197,908
3,197,909
export data grid view into excel in asp dot net
<p>export data grid view to excel code is run and all data export into excel sheet but i want to only selected column in excel sheet how to solve this problem </p> <pre><code> protected void btnexcel_Click1(object sender, EventArgs e) { Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=ActualsAndBudgets.xls"); Response.Charset = ""; Response.ContentType = "application/ms-excel"; Response.Cache.SetCacheability(HttpCacheability.NoCache); StringWriter sw = new StringWriter(); HtmlTextWriter htw = new HtmlTextWriter(sw); gvdetails.AllowPaging = false; fillgrid(); gvdetails.RenderControl(htw); Response.Write(sw.ToString()); Response.End(); gvdetails.AllowPaging = true; fillgrid(); } public override void VerifyRenderingInServerForm(Control control) { } </code></pre>
c# asp.net
[0, 9]
1,310,085
1,310,086
Android layout folder configuration
<p>I currently have 2 layout folders: layout-sw480dp and layout-sw720dp, both containing main.xml</p> <p>I see that dev guide states the following:</p> <pre><code> - 320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc). - 480dp: a tweener tablet like the Streak (480x800 mdpi). - 600dp: a 7” tablet (600x1024 mdpi). - 720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc). </code></pre> <p>I'm developing using my Nexus 7 (emulator is a bit sucky/slow), when I upload my app to my tablet, I can tell it uses layout-sw480dp, but why? Ok it's not a 10" tablet but the Nexus 7 does have 800x1280 res, which I guess is irrelevant? I'm just a little confused as to which swdp to have.</p> <p>According to GSMArena: <a href="http://www.gsmarena.com/asus_google_nexus_7-4850.php" rel="nofollow">http://www.gsmarena.com/asus_google_nexus_7-4850.php</a></p> <pre><code> - 800 x 1280 pixels, 7.0 inches (~216 ppi pixel density) </code></pre>
java android
[1, 4]
5,509,080
5,509,081
Processmaker getField javascript error
<p>I have a problem when creating a process maker dynaform in which in task 1, a form uploads a document, in form 2 i want a link to that document to be able to download it (this is for testing purposes for the company I work for).</p> <p>My problem is that following the documentation on the process maker website <a href="http://wiki.processmaker.com/index.php/Input_Documents#Links_to_Input_Documents_in_DynaForms" rel="nofollow">Links to input Documents in Dnyaforms</a> it doesn't work.</p> <p>Enabling debug mode on the trigger, the URL is coming out fine, all ID's being referenced are fine, the only problem I can find is the getField function is returning null, where it should be returning an object where I can call its .value property.</p> <p>Has anyone had this issue before? or am I just doing something stupid?</p> <p>Trigger code:</p> <pre><code>$caseId = @@APPLICATION; $query = "SELECT C.CON_ID, C.CON_VALUE FROM APP_DOCUMENT AD, CONTENT C WHERE AD.APP_UID='$caseId' AND AD.APP_DOC_TYPE='INPUT' AND AD.APP_DOC_STATUS='ACTIVE' AND AD.APP_DOC_UID=C.CON_ID AND C.CON_CATEGORY='APP_DOC_FILENAME' AND C.CON_VALUE&lt;&gt;''"; $result = executeQuery($query); if (is_array($result) and count($result) &gt; 0) { $caseDocId = $result[1]['CON_ID']; @@inputFileURL = 'http://' . $_SERVER['HTTP_HOST'] . '/sys' . @@SYS_SYS . '/' . @@SYS_LANG . '/' . @@SYS_SKIN . '/cases/cases_ShowDocument?a=' . $caseDocId; @@inputFilename = $result[1]['CON_VALUE']; } </code></pre> <p>Javascript code:</p> <pre><code>window.onload = function() { getField("lnkTimesheet").href = getField("inputFileURL").value; }; </code></pre>
php javascript
[2, 3]
2,417,488
2,417,489
How to give image path in js/Jquery if image file exist in a different drive?
<p>My application is working in locale. I want to display one image using jquery. Image is located in one virtual drive created in my locale machine.</p> <p>This is the path I given</p> <pre><code>var str='&lt;div&gt;'; str='&lt;img src="'+virtualDriveName+':/test_folder/data/images/'+file_name+'.jpeg" height="100" width="100" &gt;'; str+='&lt;/div&gt;'; $(".ImageHolderDiv",$("#"+uniqueId)).append(str); </code></pre> <p>But its not displaying now. How to give image path if the needed image file exist in a different drive.</p> <p>Eg:- My application running from C:drive. My image files are in F: drive. How can I display those images in my application?</p>
javascript jquery
[3, 5]
5,281,567
5,281,568
Dynamic select box options cut off in IE
<p>In the select box options cutoff in IE browser. For rectifying this i used the following code.</p> <pre><code>(function($) { $.fn._ie_select=function() { return $(this).each(function() { var a = $(this), p = a.parent(); p.css('position','relative'); var o = a.position(), h = a.outerHeight(), l = o.left, t = o.top; var c = a.clone(true); $.data(c,'element',a); c.css({ zIndex : 100, height : h, top : t, left : l, position : 'absolute', width : 'auto', opacity : 0 }).attr({ id : this.id + '-clone', name : this.name + '-clone' }).change(function() { $.data(c,'element') .val($(this).val()) .trigger('change') }); a.before(c).click(function() { c.trigger('click'); }); }); // END RETURN }; // END PLUGIN if ($.browser.msie) { $('select')._ie_select(); } })(jQuery); </code></pre> <p>(Also found at <a href="http://pastebin.com/WqbtNxJu" rel="nofollow">http://pastebin.com/WqbtNxJu</a>)</p> <p>It works fine. If i create the select box dynamically (Add More Select box in onclick event). It doesn't work. Please do the need ful Thanks.</p>
php javascript jquery
[2, 3, 5]
3,585,712
3,585,713
Attach function to dynamically created DOM element
<p><strong>Goal:</strong></p> <p>Append a DOM element with functionality. (One global listener is not desire here.)</p> <p><strong>Problem:</strong></p> <p>I don't know how to reference the new element in this context. The problem area is the <code>.on</code> event listener and the references to <code>$(this)</code> contained inside. Also, the ability for the function <code>get_value()</code> to call itself again from within.</p> <p><strong>Relevant Code:</strong></p> <pre><code>var dom_element = (function() { // [...] var create = function create( data ) { // [...] return $('&lt;div /&gt;', { 'class': 'element', id: data.i_id }) // [...] .on('load', function get_value() { // [...] $(this).find('.value').text(s_value); // [...] setTimeout('get_value()', 5000); }()); }, // [...] return { create: create }; }()); </code></pre>
javascript jquery
[3, 5]
792,603
792,604
jQuery: Selecting option elements by their value
<p>I'd like to remove a specific option from some select boxes (all with the same values) if their value is "1". The problem is, I'm having difficulty filtering elements down to that specific value.</p> <p>At the moment, the closest I've got is</p> <pre><code>$('.demoClass').find('option:contains(1)').remove(); </code></pre> <p>but there are two problems. Firstly, this seems to iterate over the (displayed) contents of the option, not its value...and secondly, it seems to return true the contents <em>contain</em> that value, as opposed to <em>being</em> that value. (Eg contains(1) will return true for (1, 10, 11, 12)...when I want it to return true for "1" only)</p> <p>In short, what I'm looking to do is find the timeslot option with value X inside <em>all</em> select boxes of class ".demoClass" and remove them. Any suggestions appreciated.</p>
javascript jquery
[3, 5]
3,885,003
3,885,004
how to pass xml document as a string to a asp.net webservice
<p>Hi i have the xml document in my asp.net web application . I want to assign the xml document to a string and pass that string to a asp.net webservice. Can anyone able to help me to do this ? Thank you </p>
c# asp.net
[0, 9]
967,626
967,627
Delay slideDown()/slideUp() - jquery dropdown
<p>I am creating I am creating a drop down which I want to delay about 250 ms so that it's not triggered when someone quickly scrolls across the button.</p> <p>Here's my current code. I tried using the delay() method but it's not going well.</p> <pre><code>$(".deltaDrop").hover(function(){ $('.deltaDrop ul').stop(false,true).slideDown(250); $('.delta').css('background-position','-61px -70px'); },function(){ $('.deltaDrop ul').stop(false,true).slideUp(450); $('.delta').css('background-position','-61px 0'); }); </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
1,056,690
1,056,691
How to change background color of editText?
<p>I need to change background color of <code>EditText</code> if it is empty. Below is my code but doesn't seem to be working.</p> <pre><code>public void onClick(View v) { // TODO Auto-generated method stub Change(); } public void Change() { if(("").equals(name)) { name.setBackgroundColor(Color.RED); return; } } </code></pre>
java android
[1, 4]
4,068,705
4,068,706
How can I hide or show a div based on if there is content in two textboxes using jQuery?
<p>I have 2 textboxes on a page and they both have the class "OrderEntry".</p> <p>I want it so if there is any text in either of of these textboxes, it will show the div with ID "OrderPanel". If the textboxes are cleared, backspaced or empty, it will hide the div "OrderPanel".</p> <p>So, the page loads, "OrderPanel" is hidden and both "OrderEntry" textboxes are empty. A user types a single character into either one of the textboxes and the "OrderPanel" is shown. If BOTH of the "OrderEntry" textboxes are empty, then the div is hidden.</p> <p>I tried subscribing to the $(".OrderEntry").keydown() event but it seemed to apply both independently. Which means it would still show hide if one was empty and not based on both?</p> <p>Any clues on how to do this in jQuery?</p>
javascript jquery
[3, 5]
4,804,246
4,804,247
how to track http packets on android in java
<p>I wish to track all http packets going out and comming in to the device from a service is that possible ?</p> <p>Thanks Vishal</p>
java android
[1, 4]
3,770,931
3,770,932
Jquery addClass when checkbox is checked
<p>I want to add a class when the checkbox is checked on the div element it belongs..</p> <p>This is the link to my current code: [http://jsfiddle.net/WH6bz/2/]</p> <p>What seems to be the problem?</p>
javascript jquery
[3, 5]
2,439,581
2,439,582
Pass form variables on to second postback...asp.net
<p>Is it possible to postback to the server, perform a function, and then continue that postback on to an external place? (ie, to a payment system)</p> <p>(the scenario is clicking a button to place an order, mark it as sent, then send them off to the payment page (there are form variables that needs to be sent to the payment screen as well))</p>
c# asp.net
[0, 9]
2,289,265
2,289,266
Calling ServerSide Method using Jquery in .Net1.1
<p>I am using .net1.1 and trying to call a server side method using Jquery on click of browser Close button.My code is not working.I am posting my code below.Will anybody Guide me where did i go wrong?</p> <pre><code>&lt;body MS_POSITIONING="GridLayout" onbeforeunload="javascript:return test()" &gt; Ceci est une page cachée. Elle est utilisée pour la gestion du multi-fenétrage. &lt;/body&gt; function test() { debugger; $(document).ready(function() { $.ajax({ type: "POST", url: "HiddenPage.aspx/GetServerTime", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert("success"); }, error: function(msg) { alert("Error! Try again..."); } }); return false; }) } </code></pre> <p>In Code behind</p> <p>==================</p> <pre><code>[WebMethod()] public DateTime GetServerTime() { return DateTime.Now; } </code></pre> <p>}</p> <p>The control does not go to this web method,I am not able to debug,COntrol goes to ' $(document).ready(function() ' after that whole block runs.It is not showing any type of error,but alerts are not showing.If I use any other return type instead of DateTime,It is still not working</p> <p>**When I am Calling this method test on onload,It is showing alert of error Conditon.But I have to call it when broswer is closed.In any Case it is not going to web method.</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
1,753,374
1,753,375
Java DataInputStream methods in C# BinaryReader
<ol> <li>what is the java DataInputStream readFully method equivalent in C# BinaryReader?</li> <li>What is the java DataInputStream mark and reset methods equivalent in C# BinaryReader or Stream?</li> </ol>
c# java
[0, 1]
2,579,946
2,579,947
page.ResolveUrl is not working in javascript
<p>in jquery code i used ResolveUrl("~/DynamicMenu.ashx") but when i am showing value of variable where i store the result then i am getting this "ResolveUrl("~/DynamicMenu.ashx")"</p> <p>here is bit of code</p> <pre><code> pageIndex = pageIndex + 1; var CountryCode = getCookie("SetCountry"); var urlToHandler = '&lt;%= ResolveUrl("~/DynamicMenu.ashx") %&gt;'; urlToHandler = urlToHandler + CountryCode + "&amp;PageIndex=" + pageIndex; alert(urlToHandler); </code></pre> <p>what is wrong in my code for <strong>ResolveUrl()</strong> please help me to get the error and fix. thanks</p>
javascript jquery asp.net
[3, 5, 9]
1,040,799
1,040,800
Should I use byte or int?
<p>I recall having read somewhere that it is better (in terms of performance) to use Int32, even if you only require Byte. It applies (supposedly) only to cases where you do not care about the storage. Is this valid?</p> <p>For example, I need a variable that will hold a day of week. Do I</p> <pre><code>int dayOfWeek; </code></pre> <p>or</p> <pre><code>byte dayOfWeek; </code></pre> <p><strong>EDIT</strong>: Guys, I am aware of DayOfWeek enum. The question is about something else.</p>
c# asp.net
[0, 9]
1,617,916
1,617,917
Filter more than one list 'by more than one item' & display results
<p>I am trying to create a list filter that covers more than 1 list and filters for 'multiple words'. Example: there will 4 lists containing similar &amp; different items and the user should be able to type word(s) and only the lists containing that word would be displayed.</p> <p>Originally I was thinking of separating the multiple words by a comma, but it might not very user friendly. </p> <p>I have seen some sites where you can use incorporate 'predictive search' where the words from the list show up under the search box as they type it in and the user can select it by clicking and/or arrow+enter. Once selected, it stays in the search box within its own little box background with a small x on it so that people can delete it from the search field without resetting the entire search. </p> <p>I think I can figure out the predictive text part too, but don't even know what to do to be able to filter by multiples words(entries) and have no clue how to hold that search in that box ..</p> <p>(website development .. is one of the hats I wear ..so, I don't know a whole lot about JS/Jquery etc)</p> <p>Would appreciate it if you guys can help me ... or at the least, give me some inputs ... Thx. </p> <p>I saved what I have so far at jsfiddle.net/BVGYv </p>
javascript jquery
[3, 5]
5,674,283
5,674,284
The type is deprecated
<p>I am using an AbsoluteLayout for a Activity and have it defined in a xml file.</p> <p>I added this line of code because I am trying to add a list of buttons dynamically and I get the following warning.</p> <pre><code>private AbsoluteLayout layout = (AbsoluteLayout) findViewById(R.id.viewsaved); The type AbsoluteLayout is deprecated </code></pre> <p>The code still appears to work properly, but I was just curious to see if anyone knows why this warning appears?</p> <p>Thanks for any help!</p>
java android
[1, 4]