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,878,203
1,878,204
How to add a class in a div somewhere else in the DOM with jQuery?
<p>How can add class <code>.jokjok</code> in the <code>div</code> next of <code>input[bdate]</code>?</p> <p><strong>Example:</strong> <a href="http://jsfiddle.net/cLNJE/1/" rel="nofollow">http://jsfiddle.net/cLNJE/1/</a></p> <p>This code did not work for me:</p> <pre><code>&lt;button&gt;Click Me&lt;/button&gt; &lt;div class="pa_row mediumCell"&gt; &lt;div class="column"&gt; &lt;input type="text" name="expass"&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;div class="auto_box2"&gt; &lt;input type="text" name="bdate"&gt; &lt;div&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="column"&gt; &lt;input type="text" name="old"&gt; &lt;/div&gt; &lt;/div&gt; $('button').live("click", function () { $('input[bdate]').closest('.pa_row ').find('auto_box2 div').removeClass().addClass('jokjok'); //alert('click is ok') }); </code></pre>
javascript jquery
[3, 5]
3,231,378
3,231,379
closer browser window.close not working
<p>I would like to close the browser window using javascript on button click this is what I tried</p> <pre><code>&lt;script type="text/javascript"&gt; function OpenMyWin() { window.open('', '_self'); window.close(); } &lt;/script&gt; &lt;asp:Button ID="btn" runat="server" Text="Close" OnClientClick="OpenMyWin();"/&gt; </code></pre> <p>and also I tried the alternate way</p> <p><code>btn.Attributes.Add("onclick", "javascript:window.close();");</code> and</p> <p><code>btn.Attributes.Add("onclick", "javascript:OpenMyWin();");</code></p> <p>I also tried this</p> <p><code>&lt;script type="text/javascript"&gt; function closeWindow() { netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserWrite"); alert("This will close the window"); window.open('', '_self'); window.close(); } &lt;/script&gt;</code></p> <p>Still I am unable to close my browser can some one help me I need the close event which should work on all browsers</p>
javascript asp.net
[3, 9]
5,941,416
5,941,417
Call the same instance of jQuery plugin
<p>I have written a jQuery plugin below and would like to be able to call it again for the same instance on an element.</p> <p>The plugin goes...</p> <pre><code>(function($) { $.fn.myPlugin = function(options){ var settings = { color: null }; if (options) { $.extend(settings, options); } return this.each(function(){ var self = this; var pics = $('li', self); function refresh() { pics = $('li', self); }; $('a', self).click(function(){ pics.filter(':last').remove(); alert(settings.color); refresh(); return false; }); }); } })(jQuery); </code></pre> <p>In the page this is called...</p> <pre><code>$('#test').myPlugin({ color: 'blue' }); </code></pre> <p>Now I want to call the same plugin for the same instance but pass the string <code>refresh</code> as the option whilst all the other variables are the same (so color would still be <code>blue</code>) e.g...</p> <pre><code>$('#test').myPlugin('refresh'); </code></pre> <p>This would then execute the <code>refresh()</code> function.</p> <p>How could I achieve that with the above?</p> <p><strong>Edit:</strong> To make it clearer I am thinking of how jQuery UI does their plugins. In the <a href="http://jqueryui.com/demos/sortable/" rel="nofollow">sortable</a> plugin you can do <code>$("#sortable").sortable();</code> and then <code>$("#sortable").sortable('refresh');</code> on the same element. This is what I am trying to achieve.</p>
javascript jquery
[3, 5]
1,201,122
1,201,123
Android layout doesn't stretch on full screen
<p>I have a problem with layout which won't stretch within high resolution like 1024x600.</p> <p>As root layout I use RelativeLayout with following style:</p> <pre><code> &lt;style name="DefaultLayout"&gt; &lt;item name="android:layout_width"&gt;fill_parent&lt;/item&gt; &lt;item name="android:layout_height"&gt;fill_parent&lt;/item&gt; &lt;/style&gt; </code></pre> <p>I want to stretch layout to any screen resolution but on emulator with high resolution it looks like this:</p> <p><img src="http://i.stack.imgur.com/2Fm7F.png" alt="alt text"></p> <p>If it's important I didn't use images with fixed size, header and footer it's a 1px vertical line which duplicates horizontally and the list items implemented as shapes... so there is no point where it may took some fixed size... maybe I am checking this in a wrong way... Actually I didn't figured out what is the problem</p>
java android
[1, 4]
5,592,992
5,592,993
Asp.net theme not applied to derived pages
<p>We have an ASP.net 2.0 web application which is using themes set on the application level using web.config. The theme gets applied correctly for any web page that inherits from Page. The problem is that theme doesn't get applied to our base page which is also inherits from Page.</p> <p>Suppose our base page is called MyBasePage : Page.</p> <p>page1.aspx which inheretis from Page: Theme Applied. </p> <p>page2.aspx which inheretis from MyBasePage: Theme not Applied.</p> <p>What makes it even more confusing is that when we try and debug page2.aspx at Page_Load to check the value of this.Theme it is actually set to our theme but without the styles being applied.</p> <p>Any suggestions on how to fix this?</p>
c# asp.net
[0, 9]
3,213,577
3,213,578
How do I figure out what options to use with jQuery's support function?
<p>I was working with the following javascript code(in order to put a calendar-picker in an SSRS page), but I realized it didn't even work because it's deprecated and not supported. They said that the <code>.browser.webkit</code> function should not be used..</p> <pre><code>$(document).ready( function () { if ($.browser.webkit) { $($(":hidden[id*='DatePickers']").val().split(",")) .each(function (i, item) { var h = $("table[id*='ParametersGrid'] span") .filter(function (i) { var v = "[" + $(this).text() + "]"; return (v != null &amp;&amp; v.indexOf(item) &gt;= 0); }) .parent("td").next("td").find("input").datepicker( { showOn: "button", buttonImage: '/Reserved.ReportViewerWebControl.axd?OpType=Resource&amp;Name=Microsoft.Reporting.WebForms.calendar.gif', buttonImageOnly: true, dateFormat: 'dd/mm/yy', changeMonth: true, changeYear: true }); }); } }); </code></pre> <p>So on <a href="http://api.jquery.com/jQuery.support/" rel="nofollow">here</a> they say to use jQuery.support, I have no idea how to do this. Would I put something like this:</p> <pre><code>$.browser.support(ajax) </code></pre>
javascript jquery
[3, 5]
1,816,315
1,816,316
How to calculate the time difference?
<p>How can i do the calculation to get the time difference. I have both the time of the server and the time of the client system in <code>isoDate</code> date format. Here are the output data i have :</p> <p>Server time which is in UTC converted to local sytem timezone time : </p> <p><code>Tue May 22 2012 14:29:51 GMT+0530 (India Standard Time)</code></p> <p>Local System Time : </p> <p><code>Tue May 22 2012 14:31:51 GMT+0530 (India Standard Time)</code></p> <p>I want to do the calculation in such a way that if the local system time is less then or greater then say 5 min (configurable value) ignoring the difference in seconds compared to what the server time is showing want to perform some task else another task. I dont know how to do the calculation because when it is midnight 12:01 am according to the server time then the date, hour and minute changes whereas if the local system is just 4 min behind how to determine the difference is not less then 5 min although the date changed. My main idea is to check everything to match date, time and check the difference. Please help.</p>
javascript jquery
[3, 5]
4,637,187
4,637,188
jQuery Easing Bounce
<p>I am trying to add a bounce effect to my animation but am having trouble doing so. I have been following the <a href="http://api.jquery.com/animate/" rel="nofollow">jQuery API animate() page</a> but I keep failing. I am trying to create an effect where my object slides in from the top and bounces before settling into place.</p> <pre><code>$(this).animate( { "top": "+=100px" }, { duration: '400', specialEasing: { width: 'linear', height: 'easeOutBounce' }, } ); </code></pre>
javascript jquery
[3, 5]
763,053
763,054
Web site does not show ( Says its down) , no user code is called
<p>The site loads app_offline.htm.</p> <p>The application used to load fine, im not sure whats wrong and im looking for a pointer. Its failing to load on the application. This hosted on the development asp.net server</p> <p>To get this call stack i have to enable A first chance exception in System.Web.HttpExecption, here is the "console" output<br></p> <blockquote> <p>A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll<br> A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll<br> Additional information: ASP.NET Initialization Error: <br> A first chance exception of type 'System.Web.HttpException' occurred in System.Web.dll<br> Additional information: ASP.NET Initialization Error: <br></p> </blockquote> <p>The call stack for the first execption.</p> <blockquote> <p>System.Web.dll!System.Web.HttpRuntime.CheckApplicationEnabled() Line 1269C#<br> System.Web.dll!System.Web.HttpRuntime.FirstRequestInit(System.Web.HttpContext context = {System.Web.HttpContext}) Line 579C#<br> System.Web.dll!System.Web.HttpRuntime.EnsureFirstRequestInit(System.Web.HttpContext context) Line 652C#<br> System.Web.dll!System.Web.HttpRuntime.ProcessRequestInternal(System.Web.HttpWorkerRequest wr = {Microsoft.VisualStudio.WebHost.Request}) Line 1582 + 0x9 bytesC#<br> System.Web.dll!System.Web.HttpRuntime.ProcessRequestNoDemand(System.Web.HttpWorkerRequest wr) Line 2270C#<br> System.Web.dll!System.Web.HttpRuntime.ProcessRequest(System.Web.HttpWorkerRequest wr) Line 2256C#<br></p> </blockquote>
c# asp.net
[0, 9]
3,314,600
3,314,601
Handle a link in the Android browser/webview to start directly an application
<p>I want my application to be opened from a link, by following the directions of <a href="http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app/3472228">Make a link in the Android browser start up my app?</a> <br/> Well, it works fine (most of the time.... this is the reason I am asking for help) </p> <p>My html link is</p> <pre><code>&lt;a href="intent:#Intent;action=com.mark.MY_ACTION;end"&gt;Open Application&lt;/a&gt; </code></pre> <p>My intent filter is in the form </p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="com.mark.MY_ACTION"/&gt; &lt;category android:name="android.intent.category.DEFAULT"&gt; &lt;category android:name="android.intent.category.BROWSABLE"&gt; &lt;/intent-filter&gt; </code></pre> <p>so far so good (I hope). It works fine from m-o-s-t of the browsers.</p> <p>To test the above I wrote a demo activity </p> <pre class="lang-js prettyprint-override"><code>final WebView webview = new WebView(this); setContentView(webview); webview.loadUrl("http://www.myhomepage.com/"); </code></pre> <p>The page <a href="http://www.myhomepage.com/" rel="nofollow">http://www.myhomepage.com/</a> has some custom links/hrefs (including the inent one). Pressing regular links opens me a browser with those links, but pressing my "special link" (the intnet one) opens a 404 page<br/> "Web page not available intent:#Intent;action=com.mark.MY_ACTION;end might be temporarily down...." </p> <p>While Diane mentioned in <a href="http://stackoverflow.com/questions/3469908/make-a-link-in-the-android-browser-start-up-my-app/3472228">The above link</a>. "They allow you to direct the launch to only your app without the user having the option of instead going to the browser or any other app."</p>
java android
[1, 4]
3,991,181
3,991,182
Use javascript to change second select list based on first select list option
<p>I have two drop-down lists populated from an array of same dates stored in a database. I want to use javascript or jquery to change the second drop-down list based on the selection from the first list. So an example would be if the user selects 03/03/2012 in the first, start date list, then I'd like the second list to only show or allow future dates within the array. 3/3, 3/2 and 3/1 would either be greyed out or removed and 3/4, 3/5 would remain as selectable options. Can anyone help with the javascript coding or make another recommendation?</p> <pre><code>&lt;select id='start_date' name='data[sDate]' title='Use the drop list'&gt; &lt;option value="" selected="selected"&gt; &lt;/option&gt; &lt;option value="03/05/2012"&gt;03/05/2012&lt;/option&gt; &lt;option value="03/04/2012"&gt;03/04/2012&lt;/option&gt; &lt;option value="03/03/2012"&gt;03/03/2012&lt;/option&gt; &lt;option value="03/02/2012"&gt;03/02/2012&lt;/option&gt; &lt;option value="03/01/2012"&gt;03/01/2012&lt;/option&gt; &lt;/select&gt; &lt;select id='end_date' name='data[eDate]' title='Use the drop list'&gt; &lt;option value="" selected="selected"&gt; &lt;/option&gt; &lt;option value="03/05/2012"&gt;03/05/2012&lt;/option&gt; &lt;option value="03/04/2012"&gt;03/04/2012&lt;/option&gt; &lt;option value="03/03/2012"&gt;03/03/2012&lt;/option&gt; &lt;option value="03/02/2012"&gt;03/02/2012&lt;/option&gt; &lt;option value="03/01/2012"&gt;03/01/2012&lt;/option&gt; &lt;/select&gt; </code></pre>
javascript jquery
[3, 5]
5,667,402
5,667,403
Check whether user is currently online (live)
<p>I've recently finished my application and I've got a huge problem. I need to allow only 1 user to access it at a time. There is an index page accessible for every user everytime and "start" button. When user clicks start, the application locks and other ppl need to wait until the user finishes. When the user closes tab/browser, the application has to unlock automatically. Each user has 5 minutes to use my app. I partially solved my problem, but it still doesn't work properly - on every site I set the jquery script that every 5 seconds triggers "extend.php" file on the server ($.get() function). The php file modifies time.txt file (it changs it to time()+5) and the script on the intex site checks whether (time()>time.txt content). So that when the uses closes tab/browser, the app is accessible. Obviously my app is also based on sessions (when the user closes browser, he loses access). On some computers it simply doesn't work (it seems jquery doesnt trigger extend.php file and it makes my app accessible all the time). So my question is: do you see any other ways to solve my problem?</p> <p>The descr might be messy but I wanted to describe everything strightforward ;)</p> <p>Regards. </p>
php jquery
[2, 5]
2,427,767
2,427,768
jquery escape html tag
<p>Really a simple question. I tried to use jquery to insert html table rows. One of my rows has value with a subscript. So my question is what is the correct way to do this? Below is my broken code:</p> <pre><code>$('&lt;td&gt;&lt;input type="text" size="5" name="a" value="&lt;sub&gt;b&lt;/sub&gt;" id="id_a"/&gt;&lt;/td&gt;').appendTo('.leslie tr:last') </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
1,083,139
1,083,140
Accessing the height of div in javascript
<p>I have a div :</p> <p><strong>css</strong></p> <pre><code> div { width: 200px; height:auto } </code></pre> <p><strong>markup</strong></p> <pre><code> &lt;div contenteditable="true"&gt; Text is editable &lt;/div&gt; </code></pre> <p>Now what should i do to access the <code>height ( numeric value )</code> of the above div in javascript ? I tried </p> <p><code>$('div').height()</code> &amp; <code>$('div').css("height");</code> both returns <code>auto</code>.</p>
javascript jquery
[3, 5]
4,548,216
4,548,217
How Do I Select a `td` Element in a Row That Has a Checkbox That is Checked?
<p>I have a table that looks somethings like this:</p> <pre><code>&lt;table&gt; &lt;tr class="row even"&gt; &lt;td&gt;&lt;input type="checkbox" /&gt;&lt;/td&gt; &lt;td class="name"&gt;foo&lt;/td&gt; &lt;td class="metric"&gt;22&lt;/td&gt; &lt;/tr&gt; ...etc </code></pre> <p>What I want to do is get an array of all <code>td.metric</code> only in rows that have the checkbox checked. This didn't work out as expected:</p> <pre><code>var ticks = $.map($("tr td input:checked td.metric"), function(v,i){ return ... }); </code></pre>
javascript jquery
[3, 5]
894,337
894,338
Javascript function in PHP fromCharCode()
<pre><code>var test = String.fromCharCode(112, 108, 97, 105, 110); document.write(test); // Output: plain </code></pre> <p>Is there any PHP Code to work as <code>String.fromCharCode()</code> of javascript?</p>
php javascript
[2, 3]
4,268,392
4,268,393
Change Action of 'Done' Button on Virtual Keyboard Android
<p>All- I looked at other questions relating to this topic and found out that according to the android development website: "the action key performs a "done" operation, typically meaning the IME will be closed." My question is <strong>how do I edit the action of the done button to make it so it calls one of my methods instead of closing the IME?</strong> Thanks for your time. </p>
java android
[1, 4]
824,113
824,114
ConcurrentModificationException on removing Overlay from MapView's overlayList
<p>I'm trying to search for a custom ItemizedOverlay that contains certain data... I keep getting a ConcurrentModificationException on the for-loop when i'm trying to run through all the overlays of my MapView.</p> <p>I hope somebody knows the answer to this problem...</p> <p>here's the code:</p> <pre><code> @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d("Activityresult", "voor ok"); if(resultCode == RESULT_OK){ GeoPoint point = new GeoPoint(touchedPoint.getLatitudeE6(), touchedPoint.getLongitudeE6()); Car car = data.getExtras().getParcelable("car"); PinpointItem pinpoint = new PinpointItem(point, car, DropHostCarActivity.this); CustomPinpointOverlay custom = new CustomPinpointOverlay(d, DropHostCarActivity.this); custom.insertPinpoint(pinpoint); List&lt;Overlay&gt; mapOverlays = mapView.getOverlays(); if (mapOverlays.size() &gt; 1) { removeSameCar(mapOverlays,car); } overlayList.add(custom); mapView.invalidate(); } } private void removeSameCar(List&lt;Overlay&gt; mapOverlays, Car car) { for(Overlay overlay: mapOverlays){ if(overlay instanceof CustomPinpointOverlay &amp;&amp; ((CustomPinpointOverlay) overlay).getItem(0).getCar().getNumberPlate().equals(car.getNumberPlate())){ overlayList.remove(overlay); } } } </code></pre>
java android
[1, 4]
80,770
80,771
assign data from table to labels using c#
<p>I'm using c# in a ASP.Net web application.I have the following query:</p> <pre><code>SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["chestionar"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("select * from personal,Intrebari where personal.cod_numeric_personal=@cnp AND Intrebari.id_intrebare=14 AND Intrebari.id_intrebare=15 ", con); cmd.Parameters.AddWithValue("@cnp", Session["sesiune_cnp"]); SqlDataReader rdr; rdr = cmd.ExecuteReader(); while (rdr.Read()) { lbl1.Text = rdr["Nume"].ToString(); intrebare6.Text = rdr["Intrebari"].ToString(); intrebare7.Text = rdr["Intrebari"].ToString(); } </code></pre> <p>I want those two values for id_intrebare=14 and 15 to assign it to those 2 labels.How can i refer to those?</p>
c# asp.net
[0, 9]
453,212
453,213
Get selected element type
<p>I want to get the type of element, that I've got selected using jQuery selectors.</p> <p>Markup:</p> <pre><code>&lt;select name="a"&gt;&lt;/select&gt; &lt;input name="b" type="text" /&gt; &lt;textarea name="c"&gt;&lt;/textarea&gt; </code></pre> <p>Javascript:</p> <pre><code>var field_names = new Array( 'a', 'b', 'c' ); for(var i = 0; i &lt; field_names.length; i++) { var field = $('[name=' + required_fields[i] + ']:visible'); // ????? // What do I write here to get one of those outputs: // Element with name a is &lt;select&gt; // Element with name b is &lt;input&gt; // Element with name c is &lt;textarea&gt; alert('Element with name ' + required_fields[i] + ' is ' + element_type); } </code></pre>
javascript jquery
[3, 5]
5,824,693
5,824,694
A very strange for loop bug in Java for Android?
<p>I'm trying to alter the attributes of an array of Buttons, however I am getting some very strange errors. I am trying to loop through the buttons to edit the height attribute of each one, however when I set up a for loop (i=0; i&lt;3; i++), buttonSkater[i].setHeight(buttonHeight); the result seems to be that 9 buttons are being altered! And when I set i&lt;14 (there are 14 buttons), then the application crashes with a NullPointerException. </p> <pre><code>package com.rollerderby.lineuptracker; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.widget.Button; public class Setup extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.setup); Button[] buttonSkater = new Button[14]; buttonSkater[0] = (Button) findViewById(R.id.buttonSkater1); buttonSkater[1] = (Button) findViewById(R.id.buttonSkater2); buttonSkater[2] = (Button) findViewById(R.id.buttonSkater3); int screenHeight = getWindowManager().getDefaultDisplay().getHeight(); int buttonHeight = (screenHeight-60)/14; for(int i=0; i&lt;14; i++) { buttonSkater[i].setHeight(buttonHeight); } } } </code></pre> <p>It seems a very strange error... Am I missing something obvious? </p> <p>(Sizing the array wrong by creating it with space for new Buttons?) </p>
java android
[1, 4]
5,254,201
5,254,202
How to remember changes of html attributes which are changed by jquery
<p>I am using jquery function which changes the class of element</p> <pre><code> $("a").click(function(){ $(this).closest("ul").find("a").parent().removeClass("active"); $(this).parent().addClass("active"); }); </code></pre> <p>but when i refresh page, there are no changes added. How to remember them, even when user refreshes page? Thanks in advance.</p>
javascript jquery
[3, 5]
682,957
682,958
adding rows dynamically using onclick function in javascript
<p>Am having a task in some onclick functions.I had a table in which each column contains a dropdown list or text box. one of the column contains a button.If i click that button the row with dropdownlist,textboxes including add button have to dynamically add as the next row.how can i do this?which will be better javascript or jquery..plz help me out..</p>
javascript jquery
[3, 5]
5,527,253
5,527,254
Upload notification
<p>I am using EFUMultiple Uploader to receive files on my site. Does anyone know of a tutorial that will teach me how I can be notified each time there is a new file or batch of files in my uploads folder?</p>
php javascript
[2, 3]
1,659,035
1,659,036
Adding value to list within list
<p>I have a list that has been populated from a fetchXML query, but unfortunately it is returning a lot of events with duplicate titles. So as a solution i'm hoping to loop through each item in the list and, if the title is the same as the previous item, then I would like to add the values from item.YearId &amp; item.Year to a list of years within the previously looped item.</p> <pre><code> var result = from p in fetchResults.Root.Elements("result")... //etc //Creating another list to contain desired results. List&lt;Event&gt; eventDetails = new List&lt;Event&gt;(); //Create to store the previously looped title. string previousTitle = string.Empty; foreach (var item in result) { if (item.Name == previousTitle) { //Not sure how to add item.yearId and item.Year to a Year //list inside the previously looped. } else { //otherwise add who item to eventDetails list. eventDetails.Add(item); } previousTitle = item.Name; } </code></pre> <p>So, the Event class contains a Year list property that which consists of a guid (item.YearId) and an int (item.Year).</p> <p>Hope that this makes sense. Any examples would be great. Thank you.</p>
c# asp.net
[0, 9]
5,516,560
5,516,561
Inserting a variable into jQuery .css
<p>I have a JavaScript Variable that stores the width of an element ,called popupWidth, in px, e.g. '200px'. The '' are part of the variable, because jQuery needs them. How can I insert the variable into jQuerys .css?</p> <pre><code>$(this).css({ width: + popupWidth, }); </code></pre> <p>The code above doesn't work. </p>
javascript jquery
[3, 5]
1,673,857
1,673,858
Key event doesn't work correctly in Google Chrome
<p>On my web site I have the ability for users to use search by pressing <kbd>Enter</kbd>, having typed a string in the search input field. Here is some jQuery code to illustrate this:</p> <pre><code>$(document).ready(function () { $('#search-input').on('keydown keyup keypress', function (event) { event = event || windows.event; if (event.keyCode == 13 || event.which == 13) { $("#search-button").click(); } }); $("#search-button").click(function () { var theUrl = "/search.aspx?search=" + document.getElementById('search-input').value; window.location = theUrl; }); } </code></pre> <p>On my master page I have the following code:</p> <pre><code>&lt;input id="search-input" name="search" type="text" placeholder="Search..." /&gt; &lt;button id="search-button" type="button"&gt;&lt;/button&gt; </code></pre> <p>Although this works in FireFox and IE9/IE8, it doesn't work in Chrome (except when in debug mode which is surprising). Please help me make it work correctly in all of these browsers.</p>
jquery asp.net
[5, 9]
4,467,156
4,467,157
jQuery ajax POST params with ">" symbol problem
<p>I'm trying to get a textbox value which contains ">" symbol using jQuery ajax with POST method, but I'm not getting the textbox value with ">" symbol. I'm tired of find a solution, please could anyone help me to fix this problem.</p> <pre><code>&lt;div id="subi"&gt;&lt;input type="textbox" id="test"&gt;&lt;button onClick="sub()"&gt;Submit&lt;/button&gt;&lt;/div&gt; &lt;script type="text/javascript" src="js/jquery-1.4.2.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; function sub() { var result = { content : $('#test').val() }; alert(result); $.ajax({ url: 'subi.php', type: 'POST', contentType: "application/x-www-form-urlencoded;charset=UTF-8", data: result, dataType: 'text', success: function(html) { $('#subi').html(html); } }); } &lt;/script&gt; </code></pre>
php jquery
[2, 5]
1,912,440
1,912,441
Getting the offset height of a div using javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/11500253/accessing-the-height-of-div-in-javascript">Accessing the height of div in javascript</a> </p> </blockquote> <p>We're trying to alter <a href="http://www.marghoobsuleman.com/jquery-image-dropdown" rel="nofollow">msdropdown</a> to "drop up" if the menu will go off the frame. In order to figure if that's going to happen we need to check the location of the drop down box relative to the frame that it's in. From there it's easy make the thing open upwards, but the location is troubling us. Getting the element by id doesn't seem to reach through the several frames to the one we're using. Is there an easy way to do this? </p>
javascript jquery
[3, 5]
3,009,481
3,009,482
Detecting a 64-bit jre in a 32-bit browser?
<p>Is there any way to detect a 64-bit java install in a 32-bit environment? The Java Deployment Toolkit detects nothing, but I was wondering if there was some secret browser way of detecting the 64-bit install client-side.</p>
java javascript
[1, 3]
5,459,626
5,459,627
How to trim variables without erring if the var is empty?
<p>I'm using the following for event tracking:</p> <pre><code>var dataTrack = e.split(','); // split by comma if (dataTrack !== undefined) { var action = dataTrack[0]; var values = {}; values[dataTrack[1]] = dataTrack[2]; mpq.track(action, values); } </code></pre> <p>How can I trim dataTrack[0], dataTrack[1], dataTrack[2] in a way where if any of the dataTrack vars are empty it won't break? 1 &amp; 2 are optional...</p> <p>Thanks</p>
javascript jquery
[3, 5]
215,840
215,841
Group multiple or statements within an IF in javascript
<p>The following code works:</p> <pre><code>$(".valClear").each(function () { if ($(this).val().indexOf(".png") == -1) { $(this).val(''); } }); </code></pre> <p>However this doesn't (the value is removed even if it contains .png or .jpeg), what am I doing wrong?</p> <pre><code>$(".valClear").each(function () { if (($(this).val().indexOf(".png") == -1) || ($(this).val().indexOf(".jpeg") == -1)) { $(this).val(''); } }); </code></pre>
javascript jquery
[3, 5]
3,684,682
3,684,683
asp:DropDownList - invalid postback or callback argument when adding options via JavaScript/jQuery
<p>I have two dropdown lists:</p> <pre><code>&lt;asp:DropDownList ID="Field_Type" runat="server" /&gt; &lt;asp:DropDownList ID="Field_SubType" runat="server" /&gt; </code></pre> <p><code>Field_Type</code> is databound, with a list of types, populated from a database. <code>Field_SubType</code> is set via jQuery / AJAX when <code>Field_Type</code> is changed. I then add an option using <code>$("#&lt;%# Field_SubType.ClientID %&gt;").append("&lt;option value=\"1\"&gt;Test&lt;/option&gt;");</code>. This works as expected (I see the new subtype added).</p> <p>However, when posting back after selecting the option that has been added I get an error:</p> <blockquote> <p>Invalid postback or callback argument. Event validation is enabled using in configuration or &lt;%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.</p> </blockquote> <p>What could be the cause of this, and how could I work round it? A few ideas I have:</p> <ol> <li>Use a plain <code>&lt;select&gt;</code> and use <code>Request.Form</code> - could be a problem if it is in a user control used multiple times on a page</li> <li>Populate <code>Field_SubType</code> with all sub types, filtering out those that aren't a sub type of <code>Field_Type</code> - this will load more data than required, which will add to page load time</li> </ol> <p>Any other options?</p>
asp.net javascript jquery
[9, 3, 5]
5,324,954
5,324,955
how to update filed when user type somethin in field
<p>i create a field with this code </p> <pre><code>&lt;tr&gt;&lt;td&gt; &lt;input type="text" value="good" onfocus="if (this.value == 'good') {this.value=''}" onblur="if(this.value == '') { this.value='good'}" name="name" maxlength="254" class="required" /&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre> <p>when user click on field then we have clear and empty field.and if user put field empty we write back this <code>good</code> value.but thats not what i want i am looking for some way like user registration form in facebook then if user type a charachter we clear value and if user keep field empty we will fill in this field with defualt value..can someone help me with this javascript or jquery? thanks in advance</p>
javascript jquery
[3, 5]
47,841
47,842
Check if a DIV exist before running some Javascript
<p>I am having a problem, on a blog I have this javascript code below that is used to get the Position of a DIV id <code>author-info</code>. The problem is this div is only on actual article pages and not on any of the directory pages or the index.</p> <p>So on these pages that do not have the div I get this error</p> <pre><code>Uncaught TypeError: Cannot read property 'top' of null </code></pre> <p>And here is the javascript causing the error</p> <pre><code>var commentsPos = $('#author-info').offset().top - $(window).height(); </code></pre> <p>I know I could do this in the backend to only show that line of JS on the proper pages but I would like to avoid that as this is just 1 line of a much bigger javascript file that is included into the page. </p> <p>What are my options here? Any help please, I assume I need to somehow check to see if this div exist on the page before calling this action?</p>
javascript jquery
[3, 5]
3,399,245
3,399,246
how to read item template field in c#
<p>I have one dropdown box inside the item template. As per of my requirement I need to update the tooltip field of drop down in aspx.cs page.</p> <p>I use the following code:</p> <pre><code>&lt;asp:TemplateField HeaderStyle-CssClass="grid-label-small" HeaderText="*State"&gt; &lt;ItemTemplate&gt; &lt;asp:DropDownList ID="ddlDefState" Width="110px" runat="server" ToolTip="Select State"&gt; &lt;/asp:DropDownList&gt; &lt;/ItemTemplate&gt; &lt;HeaderStyle CssClass="grid-label-small" /&gt; &lt;/asp:TemplateField&gt;`. </code></pre> <p>Thank you...</p>
c# asp.net
[0, 9]
2,015,436
2,015,437
Question regarding execution of JS code
<p>I just encountered with this code:</p> <pre><code>foo = (function() { var div = document.createElement('div'); return function(html) { div.innerHTML = html; var item = div.firstChild; div.removeChild(item); return item; }; })(); </code></pre> <p>and it is being used like this:</p> <pre><code>var element=foo('&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;table&gt;'); </code></pre> <p>I noticed that the above return the JavaScript element with it. I wonder can't it be done only with this -</p> <pre><code>var element=$('&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;table&gt;')[0]; </code></pre> <p>What exactly the original JS function is doing actually? What is the benefit of taking this <em>var div = document.createElement('div');</em> outside the return statement ?</p>
javascript jquery
[3, 5]
4,948,196
4,948,197
detect user response in chat window
<p>i am making an interviewing chatbot using programO (i am new to php) in which i want to display a message if for long time there is no activity on chat window. i hav searched jquery plugins but they are for detecting mouse or keyboard strokes but i am just concerend with detecting that whether the chat window is upadted with a user input or not . i hav also searched javascript settimeout and settimeinterval functions to display a message but i am unable to understand how to use them with chat window form. </p>
php javascript jquery
[2, 3, 5]
6,032,798
6,032,799
Template Control events occurs in second click.Not on First Click
<p>i Don't know what i missing here.</p> <p>i have a gridview in which a template control contains a link button.At link button click i scroll down to bottom of page<code>[Focusing a Panel Control]</code>. See this how i doing the <a href="http://stackoverflow.com/questions/9360706/do-the-scrolling-in-client-brower-window">Scrolling by Javascript</a></p> <p>but it's not occurring on first click .that happens in second click.</p>
c# javascript asp.net
[0, 3, 9]
310,624
310,625
create persistent connection
<p>In my android application I am trying create persistent connection for downloading images. Here is my code </p> <pre><code> public class PersActivity extends Activity { ImageView img; String imageUrl="http://192.168.1.4/JRec/"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button bt3= (Button)findViewById(R.id.download); bt3.setOnClickListener(getImgListener); img = (ImageView)findViewById(R.id.image); } View.OnClickListener getImgListener = new View.OnClickListener() { @Override public void onClick(View view) { for (int i = 0; i&lt;4;i++){ downloadFile(i,imageUrl+"images/"+i+".png"); } } }; Bitmap bmImg; void downloadFile(int i, String fileUrl){ URL myFileUrl =null; try { myFileUrl= new URL(fileUrl); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { System.out.println("Opening connection"); HttpURLConnection conn= (HttpURLConnection)myFileUrl.openConnection(); conn.setRequestProperty("Connection", "keep-alive"); conn.setDoInput(true); conn.connect(); System.out.println("Downloading"+fileUrl); InputStream is = conn.getInputStream(); bmImg = BitmapFactory.decodeStream(is); img.setImageBitmap(bmImg); if (i ==3){ System.out.println("Disconnected"); conn.disconnect(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } </code></pre> <p>When I start download the file every time it should open connection for download, I want to open connection only one time and when the application end downloading all files the connection must be disconnected. Is there any way to do this. </p> <p>Thanks anyone who get attention on this.</p>
java android
[1, 4]
2,853,239
2,853,240
How to split the string in JavaScript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/96428/how-do-i-split-this-string-with-javascript">How do I split this string with JavaScript?</a><br> <a href="http://stackoverflow.com/questions/1493407/how-to-split-a-string-in-javascript">how to split a string in javascript</a> </p> </blockquote> <p>I have a string like this <code>2012-12-05</code></p> <p>How do I get the Date, Month, Year from this string??</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,415,105
2,415,106
On Android, how can i write a code that allow us to click an operating button on the first page get the result of calculation on another next page?
<p>for example: on current page we have 2 Texteditors. We enter numbers to each of the field and then click a operator button to see the result that will be shown on the next page. ^^ help...</p>
java android
[1, 4]
4,824,427
4,824,428
Replace text on page depending on page URL
<p>We are already replacing text with images on the website but have run into a little problem due to the platform we're running on - which is proprietary and provides limited access.</p> <p>Our goal is to replace the price with an image, ONLY for this specific brand and all items within it.</p> <p>It seems that forming some sort of expression to look at the current URL and then if it fits to replace the text with the image.</p> <p>Is this valid thinking and if so how do I go about doing this?</p> <p><a href="http://thmotorsports.com/kw_suspension/kw_variant_3_coilovers/35220011/i-68657.aspx" rel="nofollow">Here is a link to a sample product</a> that is within the brand 'KW Suspension';</p>
java javascript jquery
[1, 3, 5]
3,813,882
3,813,883
How to tell if a page unload in ASP is a PostBack
<p>This seems like a common question but search is not returning anything.</p> <p>I have the following code that executes before the page unloads.The problem is if the unload is a postback i do not want to fire my warning to the user but i can't figure out how to differentiate between a postback and a user navigating to another page for example.</p> <pre><code>// This is executed before the page actually unloads $(window).bind("beforeunload", function () { if (prompt) { //prompt return true; } else { //reset our prompt variable prompt = true; } }) </code></pre> <p>Running script in the code behind i.e. if Page.IsPostBack then set prompt is not an option.</p> <p>Any ideas?</p> <p>EDIT: </p> <p>Here is the solution I ended up with:</p> <pre><code> function DoNotPrompt() { prompt = false; } </code></pre> <p>I then added this to all the controls where the user could do something that result in a post back.</p> <pre><code>OnClientClick="DoNotPrompt() </code></pre> <p>Then checked this flag and only returned a string in "beforeunload" if the user was really moving away from the page i.e. not a postback.</p> <p>I also had to use this code: var magicInput = document.getElementById('__EVENTTARGET');</p> <pre><code> if (magicInput &amp;&amp; magicInput.value) { // the page is being posted back by an ASP control prompt = false; } </code></pre> <p>The reason being i had a custom user control that was a list box and I could not add the above method. So used this to catch that event and set the flag to false.</p> <p>Not the most elegent solution.</p> <p>Thanks, Michael</p>
javascript jquery asp.net
[3, 5, 9]
2,669,066
2,669,067
Jquery find all except
<p>I have following HTML:</p> <pre><code>&lt;div id="123" class="test"&gt; &lt;div class="testMessage"&gt;Foo&lt;/div&gt; &lt;div&gt;&lt;div class="testDate"&gt;2010&lt;/div&gt;&lt;/div&gt; &lt;div id="127" class="test"&gt; &lt;div class="testMessage"&gt;Bar&lt;/div&gt; &lt;div&gt;&lt;div class="testDate"&gt;2011&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>And I have following JS/jQuery code:</p> <pre><code>$(".test").find(".testDate").val("cool 2010"); </code></pre> <p>How to change JS/jQuery to find "testDate" class element except in children "test" class block without using children?</p> <p>P.S. I know only about class name and I don't know how many divs can be nested.</p>
javascript jquery
[3, 5]
1,312,684
1,312,685
How open a local file with the associated program from a web page?
<p>I know the user of my app has a local file named c:\sourcefile.cs, I need to find a way to render a link to that file so that when he clicks the link, it will open the file in Visual Studio.</p> <p>This is for internal use in our dev team so I don't mind using unconventional means to do that if there is no standard way to do it.</p> <p>The solution has to work with Firefox.</p>
javascript jquery
[3, 5]
1,087,786
1,087,787
Trouble with click not unbinding
<p>I'm building a small adventure to help me understand some concepts of JQuery/Javascript and I've hit a snag.</p> <p>What I'm trying to do is by clicking on a "take" button and then on an item on the screen to move it to the inventory. Good news is, that all works. Bad news is that if I press another item without using the "take" button first it goes straight to my inventory.</p> <p>Same problem with "look". You should have to press "look" first and then the item to get a description, but once it's pressed it'll give every item you click a description straight away.</p> <p>You can imagine that once you've pressed them both every item you click without clicking another button will give you a description and end up in your inventory straight away.</p> <p>This is how I'm trying to get it to unbind:</p> <pre><code>$("#take").click(function () { $("#zilverenKogel").click(function () { $("#zilverenKogel").fadeOut(1200, 0); $("#invKogel").fadeTo(1500, 1); $("#take").unbind("click"); </code></pre> <p>Any help will be greatly appreciated!</p> <p>Mofx solved it for me. End, and working result, is:</p> <pre><code> var state = null; $( "#take" ).click(function () {state = "take";}) $( "#look" ).click(function () {state = "look";}) $( "#zilverenKogel" ).click(function () { if (state == "take") { $("#zilverenKogel").fadeOut(1200, 0); $("#invKogel").fadeTo(1500, 1); state=null; } else if (state == "look") { alert("blablabla"); state=null; } }); </code></pre> <p>thanks a lot Mofx!</p>
javascript jquery
[3, 5]
3,554,114
3,554,115
JQuery function call from out of context
<p>A js/css template is provided to me. It is very talented in interactive event handling, but i am not talented on js/jquery.</p> <p>In its js library, there is a .js file, and the file has some code like:</p> <pre><code>(function ($) { ... })(jQuery); </code></pre> <p>most of thing happens in it.</p> <p>There are some "little independent functions" in this upper function.</p> <p>And some lines in this upper/wrapper/non-named function, call these "little-independent functions".</p> <p>Also, i want to call these "little independent functions" BUT i could not find out how.</p> <p>Because in the lines in "<code>(function ($) {...})(jQuery);</code>" those call these "little independent functions" there are some local variables.</p> <p>I think some code help me to tell:</p> <pre><code>(function ($) { if(...){ var items; addItem(items) } function addItem(funcitems){} ... })(jQuery); </code></pre> <p>My question is that, how can i call additem, how can i pass "items" into it?</p> <p>I want to call it in a custom part of my page after a custom event.</p>
javascript jquery
[3, 5]
4,440,773
4,440,774
how to send form data through javascript?
<p>HTML code-</p> <pre><code>&lt;form&gt; .... &lt;a class="art-button" href="edit.php" &gt;Edit&lt;/a&gt; &lt;a class="art-button" href="#" onclick="show_confirm()"&gt;Delete&lt;/a&gt; &lt;/form&gt; </code></pre> <p>JavaScript-</p> <pre><code>&lt;script type="text/javascript"&gt; function show_confirm() { var r=confirm("Do you want to delete?"); if (r==true) { // call "delete.php?id=value" } else { //go back to same page } } </code></pre> <p></p> <p><code>how can I call delete.php?id=value</code> from javascript` </p>
php javascript
[2, 3]
5,513,157
5,513,158
How to bind click events for popups in leaflet marker cluster
<p>Here is my code, I need to bind click event for ticketStatusCol class. </p> <pre><code>var map = new L.Map('map', {center : latlng, zoom : 1, layers : [cloudmade]}); var markers, prevStatus = null, archivedStatus, html = "", marker, title = ""; markers = new L.MarkerClusterGroup(); var html = ""; html += "&lt;div class='ticketStatusCol'&gt;"; html += "&lt;div&gt; Some html codes here &lt;/div&gt;"; html += "&lt;/div&gt;"; marker.bindPopup(html); markers.addLayer(marker); map.addLayer(markers); </code></pre>
javascript jquery
[3, 5]
5,040,807
5,040,808
jQuery .resize() only works when making the window bigger
<p>I'm trying to resize the main content div #inhalt of my website so that it always fills all the space available. Basically I do this by setting a height of <em>total usable height</em> - <em>top position of #inhalt (pixels from top)</em> - <em>padding etc.</em>. This is my javascript/jQuery code:</p> <pre><code>$(document).ready(function(){ $("#inhalt").height($("#zentriert").height() - $("#inhalt").position().top - 48); $(window).resize(function() { $("#inhalt").height($("#zentriert").height() - $("#inhalt").position().top - 48); }); }); </code></pre> <p>This works fine when I resize the window so that it gets bigger. It doesn't, however, when I make it smaller.</p> <p>Does anybody have an idea why and what I could do?</p>
php jquery
[2, 5]
2,234,940
2,234,941
single quote to double quote , and , double quote to single quote in javascript
<p>I want to change </p> <p>every single quote to double quote and every double quote to single quote </p> <p>in jquery or js.</p> <pre><code>var myString = " tes't tes\"t tes\"t te'st "; console.log(myString); for (i = 0; i &lt; myString.length; i++) { console.log(myString[i]); if (myString[i] == "'") { myString[i] == "\""; continue; } if (myString[i] == "\"") { myString[i] == "'"; continue; } } console.log(myString); </code></pre> <p>But my function is not working well. Please correct me.</p>
javascript jquery
[3, 5]
5,390,440
5,390,441
Syntax error, unrecognized expression: , $(selector).before(",");
<p>I've been using this one line of code for a couple of years now with jQuery 1.2.6.</p> <pre><code>$("#acListTemp div.amenitiesDiv label").before(","); </code></pre> <p>I just upgraded to jQuery 1.6.1 and now it is giving me this error:</p> <blockquote> <p>Syntax error, unrecognized expression: ,</p> </blockquote> <p>I also tried this, but it yielded the same error:</p> <pre><code>theChar = ","; $("#acListTemp div.amenitiesDiv label").before(theChar); </code></pre> <p>I checked the jQuery API page for the before command, but I'm still stumped. Any help is greatly appreciated!</p>
javascript jquery
[3, 5]
3,069,706
3,069,707
javascript 'over-clicking' bug
<p>I have a bug in Javascript where I am animating the margin left property of a parent container to show its child divs in a sort of next/previous fashion. Problem is if clicking 'next' at a high frequency the if statement seems to be ignored (i.e. only works if click, wait for animation, then click again) :</p> <pre><code> if (marLeft === (-combinedWidth + (regWidth) + "px")) { //roll margin back to 0 } </code></pre> <p>An example can be seen on jsFiddle - <a href="http://jsfiddle.net/ZQg5V/" rel="nofollow">http://jsfiddle.net/ZQg5V/</a></p> <p>Any help would be appreciated.</p>
javascript jquery
[3, 5]
1,742,381
1,742,382
how do i write a javascript alert box to give a yes or no question and integrate with php calls?
<p>i am trying to figure out how to create a javascript alert box asking the user if they would like to delete a record (that their viewing) and when the user presses yes a query is called through php to delete a database row. and if the user presses no nothing will happend.</p> <p>wondering how this can be done</p> <p>thanks</p> <p>ps:</p> <p>this is what i did and it didnt work.</p> <pre><code>&lt;script type="text/javascript"&gt; if(window.confirm("Are you sure you want to delete that record?")) { &lt;?php mysql_query("delete from tbl_payments where id = '$id'") or die(mysql_error()); header("Location: dashboard.php"); ?&gt; } &lt;/script&gt; </code></pre>
php javascript
[2, 3]
295,564
295,565
Cannot get disable button to work
<p>Hey guys, quick question, I have this javascript/jquery function that basically wraps an input in image brackets, and the first part of the function works, but the button does not disable after and I cannot figure out why (last line does not work). If anyone has an idea, let me know. Thanks in advance.</p> <pre><code>&lt;input id="2image" type="button" value="Attach" onclick="imageid('message')"&gt; &lt;script&gt; function imageid(input) { var obj=document.getElementById(input); obj.value+="[image]image[/image]"; $("#2image").attr({ disabled:true, value:"Inserted" }); } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,156,834
1,156,835
jQuery AutoComplete missing?
<p>I was building something using jQuery's AutoComplete plugin last week, but today I found that it's not working.</p> <p>After some debugging, it seems that the external scripts I've been loading no longer exist:</p> <p><a href="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js" rel="nofollow">http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js</a></p> <p><a href="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js" rel="nofollow">http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js</a></p> <p><a href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js" rel="nofollow">http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js</a></p> <p>Even the demo on the plugin page no longer works:</p> <p><a href="http://docs.jquery.com/Plugins/autocomplete" rel="nofollow">http://docs.jquery.com/Plugins/autocomplete</a></p> <p>Was the plugin deprecated over the weekend and I didn't know it? Or is there some way to let them know that the files aren't showing up?</p>
c# asp.net jquery
[0, 9, 5]
2,943,288
2,943,289
Send Enquiry Mail from ASP.net webpage
<p>I am working with an ASP.Net Application. In this application I have a form named 'Enquiry'. <code>Name,email,phone,feedback</code> etc fields are there in this 'Enquiry' form.</p> <p>Clients use this form to send their enquiries. How can I send these informations to an email id?</p>
c# asp.net
[0, 9]
783,229
783,230
how detect mouse click area in document - jquery - javascript
<p>I have a page with a div element in it. i want when i clicked on outer area of that div element, then fade it out.</p> <p>but i don't know how detect area of mouse click. how detect that mouse click point is out of div area or not?</p>
javascript jquery
[3, 5]
4,947,510
4,947,511
How to call the following function in JQuery
<pre><code>jQuery.fn.daterangepicker = function(settings){ var rangeInput = jQuery(this); //defaults var options = jQuery.extend({ ........ //function to format a date string function fDate(date){ if(!date.getDate()){return '';} var day = date.getDate(); </code></pre> <p>It is being used as follow syntax</p> <pre><code>$('input').daterangepicker( { dateFormat : "M d, yy", </code></pre> <p>May I know how I can call function fDate?</p> <p>I try</p> <pre><code>$('input').fDate(....) </code></pre> <p>but it doesn't work.</p> <p>I get</p> <p>$("input").fDate is not a function</p> <p>The first portion of the code are from date picking library <a href="http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/" rel="nofollow">http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/</a></p>
javascript jquery
[3, 5]
2,652,018
2,652,019
How do I do a jQuery load without a query string and arguments?
<p>I have a dumb network device that has limited HTTP hosting capabilities and I'm trying to write a slightly more dynamic page to display data with. A some current process values can be found in plain-text at <code>/temp.dat</code> on the device, but my stone-simple jQuery script...</p> <pre><code>$(document).ready(function() { $('#temp').load('/temp.dat'); var refreshId = setInterval(function() { $('#temp').load('/temp.dat'); }, 2000); $.ajaxSetup({ cache: false }); }); </code></pre> <p>...seems to endlessly fail (only after the first <code>.load</code> on the initial page load) because the device abhors HTML query parameters. Chrome's JS console shows endless errors like the following:</p> <pre><code>GET http://192.168.1.250/temp.dat?_=1341980712854 </code></pre> <p>How can I get jQuery (or pure JavaScript) to hammer away at a specific URL without attaching the HTML query (...<code>?_=123456789</code>)?</p>
javascript jquery
[3, 5]
1,768,701
1,768,702
Replacing ASP.NET POSTBACK with jQuery form posting
<p>I have a login screen wheren i have 2 text boxes and 2 radio buttons.I have a ASP.NET button too.When the user clicks on the button in my codebehind, in the click even of button ,i have the below lines to check the user login</p> <pre><code> string emailId=txtEmailId.Text.Trim(); string password=txtPassword.Text.Trim(); //Code to Check user is valid... if(isValid) { Response.Redirect("index.aspx"); } else { lblMSg.Text="InValid Login"; } </code></pre> <p>This is the typical ASP.NET procedure.Now i want to avoid the post bak of the page and would like to use jQuery's form posting.Can any one guide me how to do it ? HEre i can read the ASP.NET controls value as "=txtEmailId.Text" . Can i do it in jQuery form posting method.I know i can do this by passing emailid and password as query string.Now I dont want to use query string to do this. Any thoughts ??</p> <p>Thanks in advance</p>
asp.net jquery
[9, 5]
2,315,515
2,315,516
If element contains child elements run function
<p>I have a carousel on my site, and if there are no elements my jquery seems to crash. </p> <p>My HTML output without elements is...</p> <pre><code>&lt;section class="gallery-viewport-twobedroomapartment viewer"&gt; &lt;ul&gt; &lt;/ul&gt; &lt;a id="simplePrevious"&gt;&lt;img alt="Left Arrow" src="_includes/images/larr.png"&gt;&lt;/a&gt; &lt;a id="simpleNext"&gt;&lt;img alt="Right Arrow" src="_includes/images/rarr.png"&gt;&lt;/a&gt; &lt;/section&gt; </code></pre> <p>And my jQuery is...</p> <pre><code>$('.gallery-viewport-twobedroomapartment').carousel('#simplePrevious', '#simpleNext'); </code></pre> <p>Is it possible to say if UL contains LI then run the function? </p>
javascript jquery
[3, 5]
84,964
84,965
Problem in calling Python script from PHP
<p>This is my python script which creates a "test.txt" file when executed. when I execute using terminal (Ubuntu 11.04) <code>root@gml-VirtualBox:/var/www/HMS# python test.py</code>. It creates the "test.txt" in the <code>/var/www/HMS</code> directory as I expected.</p> <pre> test.py: #!/usr/bin/env python def init(): filename = "test.txt" file = open(filename, 'w') file.write("This is the new content of test.txt :-)") file.close() print "done" def main(): init() if __name__ == '__main__': main() </pre> <p>But when I try to call this test.py using PHP, It's not creating the 'test.txt' output file. </p> <pre> index.php: $tmp = exec("python test.py"); echo "temp: $tmp"; </pre> <p>Both <code>test.py</code> &amp; <code>index.php</code> are in the same directory(<code>/var/www/HMS/</code>). But when I modified the <code>test.py</code> like this:</p> <pre> #!/usr/bin/env python def init(): print "done" def main(): init() if __name__ == '__main__': main() </pre> <p>It prints <code>temp: done</code> in the browser, which is what I expected. </p> <p>I don't know why my previous python code didn't work as expected.</p>
php python
[2, 7]
3,976,404
3,976,405
PHP image rotate looses quality after each rotation
<p>I'm currently using GD and some PHP to rotate images. After each rotation the quality of the image gets worse. Is there a better way to do this or is this expected?</p> <pre><code> $img = new ImageClass; list($original, $info) = $img-&gt;load($src); // Determine angle $angle = strtolower($angle); if( $angle == 'cw' || $angle == 'clockwise' ) $angle = 270; if( $angle == 'ccw' || $angle == 'counterclockwise' ) $angle = 90; $rgb = $img-&gt;hex2rgb($bg_color); $bg_color = imagecolorallocate($original, $rgb['r'], $rgb['g'], $rgb['b']); $new = imagerotate($original, $angle, $bg_color); </code></pre> <p>Is it possible to rotate the image client side with maybe jquery and then save the image via PHP to the server? I'm assuming this will help with the image quality.</p>
php jquery
[2, 5]
144,455
144,456
having trouble using setInterval and with random number generation
<p>I'm trying to create a random quote generator. I have created a function called timer that runs another function pickQuote every 400ms but at the moment this doesn't seem to work. in pickQuote I run a function randomNumberGen that creates a random number. My problem in the randomNumberGen is that I want to have an if or if..else in place that checks whether or not the new random number is different from the current quotes[randomNumber] but i'm unsure how to do this. </p> <p>Can anyone provide me with some insight on how I can achieve this?</p> <p>My current effort can be viewed here: <a href="http://jsbin.com/aqinud/12/edit" rel="nofollow">http://jsbin.com/aqinud/12/edit</a></p>
javascript jquery
[3, 5]
4,950,845
4,950,846
How to disable SMS notification programmatically?
<p>This not work:</p> <pre><code>try { Context mmsContext = context.createPackageContext("com.android.mms", Context.CONTEXT_IGNORE_SECURITY); mmsContext.grantUriPermission(context.getPackageName(), Uri.parse("file:///data/data/com.android.mms/shared_prefs/com.android.mms_preferences.xml"), Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(mmsContext); Editor editor = settings.edit(); editor.putBoolean("pref_key_enable_notifications", false); editor.commit(); } catch (NameNotFoundException e1) { e1.printStackTrace(); } </code></pre> <p>Error: "Attempt to read preferences file /data/data/com.android.mms/shared_prefs/com.android.mms_preferences.xml without permission" Help, please!</p>
java android
[1, 4]
2,397,760
2,397,761
Change opacity with javascript?
<p>I need some help figuring this out! I am trying to change the opacity of a toolbar (Class) that's at the bottom of my site. The following code works for Chrome and Firefox but when it comes to IE8... NO GO. I've tried all kinds of stuff to get this to work but to keep this post clean I'm not gonna list it all.</p> <pre><code>&lt;script&gt; function hide() { $(".grid_10.bottombar").animate( { opacity: 0, left: 0 }, 1000 ); $( ".ArrowBottom.float-right" ).show(); } &lt;/script&gt; &lt;p&gt; &lt;img onclick="hide()" src="/images/BlueArrowSmall.png" /&gt; &lt;/p&gt; </code></pre> <p>Any help would be greatly appreciated! Thanks in advance.</p>
javascript jquery
[3, 5]
4,707,094
4,707,095
How to retrieve a value from js file?
<p>Basically my question is <strong>How do you get the value of a variable inside a js file.</strong></p> <p>E.g</p> <pre><code>var now = (new Date() - 0); other_var = 'Whats up';//how to pull the value of the other_var which is 'Whats Up' key.embed(); </code></pre> <p>How do get the value of the <code>other_var</code> using php? I only need the value of the variable which is 'whats up'. </p> <p>Made some digging on my own, now I am able to get the content of the js file using <code>file_get_content</code> function in php, just don't know how to pull get the variable and pull its value.</p>
php javascript
[2, 3]
5,364,878
5,364,879
The process cannot access the file because it is being used by another process
<p>I am getting binary data from a SQL Server database field and am creating a document locally in a directory my application has permissions. However I am still getting the error specified in the title. I have tried numerous suggestions posted on the web including those suggested in previous posts on Stackoverflow. I have also used ProcessExplorer > Find Handle to locate the lock and it returns nothing as if the file is not locked.</p> <p>I am using the code below to save the file to the file system and I then try to copy this file to a new location later in the application process within another method. It is this copy method that takes the path of the newly created file that throws the exception.</p> <p>The file itself is created with its content and i can open it through Windows Explorer without any problems.</p> <p>Am I missing something completely obvious? Am I creating the file correctly from the database? Any help on solving or better diagnosing the problem would be much appreciated.</p> <pre><code>// Get file from DB FileStream fs = new FileStream( "C:\myTempDirectory\myFile.doc", FileMode.OpenOrCreate, FileAccess.Write); BinaryWriter br = new BinaryWriter(fs); br.Write("BinaryDataFromDB"); fs.Flush(); fs.Close(); fs.Dispose(); // Copy file File.Copy(sourceFileName, destinationFilename, true); </code></pre>
c# asp.net
[0, 9]
2,776,801
2,776,802
Is it possible to combine different paths into a view or an object?
<p>I created a drawing using different paths, but how can I move the entire drawing? How can I selected and move it around? Here is the main part of my onDraw method:</p> <pre><code>Path theSymbol = new Path(); theSymbol.moveTo(0.0F, 0.0F); theSymbol.lineTo(0.0F, 50.0F); theSymbol.lineTo(16.666666F, 58.333332F); theSymbol.lineTo(-16.666666F, 75.0F); theSymbol.lineTo(16.666666F, 91.666664F); theSymbol.lineTo(-16.666666F, 108.33333F); theSymbol.lineTo(16.666666F, 124.99999F); theSymbol.lineTo(-16.666666F, 141.66666F); theSymbol.lineTo(0.0F, 150.0F); theSymbol.lineTo(0.0F, 200.0F); theSymbol.offset(100.0F, 20.0F); canvas.drawPath(theSymbol, paint); </code></pre> <p>That's how I draw a resistor to the screen (It works). Now I want some way of making all those paths be an object, something that I can select and move.</p> <p>I have been looking at some projects like <a href="http://code.google.com/p/sriracha" rel="nofollow">Sriracha</a>, but I can't find how they are doing their element drawings. </p> <p>I have also searched countless times, but all I get is "moving something on a path". Maibe I am searching for the wrong thing or this is not the way to do this kind of things.</p> <p>I wold really appreciate if someone can point me in the right direction. </p>
java android
[1, 4]
3,089,386
3,089,387
How to get Contact Name through Phone Number
<p>I need to directly get the contact name (if registered in contact list) through the contact number. </p> <p>I can do the opposite (get number through name) with this code:</p> <pre><code>ContentResolver cr = getContentResolver(); Cursor cursor = cr.query(ContactsContract.Contacts.CONTENT_URI, null, "DISPLAY_NAME = '"someone"'", null, null); if (cursor.moveToFirst()) { String contactId = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID)); Cursor phones = cr.query(Phone.CONTENT_URI, null, Phone.CONTACT_ID + " = " + contactId, null, null); while (phones.moveToNext()) { String number = phones.getString(phones.getColumnIndex(Phone.NUMBER)); int type = phones.getInt(phones.getColumnIndex(Phone.TYPE)); Log.v("TAG3",number); ... } } } </code></pre> <p>But I can't honestly do the opposite. Can you please guys help?</p>
java android
[1, 4]
5,744,703
5,744,704
creating textbox Via js
<p>my code was working and taking my text from textbox to next page + my Input control to next page via js but suddenly there seems to be a blunder whats wrong in following code </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var i=2; function AddTextbox(){ container.innerHTML=container.innerHTML+'&lt;input type="text" name="'+ i + '"&gt;'; i++; } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="next.php" method="post"&gt; &lt;input type="text" name="1" /&gt; &lt;input type="button" onClick="AddTextbox" name="btn" value="add" /&gt; &lt;input type="submit" name="submit" value="sub" /&gt; &lt;div id="container"&gt;&lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php javascript
[2, 3]
5,398,295
5,398,296
(Code Review) Java if statement involving logical and(&&) operator
<p>I have started programming a few weeks ago in java/android. I want to write a small tic tac toe game as an android app but I'm having trouble with my method that will check for the winner. It is as follows:</p> <pre><code> public void checkForWinner() { if( taken[0] &amp;&amp; taken[3] &amp;&amp; taken[6] || taken[0] &amp;&amp; taken[1] &amp;&amp; taken[2] || taken[2] &amp;&amp; taken[5] &amp;&amp; taken[8] || taken[6] &amp;&amp; taken[7] &amp;&amp; taken[8] || taken[0] &amp;&amp; taken[4] &amp;&amp; taken[8] || taken[2] &amp;&amp; taken[4] &amp;&amp; taken[6] || taken[1] &amp;&amp; taken[4] &amp;&amp; taken[7] || taken[3] &amp;&amp; taken[4] &amp;&amp; taken[5] == 1 ){} } </code></pre> <p>Here I have an array called taken that holds 9 integers, each of those integers being either a one, meaning player one owns that block, or a two, meaning player two ows that block. Current, I am trying trying all possible scenarios in which player one would be the winner but eclipse is telling me that <code>The operator &amp;&amp; is undefined for the argument type(s) int, int</code>. The error only seems to be showing for the first logical and operation of each line of the if statement. For example the first error goes up to <code>taken[0] &amp;&amp; taken[3]</code> and then disappears until the next line.</p>
java android
[1, 4]
2,199,378
2,199,379
Communicating between Android and PC (C#)
<p>I want to create an application in Android which communicates with a server application (written in C#, doesn't matter what version of .NET) on the PC via TCP/IP. What would be the best approach here? </p> <p>I was thinking about some kind of RPC-like SOAP or XML-RPC. But I want to keep the server application as light and simple as possible. And I think in C# you rely on a Webserver to set up an RPC server. Is it better to communicate directly via the TcpListener?</p>
c# android
[0, 4]
706,114
706,115
find the type of html controls in javascript
<p>How to find the control type in javasccript?. Say if i have an ASP.NET LinkButton and i wanna find control type from the javascript. How can i do that. I tried using typeof(), but it giving me an object back. and i tried</p> <pre><code>var control = document.getElementById(Id);//Id is the ClientId of the Linkbutton alert(control.type);//this is empty. </code></pre>
javascript asp.net jquery
[3, 9, 5]
5,167,397
5,167,398
How can I delay leaving a page via javascript?
<p>I'm trying to get add a delay of 1000ms before a person leaved the page. I'm using the beforeunload event to start a jquery animation and would like it to finish before the page leaves.</p> <p>I'm not concerned with older browsers, IE9, latest safari, chrome and FF4 are all i'm interested in.</p> <p><strong>Edit:</strong> Well I was hoping to implement it when just navigating internal pages. Sure I can make all my internal links a javascript call, but I would have preferred a less brute force method.</p> <p>Also, I'm not stopping people from leaving the page, not even making them wait a huge long time, 1 second for a fade out? Thats no worse than every game I play fading out when I select quit.</p> <p>Now had I asked how do I prevent a person from leaving a page, then yes all the "don't do it" would have been deserved.</p>
javascript jquery
[3, 5]
3,027,608
3,027,609
What is PHP like as a programming language?
<p>I am not really familiar with PHP, but I get the impression that it is like JavaScript (syntax-wise).</p> <p>What are the benefits of a dynamically typed language, when compared to a strongly typed language like C# or Java, and how would this help in the context of web development? What would make a dynamically typed language so attractive? Or, does the popularity of PHP have more to do with it being free?</p> <p>Okay, I think I better give a little more background to get more meaningful answers, because I am not wanting a flame war.</p> <p>I come from a C background, and when I moved into C# and Visual Studio. Having code completion, integration with an SQL database, huge existing class libraries and easy to access documentation, as well as new tools such as LINQ and ReSharper was like heaven. I didn't enjoy JavaScript before JQuery, but now I love it as well. Recently, I ported a PHP project over to C# and I used Zend to help me debug and understand more while porting - instead of maintaining two code streams. That also cut down on the cost of the server and maintenance.</p> <p>Getting into PHP would be nice. I think that Visual Studio has spoiled me - but again Eclipse is also equally spoiling.</p> <p>It would be nice to have an answer from someone who has experience developing both under PHP and .NET.</p>
c# java php javascript
[0, 1, 2, 3]
5,849,618
5,849,619
jquery count to number
<p>I have a piece of code that counts from 0 to a specified number with a specified delay.</p> <p>The problem is that it adds by 1 and I want it to add by 0.01</p> <p>How to do it? the code is as follows:</p> <pre><code> &lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;style&gt;body{font:11px verdana;color:#555;}&lt;/style&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var max = 20;// set with php $(incCounter); function incCounter() { var currCount = parseInt($('.counter').html()); $('.counter').text(currCount+1); if (currCount+1 != max) { setTimeout(incCounter,50); } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="counter"&gt;0&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
1,562,919
1,562,920
Tips for developing an ASP.NET application that doesn't depend on JavaScript
<p>Not sure if this belongs in community wiki...</p> <p>Can somebody give some general guidelines on how to successfully build an ASP.NET site that isn't dependent on JavaScript? My understanding is that I should build a functional site initially without JavaScript, and use it to enhance the user experience. That is easier said than done... how can I make sure my site works without JavaScript short of disabling JavaScript and trying it? Or is this something that comes with experience?</p>
asp.net javascript
[9, 3]
2,804,399
2,804,400
GZIP in Android
<p>i just wanted to ask about sending gzip for post requests using HttpClient in Android?</p> <p>where to get that OutputStream to be passed in the GZIPOutputstream?</p> <p>any snippets?</p>
java android
[1, 4]
2,319,845
2,319,846
Problems unwatching an object using watch.js
<p>I'm trying to use <a href="https://github.com/melanke/Watch.JS" rel="nofollow">watch.js</a> in the code below. The idea is too run watch.js in a one shot way, so it detects the boolean change (of vars.in_animation) and then unwatchs and exits. However, what happens is the code falls into inifinite loop and everytime vars.in_animation changes the watch callback is triggered and the unwatch code never runs.</p> <p>I don't know whether the problem is the way I'm using watch.js, or if there is some other issue in the structure of the code. Any ideas?</p> <pre><code>base.goTo = function(targetSlide){ if (vars.in_animation || !api.options.slideshow) { //arrange for a callback once in_animation is false again //only need to detect first change from true to false, and then unwatch watch(vars, "in_animation", function() { console.log('called back, value of in_animation ' + vars.in_animation); unwatch(vars,"in_animation",vars.alert); //never called base.goTo2(vars.saved_slide); }); vars.saved_slide = targetSlide; return false; } else { base.goTo2(targetSlide); } } </code></pre> <p>EDIT, just made a fiddle of the problem > <a href="http://jsfiddle.net/SZ2Ut/3/" rel="nofollow">http://jsfiddle.net/SZ2Ut/3/</a></p> <pre><code>var obj = { name: "buddy", alert: function(){ alert(obj.phrase + " " + obj.name); } } watch(obj, "name", function(){ alert('name has changed to: ' + obj.name); }); //should only fire once for this one obj.name = "johnny"; unwatch(obj, "name", obj.alert); obj.name = "phil"; </code></pre>
javascript jquery
[3, 5]
4,177,849
4,177,850
Get a value of checked checkbox into a button from a Gridview
<p>I have a Gridview Generated as follows :</p> <pre><code>&lt;asp:GridView ID="Cash_GridView" runat="server" CssClass="Grid" &gt; &lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:CheckBox ID="MemberCheck" runat="server" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="Loan_Acno" HeaderText="Loan A/C number" /&gt; &lt;/Columns&gt; &lt;/asp:Gridview&gt; &lt;asp:Button ID="CashPayButton" runat="server" Text="Pay Dividend" CssClass="bluesome" OnClick="CashPayButton_Click" /&gt; </code></pre> <p>And also having the above button click event now when i click checkbox on particular row i want that whole row to be get caluclated in the Button click event in the code behind</p> <pre><code>protected void CashPayButton_Click(object sender, EventArgs e) { } </code></pre>
c# asp.net
[0, 9]
2,198,965
2,198,966
How can I store a value (string) in a web page
<p>I would like to store the value of something on my web page for later use by some javascript functions. I thought of doing something like this where I have a div with an id of CategoryID and then put the value in that as HTML. </p> <pre><code> &lt;div id="CategoryID"&gt;&lt;/div&gt; $('#categories &gt; li &gt; a').click(function (e) { e.preventDefault(); $('#CategoryID').html = $(this).attr('data-value') refreshGrid('Reference'); }); </code></pre> <p>Then later inside functions such as refreshGrid (and some other functions), I could get the value like this:</p> <pre><code> var categoryID = $('#CategoryID').val(); </code></pre> <p>Does this seem like a good way to store a temporary variable? How about with HTML5, is there some way to store values without having to put them inside a div or something like that. All I need is to have a value that is stored in some way on the page.</p> <p>One more question. If I store the value is this the correct way to do it:</p> <pre><code>$('#CategoryID').html = $(this).attr('data-value') </code></pre>
javascript jquery
[3, 5]
4,857,878
4,857,879
Tracking revisions in ms excel in asp.net
<p>I have managed to keep ms words track revisions property on. It is working file. Everything about the word is woring fine. How do I do the same for MS Excel? Follwing is my code for word(which is working fine) and next is for exce that I am trying to execute.</p> <p>1) Word</p> <pre><code>Word.Application app = new Word.Application(); Word.Document tempDoc = app.Documents.Open(path); tempDoc.TrackRevisions = true; tempDoc.Protect(typ, ref missing, ref password, ref missing, ref missing); </code></pre> <p>2)</p> <pre><code>Excel.Application ex_APP = new Excel.Application(); Workbook wrk = ex_APP.Workbooks.Open(path); </code></pre> <p>not able to go past this. When I try doing </p> <pre><code>wrk. </code></pre> <p>I dont get property as trackReviosons. </p> <p>Any suggestions</p>
c# asp.net
[0, 9]
50,662
50,663
Add two elements at a time, one inside the other, to an element
<p>I have a proxy application retrieving 'src' attributes cross domain from an xml list of photos.</p> <p>I want to append images full size INSIDE of presized div's so they render in a uniform size, without stretching.</p> <p>I know how to append the images on their own, but I don't know how to create a div, append the image to that element, then appendTo that div with the img to a container.</p> <p>tl;dr; Right now I have this</p> <pre><code>$("&lt;img&gt;").attr("src", stuff).attr('class','imgur').appendTo("#content"); </code></pre> <p>Producing this:</p> <pre><code>&lt;div id="content"&gt; &lt;img /&gt; &lt;img /&gt; &lt;img /&gt; &lt;img /&gt; &lt;/div&gt; </code></pre> <p>And I want this:</p> <pre><code>&lt;div id="content"&gt; &lt;div class="window"&gt;&lt;img /&gt;&lt;/div&gt; &lt;div class="window"&gt;&lt;img /&gt;&lt;/div&gt; &lt;div class="window"&gt;&lt;img /&gt;&lt;/div&gt; &lt;div class="window"&gt;&lt;img /&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p><em><strong>Answer slightly modified to meet my use case:</em></strong></p> <pre><code>function imgAdd(param) { var content = document.getElementById("content"); var img = new Image(); img.src = param; img.classList.add("imgur"); var div = document.createElement("div"); div.classList.add("window"); div.appendChild(img); content.appendChild(div); } </code></pre> <p>Being fired by:</p> <pre><code>HtmlPage.Window.Invoke("imgAdd", p.src); System.Threading.Thread.Sleep(20); </code></pre>
javascript jquery
[3, 5]
1,717,871
1,717,872
Jquery: one call triggered by multiple events
<p>I have a simple search page with a single input box.</p> <p>I want to be able to trigger the search action either by clicking "Go" or by pressing Enter in the input box. I did it like this:</p> <pre><code>$("input[name='entry']").keyup(function(event) { if (event.keyCode == 13) { search_phone(); } }); $('a#go').click(function() { search_phone(); }); </code></pre> <p>Is there a more elegant way to do this? Like with bind and trigger, or fling. If so, how?</p>
javascript jquery
[3, 5]
484,374
484,375
How to replace link with list element and then add new link in IE7/8 with jQuery?
<p>I can't control how the HTML is generated and need to put a string of links into a list and then add new links for each item.</p> <p>I have simplified the code at <a href="http://jsfiddle.net/jhASu/" rel="nofollow">http://jsfiddle.net/jhASu/</a> and it works in Chrome/Firefox and IE9 but not in IE 7 and 8 (no new links are generated). What could be the cause of this?</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,070,940
4,070,941
making a variable an instance of a class
<p>I'm in a-level computing and I was wondering if someone could please tell me the definition of this. If I have a class with methods etc, then I make another class where I kind of generate a variable of that first class. What is this actually called? It's the variable definition I'm after shown below "whatisThis" is this a class object?</p> <pre><code>MyClass1 { ... } MyClass2 { MyClass1 whatisThis = new MyClass1(); } </code></pre>
c# java
[0, 1]
2,133,291
2,133,292
JQuery mobile run time change html (jQuery('#xx').html(html);)
<p>I took the code in: <a href="http://jquerymobile.com/demos/1.0/docs/about/getting-started.html" rel="nofollow">http://jquerymobile.com/demos/1.0/docs/about/getting-started.html</a> it works fine, </p> <p>then I try to build the same dynamically , but this not works at all! Empty page!!!!!!! here, not works:</p> <pre><code>$(document).ready(function () { var html = ''; html += '&lt;div data-role="page"&gt;'; html += '&lt;div data-role="header"&gt;'; html += '&lt;h1&gt;My Title&lt;/h1&gt;'; html += '&lt;/div&gt;'; html += '&lt;div data-role="content"&gt;'; html += '&lt;p&gt;Hello world&lt;/p&gt; '; html += '&lt;/div&gt;'; html += '&lt;/div&gt;'; jQuery('#divData').html(html); return false; }); </code></pre> <p>And this HTML:</p> <pre><code>&lt;div id="divData"&gt; &lt;/div&gt; </code></pre> <p>WHY?</p>
javascript jquery
[3, 5]
4,509,154
4,509,155
Unable to get updated value of session variable and Textbox
<p>I am building a web application in asp.net and c#, I am storing text of textbox in Session variable like this:</p> <pre><code>Session["data"]=TextBox1.Text; </code></pre> <p>and on the button click event I am redirecting user to another page.In the second page I am using this variable <strong>Session["data"]</strong> and in page2 there is a back button where I am again Redirecting to page1 where the textbox1 is present.Now on the button click event where I am redirecting to page2 and event is code like this,</p> <pre><code>Session["data"]=TextBox1.Text; Response.Redirect("page2.aspx"); </code></pre> <p>now when I am accessing the value of the Session["data"] it is giving me the previous value.As the content of TextBox1 may get changed,these changes have not been shown.</p> <p>Please tell me where I am going wrong.</p>
c# asp.net
[0, 9]
3,564,852
3,564,853
What are some best practices for transporting data from PHP to Javascript?
<p>My projects are becoming more and more JS heavy. The issue is that most of my data is on the server side (PHP). What are some clean ways for transporting this data over to the client side (code samples for extra brownie points)? </p> <p>Some ways I am considering - which of these are best?:</p> <p>1) Use php to "echo" directly to js variables. 2) Use php to write to HTML elements and then use js to retrieve from the dom. 3) Use ajaxcall</p> <p>Thoughts?</p>
php javascript
[2, 3]
5,429,246
5,429,247
Tap event firing X times a second in jquery
<p>I'm trying to make touch controls for a little game I'm writting with the help of jquery. But i just can't figure out how to write a function that basicly does the same thing that happens when you keep a key pressed. Could you please help me?</p> <p>PS. its not originaly my code <a href="http://remysharp.com/demo/mousehold.js" rel="nofollow">source</a></p> <pre><code>jQuery.fn.mousehold = function(timeout, f) { if (timeout &amp;&amp; typeof timeout == 'function') { f = timeout; timeout = 100; } if (f &amp;&amp; typeof f == 'function') { var timer = 0; var fireStep = 0; return this.each(function() { jQuery(this).mousedown(function() { fireStep = 1; var ctr = 0; var t = this; timer = setInterval(function() { ctr++; f.call(t, ctr); fireStep = 2; }, timeout); }) clearMousehold = function() { clearInterval(timer); if (fireStep == 1) f.call(this, 1); fireStep = 0; } jQuery(this).mouseout(clearMousehold); jQuery(this).mouseup(clearMousehold); }) } } $.fn.extend({ disableSelection: function() { this.each(function() { this.onselectstart = function() { return false; }; this.unselectable = "on"; $(this).css('-moz-user-select', 'none'); $(this).css('-webkit-user-select', 'none'); }); } }); </code></pre>
javascript jquery
[3, 5]
742,839
742,840
how to make this code works if i used it inside update panel and some of the checkbox values will be disabled according to database field ..?
<p>This code works fine if i use this inside ssercontrol > panel and i have a checkboxes in table when no checkbox is checked its works fine .... but if i disabled and checked any of the textbox then this doesn't work .... in usercontrol why ? i didnt understand ..</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function checkboxChecked(){ var allInputs = document.getElementsByTagName("input"); for(var i=0; i&lt;allInputs.length; i++) { var chk = allInputs[i]; if(chk.type == "checkbox" &amp;&amp; !chk.disabled &amp;&amp; chk.checked) { return true; } } alert("OOps! You haven't selected all available checkboxes"); return false; } &lt;/script&gt; </code></pre>
javascript asp.net
[3, 9]
5,255,648
5,255,649
How to display timepicker dialog when radiobutton is clicked?
<p>I'm trying to display time picker dialog by using <code>showDialog(1);</code> when radio button is clicked. But i cannot display if i write onclick event for radio button. How to solv this problem? Any help is appreciated and thanks in advance...</p>
java android
[1, 4]
1,826,763
1,826,764
jQuery .load() wait, before load content
<p>I would like to fadeOut the #portfolio-wrapper, than load the portfolio2.html with fadeIn(600). The problem is that the load function execute before the fadeOut(600). Please help me! Big thanks :)</p> <pre><code>$("a").click(function(){ $("#portfolio-wrapper").fadeOut(600).load('portfolio2.html').fadeIn(600); }); </code></pre>
javascript jquery
[3, 5]
3,731,752
3,731,753
Pass server side control's client ID in javascript function as parameter
<p>How can I pass server side asp control's client ID in javascript function. I tried like this.</p> <pre><code>&lt;asp:RadioButtonList ID="rdbMyocardial" runat="server" RepeatDirection="Horizontal" onClick="return f1('&lt;%rdbMyocardial.ClientID %&gt;')"&gt; &lt;asp:ListItem Value="True"&gt;Yes&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="False"&gt;No&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; </code></pre> <p>But when I try to print the value in javascript, like this,</p> <pre><code>function f1(list) { alert(list); return true; } </code></pre> <p>It shows &lt;%rdbMyocardial.ClientID %>. How can I get the client side ID of server control? Also how can I set it from both HTML and from server side code?</p>
javascript asp.net
[3, 9]
5,500,447
5,500,448
append html with a function in it
<p>I have a function <code>onclick</code> that add HTML :</p> <pre><code>jQuery(".test").click(function() { jQuery(this).prevAll("input").val("5") jQuery(".after").append("&lt;div&gt;&lt;input /&gt;&lt;a class='.test'&gt;click doesn't work !&lt;/a&gt;&lt;/div&gt;") }); </code></pre> <p>So, when I click on my class <code>.test</code>, the function is triggered. And that works, but I have appended another class <code>.test</code> and when I click on it, the function isn't triggered. Why ? Thanks.</p> <p>Fiddle : <a href="http://jsfiddle.net/csL8G/3/" rel="nofollow">http://jsfiddle.net/csL8G/3/</a></p>
javascript jquery
[3, 5]
5,753,516
5,753,517
Android: How to get or read XML from URL to String
<p>how to read XML and then convert/transform it to variable String, I have try with Jsop library, but not success, with JSoup I get html format.</p> <p>I want to read link in below to String: <a href="http://bowingdown.wordpress.com/feed/" rel="nofollow">http://bowingdown.wordpress.com/feed/</a></p> <p>And then put it to String, I want to as below, example;</p> <pre><code>String data = "&lt;rss xmlns:content=blablabla&gt;&lt;channel&gt;blablbabla&lt;/channel&gt;&lt;/rss&gt;"; </code></pre> <p>And i have read in here <a href="http://stackoverflow.com/questions/5162063/http-request-for-xml-file/5162372#5162372">HTTP request for XML file</a>, but not success.</p> <p>Thanks for help. </p>
java android
[1, 4]
2,831,697
2,831,698
Update a listview when a button is pressed
<p>I have two listviews, one where the data is displayed and another where I insert data (InsertItemTemplate). When the button on the first one is clicked and data is entered in the database i want the other one to update.</p> <p>This is how i tried so far:</p> <pre><code>&lt;asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Add movie" OnClick="InsertButton_OnClick" /&gt; </code></pre> <p>And in the aspx file:</p> <pre><code>protected void InsertButton_OnClick(object sender, EventArgs e) { Response.Redirect(Request.RawUrl); } </code></pre> <p>When i use "Response.Redirect(Request.RawUrl);" my data is not entered, so that will not work. What should I use instead to get this to work?</p> <p>Thanks in advance!</p>
c# asp.net
[0, 9]