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
5,342,982
5,342,983
How to block form submission when the enter key or return key is pressed?
<p>I have a form that I use JQuery, I don't think I need to put code in this post, the question is pretty basic.</p> <p>But I would like to block the form from submitting when people press the Enter Key or the Return Key.</p> <p>At the same time, I have textareas, where the user will need to be able to press the Enter / Return keys.</p>
javascript jquery
[3, 5]
930,269
930,270
Retrieving ListView using FindControl
<p>I am trying to retrieve two listviews from an ascx control for the purpose of saving them to a PDF file: </p> <pre><code>&lt;TagCloud:TagCloudControl ID="TagCloudControl1" runat="server" /&gt; </code></pre> <p>I get the following error: TagCloudControl1 is a field but is used like a type and an object reference is required for the non-static field, method or property...Thanks for your help!</p> <pre><code>ListView lv1 = (TagCloudControl1)ListView.FindControl("ListView1"); ListView lv2 = (TagCloudControl1)ListView.FindControl("ListView2"); lv1.RenderControl(htWriter); lv2.RenderControl(htWriter); </code></pre>
c# asp.net
[0, 9]
4,925,664
4,925,665
java: determine ratio, from multiple inputs and duplicate input
<p>I would like to determine the ratio of how many times a costcentre appears in that asset</p> <p>might be easier to show than explain</p> <p><strong>Input File</strong></p> <pre><code>asset_id|employee_id|costcentre_id 1|123|2 1|342|2 1|122|3 2|231|4 2|232|3 </code></pre> <p>which should return</p> <pre><code>asset_id|employee_id|ratio 1 | 2 | 1 //because more than 50% of 1 was allocated to 2 2 | 4 | 0.5 //because not more than 50% ... 2 | 3 | 0.5 //because not more than 50% ... </code></pre> <p>ofcourse the input looks much worse than that, imagine. . .</p> <pre><code>5|503|18 5|742|18 5|861|18 5|408|18 5|330|18 5|440|18 5|102|18 23|418|5 26|723|70 26|466|89 26|376|85 26|839|89 28|811|189 28|1224|244 28|302|72 28|348|244 29|229|47 31|655|80 44|250|10 44|729|81 44|867|10 44|960|81 44|973|81 //just a small piece of the input file </code></pre> <p>It will need to determine the amount of times the asset_id is there then it will get values for each one and determine if there were more than 50% allocated to a costcentre, give it a ratio of 1 and output results of that one entry.</p> <p>if it does not have more than 50% of costcenter id's that are the same it should split the ratio how to the formula ratio = (amount of times its there/count number of other times)</p>
java javascript
[1, 3]
3,692,598
3,692,599
how to check javascript array equals?
<pre><code>var a=[1,2,3]; var b=[3,2,1]; var c=new Array(1,2,3); alert(a==b+"|"+b==c); </code></pre> <p><a href="http://jsfiddle.net/YrMyc/3/">demo</a></p> <p>How to check these array, and get true from equals method?</p> <p>Under jQuery, has any methods for this?</p>
javascript jquery
[3, 5]
1,815,194
1,815,195
jquery or js: replace a link site-wide with another AND change to https
<p>I want to change every instance of</p> <pre><code>http[s]://www.mydomain.com/test/index.php?this_page=foo </code></pre> <p>to</p> <pre><code>https://www.mydomain.com/test/index.php?this_page=bar </code></pre> <p>I think its must be able to be done with <code>attr.replace</code> but I can't figure out the notation. How can I do this with jQuery or JavaScript?</p> <p>EDIT: it seems everyone so far is either missing the first part (http OR https changes to https) or the second part (foo to bar) :) Sorry for confusion</p>
javascript jquery
[3, 5]
2,566,686
2,566,687
How to raise custom event from a Static Class
<p>I have a static class that I would like to raise an event as part of a try catch block within a static method of that class.</p> <p>For example in this method I would like to raise a custom event in the catch. </p> <pre><code>public static void saveMyMessage(String message) { try { //Do Database stuff } catch (Exception e) { //Raise custom event here } } </code></pre> <p>Thank you.</p>
c# asp.net
[0, 9]
3,966,473
3,966,474
Scaling images on android
<p>I read that when scaling do not use real pixels. Is the only reason for this that the images will look blurry? If yes, so why the screens are categorized for Android into density categories. Now I could find 2 480x800 screens one with high density and other with low. So When I supply 2 different images One will have for example 34x34 and the otehr 45x45 BUT Shouldnt both have the same texture or this would make the layout different Since I will be using Pixels to calculate distance and positions?</p> <p>Regards, Baracat</p>
java android
[1, 4]
4,795,113
4,795,114
jQuery: Fire click on event on a span
<p>I saw a post earlier today and have been playing around with: <a href="http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html" rel="nofollow">http://arashkarimzadeh.com/index.php/jquery/7-editable-jquery-plugin.html</a></p> <p>What I'd like to be able to do is when a span gets clicked, to fire the click event on a different element in the page:</p> <pre><code>&lt;div class='editable sampleItem pointer' id='qqq'&gt;click me!!!&lt;/div&gt; </code></pre> <p>Is that possible?</p>
javascript jquery
[3, 5]
5,402,329
5,402,330
JS Jquery Namespace Calling Functions
<p>Ok terrible title but I couldn't think of another description.</p> <p>I have the following code:</p> <pre><code>jQuery( document ).ready( function( $ ) { $.myNamespace = { init: function() { $('.button').click(function() { this.anotherFunction(); }); }, anotherFunction: function() { alert('insidefunction'); } } $.myNamespace.init(); }); </code></pre> <p>As you can see I am trying to call anotherFunction from inside init and have there the two ways I tried but didn't work. So how am I able to call that function or is my concept wrong?</p>
javascript jquery
[3, 5]
3,543,630
3,543,631
Jquery .serialize isn't registering the values of the input-fileds
<p>I am trying to serialize some data from a form. </p> <p>The html:</p> <pre><code>&lt;form class="span5 login navbar-form pull-right"&gt; &lt;input class="span2" type="text" placeholder="E-mail" /&gt; &lt;input class="last span2" type="password" placeholder="Lösenord" /&gt; &lt;a class="loginbutton span1 btn btn-zen-inverse btn-mini" href="#"&gt;Logga in&lt;/a&gt; &lt;br /&gt; &lt;a class="pull-right hidden" href="#"&gt;Glömt lösenord&lt;/a&gt; &lt;label class="pull-right hidden"&gt;&lt;input type="checkbox" /&gt; Kom ihåg mig&lt;/label&gt; &lt;/form&gt; </code></pre> <p>Jquery:</p> <pre><code>$(document).ready(function() { $('.loginbutton').click(login); }); function login(){ event.preventDefault(); var params = $('form').serialize(); console.log(params); } </code></pre> <p>If i put some data in the html-fields and click the "a" tag with <code>.logintbutton</code> on it, the <code>console.log</code> is just empty, I expect it to push out the data. Whit serializeArray, I get an empty array. </p>
javascript jquery
[3, 5]
2,851,519
2,851,520
Unable to return boolean from GPS check
<p>Im trying to detect if the GPS on my device is turned on.</p> <p>Currently i am simply returning a boolean true or false value that then either proceeds with my code, or directs the users to the GPS settings.</p> <p>At the moment when i return the boolean value my code is crashing. I have debugged it but still cannot see why as it it returning a value.</p> <p>Here is the code:</p> <pre><code> GPSYesOrNo g = new GPSYesOrNo(this); check = g.checkStatus(); // check if GPS enabled if (check == true) { Intent Appoint = new Intent("com.example.flybaseapp.appointmantMenu"); startActivity(Appoint); } else { alert(); } </code></pre> <p>And the GPSYesOrNo class:</p> <pre><code>public class GPSYesOrNo { Context cc; private LocationManager locationManager; boolean enable; public GPSYesOrNo(Context c) { this.cc = c; checkStatus(); } public boolean checkStatus() { locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); boolean enabled = locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER); if (enabled) { return true; } else { return false; } } } </code></pre> <p>Can anyone see where I am going wrong?</p>
java android
[1, 4]
4,168,335
4,168,336
Layout weight not changing in xml
<p>I have a XML code here:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" android:weightSum="100" &gt; &lt;fragment android:name="com.powergroup.split.view.powerListFragment" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/powerlist_fragment" android:layout_weight="45" &gt; &lt;/fragment&gt; &lt;fragment android:name="com.powergroup.split.view.powerViewerFragment" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/powerview_fragment" android:layout_weight="55" &gt; &lt;/fragment&gt; &lt;/LinearLayout&gt; </code></pre> <p>but if I change the value of layout_weight it doesnt take any effect and always shows the same, how can i figure it out?</p>
java android
[1, 4]
4,721,935
4,721,936
Fadein effect on page load
<p>Is there any way to use the fade in/out effect of jQuery while loading a page? I don't want to have hidden div and I call the fadeIn() method to show those divs. I want the pages to load with such effect. Any solution to that? So much appreciated !</p>
javascript jquery
[3, 5]
224,999
225,000
Hiding, displaying and focusing editText's in Android
<p>I've two linked questions.</p> <p>I'm applying a slide translation on an editText and it's button. I've created two buttons, one visible and one invisible, for obvious reasons. In order to hide the one that was visible and show the one that was invisiable I'm using this code:</p> <pre><code>public void onAnimationEnd(Animation animation) { textBox.setVisibility(View.GONE); button.setVisibility(View.GONE); button2.setVisibility(View.VISIBLE); textBox2.setVisibility(View.VISIBLE); textBox2.requestFocus(); button2.setEnabled(true); button.setEnabled(false); } </code></pre> <p>Where <code>textBox</code> is the original editText and <code>button</code> is its accompanying button. <code>textBox2</code> is the one I want to show. </p> <p>Yet the original editText and its button remain visible and the other set don't appear. Any ideas whats wrong with above?</p> <p>Second, I can find screen size in my .java file, but how could I pass this into my .xml animation file? Or is there a better way of adjusting the amount of transition depending on the screen size?</p> <p>Here's how I invoke the animation:</p> <pre><code>Animation translateAnimation = AnimationUtils.loadAnimation(first.this, R.anim.translate); textBox.startAnimation(translateAnimation); </code></pre> <p>Translate.xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;translate xmlns:android="http://schemas.android.com/apk/res/android" android:fillAfter="true" android:fromYDelta="0" android:toYDelta="-160" android:duration="50" /&gt; </code></pre>
java android
[1, 4]
2,614,599
2,614,600
Do we 'declare' jQuery or we simply use it?
<p>I was asked in an interview that how do you <em>'declare'</em> jQuery? He did not mean a jQuery variable or a <code>$(func())</code>. In case you find this question weird, please do not penalize me for this as I'm enquiring just cause I was asked. :)</p>
javascript jquery
[3, 5]
5,530,487
5,530,488
Page jumps when fadeIn() and fadeOut() of two overlapping elements occurs
<p>I've created something in jQuery, I have a problem when clicking the images though. If you scroll down entirely to the bottom of the page and then click, you'll see it jumps. I've tried multiple methods to prevent jumping but its not working.</p> <p>Here is my code:</p> <pre><code>$('.author').click(function(e) { var name = $(this).attr('id') + '-info';    $('.author-info article').hide();    $('#' + name).fadeIn(); $('.author').removeClass('active'); $(this).addClass('active'); e.preventDefault(); }); </code></pre> <p>here is the live link - <a href="http://sites.lukespoor.com/author/" rel="nofollow">http://sites.lukespoor.com/author/</a></p> <p>any help is appreciated </p>
javascript jquery
[3, 5]
2,793,479
2,793,480
HTML File Upload Control Problem in Asp.net 2003
<p>hi im using html File Upload Control in Asp.net 2003 version...whenever I try to upload the file its working fine...but suppose I upload the file then I click any radio button or any other button, fileupload control value is automatically erased..so I cannot upload the file successfully...anybody help me...</p>
c# asp.net
[0, 9]
4,862,460
4,862,461
tagName is null or not an object -- error msg in IE7 using latest version of jQuery (1.2.6)
<p>has anyone else seen this error message. a quick check with google doesn't show me much.</p>
asp.net javascript jquery
[9, 3, 5]
4,364,707
4,364,708
Binding Events rather than using onclick
<p>I have been told its better to bind events to elements rather than having <code>onclick</code>s with functions everywhere. I agree with this as it devolves more from the HTML which means cleaner and easier to debug code. </p> <p>But I am having trouble doing this! I loop through some data with PHP (see below) and I currently use onclick to call a function. How can I bind this onclick event to many elements using JQuery.</p> <pre><code>&lt;?php foreach($main_tags as $key=&gt;$value){ ?&gt; &lt;li&gt; &lt;a id="&lt;?php echo $key; ?&gt;" href="#" onclick="tag_search('&lt;?php echo $key; ?&gt;'); return false;"&gt; &lt;?php echo $key; ?&gt; &lt;span class="num-active"&gt; &lt;?php echo $value; ?&gt; &lt;/span&gt; &lt;/a&gt; &lt;/li&gt; &lt;?php } ?&gt; </code></pre> <p>Thanks all for any help</p>
javascript jquery
[3, 5]
4,310,019
4,310,020
Making Subids And Postback Tracking Work
<p>I am coding a Bounty Script in Php. (Reward Script),using open source code from Prosper202.Trying to track leads with Subids and Postbacks.I am not able to get this stuff to work. Example.</p> <p>I would like to append Unique id at end of url. Like <code>http://google.com/c3={unique_id}</code></p> <p>Here Unique id needs to be generated randomly atleast vaild for 15 minutes and needs to be stored in Mysql database.</p> <p>When Successful third party server sends postback in format.</p> <pre><code>http://watever.com/c3={unique_id} </code></pre> <p>We then need to compare both in real time. (this needs to be as fast as possible to avoid delays to end user.)</p> <p>What should we use in this Case?</p> <p>JavaScript to use for Postback or php?</p> <p>And how to manipulate the postback in php script.</p> <p>As i mentioned. This Script Prosper202 also have same feature of tracking postbacks. But i am not able to extract useful code from it.</p> <p><strong>Resources:-</strong></p> <pre><code>http://prosper.tracking202.com/apps/ http://prosper.tracking202.com/forum/6/21/tracking-subids#7848 </code></pre>
php javascript jquery
[2, 3, 5]
2,674,772
2,674,773
how/where to store the page numbers when navigating to other page / portal
<p>I'm using an usercontrol (*.ascx) in a CMS system C#.NET </p> <p>I've got a Gridview which displays address. You hav a link on the line items and you can click on the items (link) which navigates to other page with querystring info and displays the detail information. When the user clicks on cancel/back it returns the the overview page. Both are separate programs.</p> <p>When the user clicks on Next, Next, Next e.g. page 7 is displayed. So clicking on an "adres link" on Page 7 will open a new page and when the user comes back it should display page 7 back again. </p> <p>I was keeping the page numbers in a session. so when the user comes back it reads the pagenumber from the session. This works fine. But the issue is this module is used other placess too, and also in other portals (which uses the same module)</p> <p>So when have clicked next next etc and you are on page 7 and then you open another portal or other Porgram which have the same module, it displays page 7. Because it reads the Session variable and sometiems it gives a dump because page 7 doesn't exist, because no much records.</p> <p>Viewstate fix this issue, but everytime after clicking the adres item and coming back it displays page 1, which is not what I want.</p> <p>As I said, I use the same module in other pages and other portals (same program with different settings CMS -system)... So <strong>where</strong> and <strong>how</strong> do I need to store the pagenumbers so it doesn't have conflict with other pages and other portals? </p> <p>ViewState["page"] = 7 -> starts on page 1 always when you come back</p> <p>Session["page"] = 7 -> page number is shared....</p>
c# asp.net
[0, 9]
2,052,963
2,052,964
Why isn't my modified JavaScript showing up in the debugger?
<p>I have started my web application as website. I am calling JavaScript in it. Problem is in the script: the first time through, the script is working while debugging, but if I make any modification to the script and then try to debug it, control is moved to old lines and not new lines. I tried to rebuild, but still get the same result. </p> <p>What may be the reason for this?</p>
asp.net javascript
[9, 3]
171,441
171,442
Is there an event that fires when an element's `class` attribute changes?
<p>I have a <code>&lt;ul&gt;</code> element on my page with a few children. A <code>class</code> attribute will be added to these children at some point, </p> <p>Before</p> <pre><code>&lt;ul&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>After</p> <pre><code>&lt;ul&gt; &lt;li class='classname'&gt;1&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I would like to bind to an event that will fire whenever the <code>li</code> element's class changes, so I can handle it accordingly. Is there such an event?</p>
javascript jquery
[3, 5]
2,387,859
2,387,860
Jquery: Add class unless there is a child of certain class
<p>I want to do an addclass, but only if it doesn't have a child of a certain class.</p> <pre><code>$selector.addClass('addthisclass'); </code></pre> <p>So I want:</p> <pre><code>&lt;div class="addthisclass"&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt; </code></pre> <p>And nothing on here.</p> <pre><code>&lt;div&gt;&lt;span class="badclass"&gt;&lt;/span&gt;&lt;/div&gt; </code></pre> <p>Anyone know how to do this?</p>
javascript jquery
[3, 5]
2,702,544
2,702,545
Python to Javascript
<p>are there any tools for Windows to convert python to javascript?</p> <p>regards</p> <p>Alberto</p>
javascript python
[3, 7]
5,430,761
5,430,762
How to set input type="number" on dynamic textbox in c# codebehind
<p>I have a dynamically created textbox in a c#/asp.net web page that I want to adapt to mobile browsers. </p> <blockquote> <p>TextBox qtybox = new TextBox();<br> qtybox.ID="qtybox";<br> qtybox.Text = "0";<br> qtybox.Width = 30;<br> container.Controls.Add(qtybox);</p> </blockquote> <p>I see that on a I can set this in HTML, if it were a straight HTML form:</p> <blockquote> <p>&lt; input type = "number" ></p> </blockquote> <p>in order to bring up the numeric keyboard. </p> <p>How can I do this with my dynamic textbox in codebehind, or can I? Is there an alternate way to put a numeric input control on my page dynamically in codebehind that would work better? Do I need to use Javascript to "hack" the control after it renders? (I'd rather have a .NET way of doing it if possible.)<br> Thanks</p>
c# asp.net
[0, 9]
64,837
64,838
jQuery live hover
<p>I can't seem to convert the following into a live hover</p> <pre><code>$("li.favorite_item").hover( function () { $(this).append($(" &lt;a href='#' class='button'&gt;x&lt;/a&gt;")); }, function () { $(this).find("a:last").remove(); } ); </code></pre> <p>I've tried:</p> <pre><code>$("li.favorite_item"").live('hover', function() { function () { $(this).append($(" &lt;a href='#' class='button'&gt;x&lt;/a&gt;")); }, function () { $(this).find("a:last").remove(); } }); </code></pre> <p>But it does not work.</p>
javascript jquery
[3, 5]
668,067
668,068
How get a real path value to file that store local on HDD from input or FileUpload?
<p>I have two file uploaders:</p> <pre><code>&lt;input name="targetFile" runat="server" id="File1" type="file" /&gt; &lt;asp:FileUpload ID="FileUpload1" runat="server" /&gt; </code></pre> <p>When I click to choose file (for example D:\Test.txt) the way to file appears on control, but when I get value control in javascript:</p> <pre><code>obj = document.getElementById("File1"); </code></pre> <p>value of the path to file store local:</p> <pre><code>obj.value = "C:\fakepath\Test.txt" </code></pre> <p>I need to get actualy "D:\Test.txt" string on javascript. Can it be done?</p>
javascript asp.net
[3, 9]
3,134,038
3,134,039
Add/remove divs using jquery
<p>I changed my code to the following:</p> <pre><code>$(document).ready(function () { $('#add').on('click', function () { var $contacts = $(".contact"); $("&lt;div/&gt;").append($("&lt;input&gt;", { "type": "text", "name": "contact[" + $contacts.length + "][name]" })).insertAfter($contacts.last()); }); }); &lt;div class="contact"&gt; Name: &amp;nbsp; &lt;input type="contact[0][name] type="text"&gt; &lt;/div&gt; &lt;div class="contact"&gt; Name: &amp;nbsp; &lt;input type="contact[1][name] type="text"&gt; &lt;/div&gt; &lt;div class="contact"&gt; Name: &amp;nbsp; &lt;input type="contact[2][name] type="text"&gt; &lt;/div&gt; </code></pre> <p>This works and allows me to add another row. However, I need help on two things:</p> <p>1) When I add another row and hit submit. The $_POST array only shows the first three values, not the dynamically added arrays.</p> <p>2) How do I add more the text to the appended html? It only shows the input box, not "Name: " in front of it.</p> <p>Thanks!</p> <p>This is what print_r($_POST) is returning (I have other form fields in there):</p> <pre><code> Post: Array ( [custsubmit] =&gt; Submit [contact] =&gt; Array ( [0] =&gt; Array ( [id] =&gt; [name] =&gt; name1 ) [1] =&gt; Array ( [id] =&gt; [name] =&gt; name2 ) [2] =&gt; Array ( [id] =&gt; [name] =&gt; name3 ) ) ) </code></pre>
javascript jquery
[3, 5]
5,948,456
5,948,457
jQuery -hot key combinations
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6655335/how-can-i-check-with-jquery-if-a-certain-word-is-typed-in-the-browser">How can I check with JQuery, if a certain word is typed in the Browser?</a> </p> </blockquote> <p>Ok, I have found this great plugin in order to capture and execute hot key commands for jQuery. <a href="http://plugins.jquery.com/project/hotkeys" rel="nofollow">http://plugins.jquery.com/project/hotkeys</a></p> <p>My question before I get too involved in this is that I noticed the "+" between the keys. I was looking for something that would capture what the user enters after typing a string. </p> <p>the goal is to call a function that will show quick data on a "job" that is stored in the database. For example: (all of this is key stroked not holding down the combination)</p> <p>If the user types this combination: c v l </p> <p>then a function is called to listen for the next command. The user then types: 1 2 3 </p> <p>this would then fire another function to find job: 123 from the database. </p> <p>Basically I am looking for an idea on how this might be possible. If anyone has any idea or if I need to provide more details please let me know. Thanks!</p>
php jquery
[2, 5]
3,540,148
3,540,149
What number does 8e3 evaluate to?
<p>I encountered this code today:</p> <pre><code>b = setTimeout(function () { // do some javascript stuff here }, 8e3) </code></pre> <p>The timeout is set to <code>8e3</code>. What time does this equate to in milliseconds, and why would anyone choose this strange notation? The code appears to be fully functional.</p>
javascript jquery
[3, 5]
4,983,607
4,983,608
Selecting radial button according to its value jQuery / Javascript
<p>what im trying to achieve might be very simple but im stuck. Im tiring to select few radial buttons dynamically with its values by retrieving it from an object when the page loads. Here is what im trying:</p> <pre><code>var t_info = obj.tinfo; var h_info = obj.hinfo; $('input[value='+ t_info +']').attr('checked', 'checked'); $('input[value='+ t_info +']').change(); $('input[value='+ h_info +']').attr('checked', 'checked'); $('input[value='+ h_info +']').change(); </code></pre> <p>none of the radial buttons get selected on page load. </p>
javascript jquery
[3, 5]
3,293,675
3,293,676
Adding different classed through looping
<p>I have a number of <code>li</code> elements, and I need to a class to the 1st, 4th and 7th, the 2nd, 5th and 8th, and the 3rd, 6th and 9th.</p> <p>Can this be done?</p>
javascript jquery
[3, 5]
2,750,077
2,750,078
jQuery add id to an element that is being appended to the body
<p>I have the following function:</p> <pre><code>simpleModal: function (data, id) { var responseHtml = data; // Append the modal HTML to the DOM var modalInstance = $('body').append(modalHtml); $(modalInstance).attr('id', id); $(id).find('.uiModalContent').width(480); $(id).find('.uiModalContent').height(320); // Hide the modal straight away, center it, and then fade it in $(id).find('.uiModal').hide().center().fadeIn(); // Dynamically load in the passed data from the call $(id).find('.uiModalContent').html($(responseHtml)); $(id).find('.uiModalContent').removeClass('loading'); $(id).find('.ModalClose').live('click', function (e) { e.preventDefault(); $(this).parents('.uiModal').fadeOut(function () { $(this).parents('.uiModalWrapper').remove() }); }); }, </code></pre> <p>when called like:</p> <p><code>uiModal.simpleModal('&lt;p&gt;An error has occured&lt;/p&gt;','TestError');</code></p> <p>it should append the modal to the body with the passed content and give the modalHtml an id that is also passed. However it gets confused to appends the id to the body instead of the html. How do I get around this? Thanks</p>
javascript jquery
[3, 5]
2,749,879
2,749,880
Change text on link while loading
<p>I have a asp button that while processing i would like the text on it.. How could achieve that?</p> <pre><code>&lt;asp:LinkButton ID="loadImages" runat="server" CssClass="button" onclick="loadImages_Click"&gt;Load Images&lt;/asp:LinkButton&gt; </code></pre> <p>So when I click, it will change the Load Images to Loading... and then go back to the original state once it finishes.</p> <p>I would appreciate any ideas.</p>
c# asp.net
[0, 9]
6,018,437
6,018,438
Check window's width function in resize()
<p>I want to check window's width in user visit url and if browser resize then do it again.<p> <br> Q1. If I only call the function <code>setcolamt()</code> in <code>resize()</code> it won't do anything <code>colmat</code>'s value same as before, I don't know why? I have to pull all code again just like the <code>comment</code> then <code>colmat</code> will be change.</p> <p>Q2. Why is <code>alert()</code> in <code>resize()</code> it will pop up 3 times? <br><p> Any suggestion will be appreciated.<p></p> <p><a href="http://jsfiddle.net/86TDM/2/" rel="nofollow">jsfiddle</a></p> <pre><code>var colamt=0; var winwid = $(window).width(); function setcolamt(){ if(winwid &gt; 800){ colamt = 8; } else{ colamt = 4; } }; setcolamt(); alert(colamt); $(window).resize(function(){ //var colamt=0; //var winwid = $(window).width(); //function setcolamt(){ //if(winwid &gt; 800){ // colamt = 8; //} //else{ // colamt = 4; //} //}; setcolamt(); alert(colamt); }); </code></pre> <p>​</p>
javascript jquery
[3, 5]
1,824,711
1,824,712
Validation summary not showing
<p>Why my validation summary not show after i click ligin button in my login control. It supposed to show an error message if i leave it blank in username n password box right? Can you guys tell me what should i do? Im using a master page. Thank you.</p> <pre><code> &lt;asp:Login ID="Login1" runat="server" BackColor="#F7F7DE" BorderColor="#CCCC99" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="10pt"&gt; &lt;TitleTextStyle BackColor="#6B696B" Font-Bold="True" ForeColor="#FFFFFF" /&gt; &lt;/asp:Login&gt; &lt;/p&gt; &lt;asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="Login1" /&gt; </code></pre>
c# asp.net
[0, 9]
5,381,309
5,381,310
How to get checkbox preference value?
<p>I have checkbox in preferences. I want to keep screen on if checkbox is checked and not to keep screen on if checkbox is not checked.</p> <p>I want something like this:</p> <pre><code>boolean keepScreen = sharedPrefs.getBoolean("chck_screen", false); if (keepScreen.equals(false)) { getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); } </code></pre> <p>Please, help.</p>
java android
[1, 4]
763,606
763,607
How can I use a JavaScript file in my ASP.NET project?
<p>I want to use a JavaScript file, lying in the root folder. How can I include that JS file?</p>
asp.net javascript
[9, 3]
273,283
273,284
How can i extract the data that required from web page
<p>Hi all as per the requirement i am having i would like to extract the data from this site</p> <p><a href="http://loving1.tea.state.tx.us/lonestar/Menu_dist.aspx?parameter=101902" rel="nofollow">http://loving1.tea.state.tx.us/lonestar/Menu_dist.aspx?parameter=101902</a></p> <p>I would like to extract the data that was presented in grid how can i can any one help me</p> <p>I tried this</p> <pre><code>WebRequest request = WebRequest.Create("http://loving1.tea.state.tx.us/lonestar/Menu_dist.aspx?parameter=101902"); WebResponse response = request.GetResponse(); Stream data = response.GetResponseStream(); string html = String.Empty; using (StreamReader sr = new StreamReader(data)) { html = sr.ReadToEnd(); } </code></pre> <p><img src="http://i.stack.imgur.com/6ue2x.jpg" alt="enter image description here"></p> <p>The gird data i would like to extract is in the image. Please help</p>
c# asp.net
[0, 9]
1,700,591
1,700,592
Add image to LinkButton programmatically
<p>I want to insert an image to a LinkButton programmatically like the following aspx code:</p> <pre><code> &lt;asp:LinkButton runat="server" &gt;&lt;img src="NewImages/tick.jpg" runat= "server" /&gt;&lt;/asp:Linkbutton&gt; </code></pre> <p>I am trying the following code:</p> <pre><code> LinkButton bb = (System.Web.UI.WebControls.LinkButton)pagerTable.Rows[0].Cells[0].Controls[0]; bb.Attributes.Add("img", "NewImages/tick.jpg"); </code></pre> <p>P.S PLease do not tell me to use an ImageButton :). There is a reason using this</p>
c# asp.net
[0, 9]
4,053,729
4,053,730
JQuery blockUI and ASP.Net?
<p>Well im using jQuery and blockUI in asp.net i love jquery and blockUI but i found a problem when displaying a panel with a asp.net button in them the actual button is moved out of the <strong>form</strong> tag, so when you click the button nothing happens..</p> <p>is there any way to configure blockUI to place its content tags last in the forms tag instead in the body tag!</p>
jquery asp.net
[5, 9]
898,374
898,375
How to in case of timeout to execute method again and again until it completes successfully?
<p>I have asp.net application. All business logic in business layer.</p> <p>Here is the example of the method</p> <pre><code>public void DoSomething() { PersonClass pc = new PersonClass(); pc.CreatePerson(); pc.AssignBasicTask(); pc.ChangePersonsStatus(); pc.CreateDefaultSettings(); } </code></pre> <p>what happens once in a while, one of the sub method can timeout, so as a result the process can be incompleted.</p> <p>what I think in this case to make sure all steps completed properly is </p> <pre><code>public void DoSomething() { PersonClass pc = new PersonClass(); var error = null; error = pc.CreatePerson(); if(error != timeout exception) error = pc.AssignBasicTask(); else return to step above if(error != timeout exception) error = pc.ChangePersonsStatus(); else return to step above if(error != timeout exception) error = pc.CreateDefaultSettings(); else return to step above } </code></pre> <p>but it's just an idea, more then sure it's a proper way how to handle this.</p>
c# asp.net
[0, 9]
2,501,011
2,501,012
How to determine which page opened a class in another project?
<p>I use a separate project for my data layer and call one class within it clsData.cs. I'd like to know which page from the Presentation Layer (in another project within the solution) has referenced it from the clsData side, if that's possible</p>
c# asp.net
[0, 9]
2,875,372
2,875,373
replace.() does not work. Jquery
<p>I simply try to use the <code>.replace()</code> Jquery function. And it does not work.</p> <p>html: </p> <pre><code>&lt;div class="try"&gt; &lt;/div&gt; </code></pre> <p>js:</p> <pre><code>var valr='r'; valr.replace('r', 't'); $('.try').prepend('&lt;div&gt; ' + valr + '&lt;/div&gt;'); </code></pre> <p>Result: I get 'r', while I would like to get 't'</p> <p>Any idea on why it doesn't work?</p> <p>Thank you.</p>
javascript jquery
[3, 5]
2,726,207
2,726,208
Multiple js with (document).ready(function()
<p>I have on my page a search system , a slideshow and a carousel running with js, but the carousel doesn't run :</p> <p>The search begins with :</p> <pre><code>$('document').ready( function() { $("#search_query_top") </code></pre> <p>The slideshow begins with : </p> <pre><code>$(window).load(function() { init_slideshow() }) </code></pre> <p>The carousel begins with :</p> <pre><code>jQuery(document).ready(function() { $("ul.carruselhome").simplecarousel({ </code></pre> <p>The problem, I think is here :</p> <pre><code>$('document').ready( function() </code></pre> <p>When I disable the line from the search system :</p> <pre><code>$('document').ready( function() ; //the carousel works... </code></pre> <p>I tried to change the ready syntax on the carousel script , but nothing happens, I want to fix that only in the carousel script .<br> The ('document') doesn't affect anything.<br></p>
javascript jquery
[3, 5]
1,941,534
1,941,535
Handling page-specific JavaScript in PHP header files
<p>When designing a website in PHP, you typically have a <code>header.php</code> file that you include in every page on the site. The <code>header.php</code> file would include the <code>&lt;head&gt;</code> tag (among other things). However, I often find that I need to put page-specific JavaScript within the <code>&lt;head&gt;</code> tag.</p> <p>The way I've handled this in the past is by adding IF statements to my header to determine what pieces of JavaScript should be outputted (i.e. IF this is the <em>home</em> page, output the JavaScript needed for the <em>home</em> page, IF this is the <em>about</em> page, output the JavaScript needed for the <em>about</em> page, etc.).</p> <p>This is probably a terrible way to do it. What is the standard practice?</p>
php javascript
[2, 3]
2,739,508
2,739,509
How to grab an image tag from html via jquery
<p>So I have a data set that is returning something like this in the variable entry.content:</p> <pre><code>&lt;p style="float:right;margin:0 0 10px 15px;width:240px"&gt; &lt;img src="http://citysportsblog.com/wp-content/uploads/2011/09/RagnarNE.jpg" width="240"&gt; &lt;/p&gt;&lt;p&gt;Have you heard of the epic adventure that is the&lt;/p&gt; </code></pre> <p>How would i just grab the img src url from this via jquery?</p>
javascript jquery
[3, 5]
1,607,424
1,607,425
Set Activity title ellipse to middle?
<p>I have an Activity whose title keeps change, but sometimes its long and get ellipses by end. Can I set ellipse to middle ?</p>
java android
[1, 4]
2,625,432
2,625,433
Jquery accessing divs problem
<pre><code>$('div#searchResult &gt; div#searchResultItem &gt; div#item').hover(function() { alert($(this).text()); }); </code></pre> <p>Hi guys. Im doing a quick application on what i have learned on a tutorial site for jquery. I think of other ways on applying the functionality and came up with this code. The problem is I can't access the #item div content. Any help would be highly appreciated. Thanks and more power to stackoverflow guys. Cheers!</p> <pre><code>&lt;div id="searchResult"&gt; &lt;div id="searchResultItem"&gt; &lt;div id="item"&gt;Some item&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
2,209,851
2,209,852
Java webpage from a java class or method
<p>Say I have a java class with a method in that class which returns an integer. Now I want to have a webpage (Eg. HTML page) which would access this class and then method and display the result. </p> <p>how do I do this? What do i learn to do it? first of all what's this called? servlet? applet? what?</p> <p>Sorry. I know basic java.. but new to this thing...</p>
java javascript
[1, 3]
2,347,338
2,347,339
Merge and bind two lists to a gridview
<p>I have two list of different objects :</p> <pre><code>List&lt;Report&gt; List&lt;Newsletter&gt; </code></pre> <p>each having a 'created date' property. I need to sort the created date of both lists in descending order and bind it to a gridview. </p> <p>How can this be done, as i can provide only one datasource? </p>
c# asp.net
[0, 9]
4,566,833
4,566,834
How to run an array of function inside an array variable
<p>I'm trying to run series of functions i placed on a variable. </p> <p>Here's a (<strong><a href="http://jsfiddle.net/fGaHR/5/" rel="nofollow">demo</a></strong>)</p> <p><strong>Code:</strong></p> <pre><code>function pass_me(x) { alert(x); }; var colors = new Array(); var colors = ["pass_me('yellow');", "pass_me('green');", "pass_me('blue');"] for(var i = 0; i &lt;= colors.length; i++) { window[colors[i]](); }​ </code></pre> <p>unfortunately, I can't make it run. Any idea what's wrong in my code?</p> <p>Thanks</p> <hr> <p>The story behind the array variable of function, is because i copied it from a dynamic element. This way it will only run what function is already in the page. So if pass_me("red") is not present, it will not be run.</p> <p>Example:</p> <pre><code>&lt;img src="img/something.jpg" ondblclick="pass_me("yellow")" /&gt; &lt;img src="img/something.jpg" ondblclick="pass_me("green")" /&gt; &lt;img src="img/something.jpg" ondblclick="pass_me("blue")" /&gt; </code></pre> <p>then I just use:</p> <pre><code>jQuery("td img").each(function(){ colors.push(jQuery(this).attr("ondblclick")); }) </code></pre>
javascript jquery
[3, 5]
5,307,057
5,307,058
in asp.net how can I dynamically hide one field based off anothers value?
<p>I have 4 asp:Textbox fields on a form. IDs being A1, A2 and B1, B2 for simplicity. If any one of the As or Bs is populated, I need to hide the other one. So I enter something in A1, hide A2, enter something in B2, hide B1.</p> <p>I thought I could use a javascript OnBlur event to do this but it doesn't do anything unfortunately. I'm trying to get the fields to appear/disappear without having to do a postback.</p> <p>Any suggestions or examples would be great.</p> <p>thanks, Q</p>
javascript asp.net
[3, 9]
3,566,269
3,566,270
how to read web page without reading images , scripts , files
<p>how to read a web page without reading or requesting images , scripts , or files that used in web page.</p> <p>I want to do this with C# in a aps.net on a server .</p>
c# asp.net
[0, 9]
2,249,488
2,249,489
How to change javascript code to Jquery?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/10828381/how-to-convert-javascript-code-to-jquery-code">How to convert Javascript code to Jquery code?</a> </p> </blockquote> <p>I need to convert this javascript code to Jquery?</p> <p><code>eval("document.forms[0].strKey" + intDimId).value + "," + tarr[i];</code></p> <p>Can you please help me how to change the above code to jQuery</p> <p>Thanks,</p> <p>Rajasekhar.</p>
javascript jquery
[3, 5]
64,636
64,637
Large amount of database shown on the webform
<p>I have a webform that gets the data from Microsoft Access, I built a dynamic table that has two for loops, lable control and image control. the table contain 4 columns. the problem is the stored database on Access table are too large for showing them on one web page. this is my c# code that was saved on filename.aspx.cs. </p> <pre><code>for (int i = 0; i &lt; ds.Tables[0].Rows.Count; i +=4) { TableRow rw = new TableRow(); for (int j = 0; j &lt; 4; j++) { TableCell tc1 = new TableCell(); if (!(i == ds.Tables[0].Rows.Count - 1 &amp;&amp; ds.Tables[0].Rows.Count % 2 == 1 &amp;&amp; j == 3)) { Label l1 = new Label(); l1.Text = ds.Tables[0].Rows[i + j]["Activite"].ToString(); l1.Font.Bold = true; Image m1 = new Image(); m1.ImageUrl = ds.Tables[0].Rows[i + j]["Photo"].ToString(); tc1.Controls.Add(l1); tc1.Controls.Add(m1); rw.Cells.Add(tc1); } } Table1.Rows.Add(rw); } </code></pre> <p>Luckily it was shown successfully on the webpage without any issues however I didn't manage to write a c# code that can do move from page'hyperlink' to page'hyperlink' with specific amount of database. (What I tried to do is: if the cells % 8 == 0 then the following database should be stored on the second hyperlink in my case its text is "2" in other words displaying only 8 cells on one hyperlink that its navigateurl is filename.aspx each cell contain lable as well as an image. does the solution makes sense? I was asked to not use controls nor DataGrid.</p>
c# asp.net
[0, 9]
4,102,577
4,102,578
echo javascript funtion with php variables as arguments
<p>In test.php:</p> <pre><code>&lt;?php $result = "test"; echo '&lt;script type="text/javascript"&gt;parent.showThanksDiv(\"&lt;?php echo $result;?&gt;\");&lt;/script&gt;'; ?&gt; </code></pre> <p>and in test.html</p> <pre><code> &lt;script type="text/javascript"&gt; function showThanksDiv(text){ document.getElementById("myThanksDivtext").value = text; } &lt;/script&gt; </code></pre> <p>That's not working. It seams Im not passing php variables correctly. Any ideas?</p>
php javascript
[2, 3]
4,533,484
4,533,485
What is Control's DesignMode property and how to use it?
<p><br> what is DesignMode property? When it is useful? I don't understand it from msdn definition <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.designmode.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.web.ui.control.designmode.aspx</a></p> <p>Some example? Thanks for answer.</p>
c# asp.net
[0, 9]
828,007
828,008
Accesing the id attribute of the select tag from jquery
<p>I am looking for a way to access the id attribute of the select tag from jquery.</p> <p>say i have a select tag on the form : form.php</p> <pre><code>&lt;select id="testid"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;/select&gt; </code></pre> <p>from jquery I can access the option value as <code>$(this).attr("value")</code>. But <code>$(this).attr("id")</code> gets undefined.</p> <p>By giving the option tag some id attribute values it works. But, is there a way around to access the id of the select tag thru <code>$(this)</code> object</p> <p>Thanks for any help</p>
php jquery
[2, 5]
4,578,213
4,578,214
Data underlyng e GridView
<p>I have a GridView. At event _RowDataBound I need take the underlying value from every single Field (ex let immagine FirstName), apply some logic to it, and display the field modify to a Textbox.</p> <p>My problem is I do not the syntax to get the values connected with the e.Row.DataItmem for a single row.</p> <p>Any idea how to do it? Please provide me an example of code. I posted this question in past but without understanding the answer. Thanks</p> <pre><code>switch (e.Row.RowType) { // In case type of row is DataRow (a data row of GridView) case DataControlRowType.DataRow: // What I add here? break; } </code></pre>
c# asp.net
[0, 9]
2,831,246
2,831,247
How to get the link dynamicallY?
<p>I have one problem.I have some directories which contain text files.I have read the full path of the directory and got the last one which contain the text file.Now I have dynamically ctreated the link to this directories and displayed them on the page.Now my problem is how to fetch the data from the text file contained inside the folder? As the buttonlink which I have created is dynamic I cannot handle the event on it.. So can anybody help me sort out this problem?</p> <p>Thanking Each 1 of you,</p> <p>Swapnil</p>
c# asp.net
[0, 9]
2,451,369
2,451,370
How to add caption and sum a column?
<p>i want give caption DATE,PRICE1, PRICE2 and i also show sum of price1, price2 in the footer. how can i do this? </p> <pre><code>&lt;asp:Repeater ID="rptCari" runat="server"&gt; &lt;ItemTemplate&gt; &lt;div&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label runat="server" ID="lblBelgeTarihi"&gt;&lt;%#(Eval("DATE","{0:d}"))%&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/td&gt; &lt;td&gt; &lt;asp:Label runat="server" ID="lblAlacakTutar"&gt;&lt;%#ValidationHelper.FormatPrice(ValidationHelper.GetDecimal(Eval("PRICE1"), 0))%&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;td&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;/td&gt; &lt;td&gt; &lt;asp:Label runat="server" ID="lblBorcTutar"&gt;&lt;%#ValidationHelper.FormatPrice(ValidationHelper.GetDecimal(Eval("PRICE2"), 0))%&gt;&lt;/asp:Label&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre>
c# asp.net
[0, 9]
2,687,336
2,687,337
Preload php dynamic images
<p>I have a php file that generates images (it puts an watermark on images) called image.php that receives and id <a href="http://localhost/image.php?id=1" rel="nofollow">http://localhost/image.php?id=1</a>. </p> <p>Does anybody know of a way to preload this images using javascript / jQuery?</p> <p>I tried the normal suggestions of image preloading but hey dont seem to work. I'm thinking its because the name of the file is always the same.</p> <p><strong>Update:</strong></p> <p>I'm using <a href="http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript" rel="nofollow">this</a> approach to preload the images (a simple jquery function that creates img elements) </p> <p>One caveat (probably an important one so I should have stated it up front) its that I'm using the images as a background through css.</p> <p>I see that the images are fetch in Firebug. but as I try to define then as a background of a div they get fetch again. I cannot reuse the actual element but I'm under the impression that the browser caching should not fetch then again.</p> <p>Thanks again for any insight</p>
php javascript jquery
[2, 3, 5]
362,358
362,359
Changing the title of a link in jQuery
<p>I have a link with id "helpTopicAnchorId".</p> <p>I want to change its text in jQuery.</p> <p>How do I do this?</p>
javascript jquery
[3, 5]
1,144,326
1,144,327
Positioning of elements
<p>In my web app I have a line which looks like this:</p> <pre><code>small textbox large textbox select list </code></pre> <p>I have a method which is boolean. If it returns false, I need to make the upper line look like this:</p> <pre><code>small textbox select list large textbox </code></pre> <p>Basically, I need to add a second line with the large textbox.</p> <p>How to do this?</p> <p>Here is some code:</p> <pre><code>&lt;div&gt; &lt;input style="width:25px; top:0px; left:0px; margin:0px; background:white;" type="text" /&gt; &lt;input style="width:100%; top:0px; left:150px; margin:0px; background:white; float:left;" /&gt; &lt;select style="width:60px;"&gt; &lt;option value="0"&gt;a&lt;/option&gt; &lt;option value="1"&gt;b&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
4,580,369
4,580,370
Trouble with Web Deployment Project?
<p>I made an msi of the web application.When i deploy on the server its working perfectly fine.But for some reason its creating the App_Data folder with two files.i don't know why its getting created automatically ?Did any one face such situation ?</p>
c# asp.net
[0, 9]
3,120,962
3,120,963
Fade effect with timer?
<p>How to set a timer for a fade effect? Say text1 will fade out in 5 seconds, then text2 will appear, then it will fade out after 5 seconds, then text3 will appear. I'm not knowledgeable in jQuery. </p> <p>Say I have 3 texts:</p> <pre><code>&lt;div class= "text1&gt;Text 1&lt;/div&gt; &lt;div class= "text1&gt;Text 2&lt;/div&gt; &lt;div class= "text1&gt;Text 3&lt;/div&gt; </code></pre> <p>I have only this:</p> <pre><code>$(".text1").fadeOut(5000); //now that a timers. </code></pre>
javascript jquery
[3, 5]
2,266,569
2,266,570
How to append check box in jquery
<p>How I add checkbox after span in below code.</p> <pre><code>var aaa = $('&lt;a/&gt;') .html("&lt;span&gt;" "&lt;/span &gt;" + " &lt;span&gt;""&lt;/span&gt; ") .attr('data-transition', 'slide') .appendTo(li); </code></pre>
javascript jquery
[3, 5]
1,173,242
1,173,243
How to call jquery function in a class file
<p>Hi all I have created a javascript which I want to use in my entire application, so I have created a class which returns string as follows</p> <pre><code> public static string ShowAlert(string pHeader, string pMessage) { StringBuilder sb = new StringBuilder(); sb.Append("&lt;script language='JavaScript' type='text/javascript'&gt;"); sb.Append("example1('" + pHeader + "','" + pMessage + "')"); sb.Append("&lt;/Script"); return sb.ToString(); } </code></pre> <p>This is my code <code>JFunction.JS</code></p> <pre><code>(function example1(title, content) { $.msgBox({ title: title, content: content }); }) </code></pre> <p>Now on button click I am just calling as follows </p> <p><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "",ShowAlert(pHeader,pMessage) , true);</code></p> <p>But I am unable to get the message, so is there any way to create a unique method instead of calling the script on each page,</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
2,965,403
2,965,404
JavaScript Closures and Memory Leaks
<p>I read in Jquery in Action that memory leaks can result from javascript closures.</p> <p>"Unintended closures can have unintended consequences. For example, circular references can lead to memory leaks. A classic example of this is the creation of DOM elements that refer back to closure variables, preventing those variables from being reclaimed."</p> <p>could somebody give an example of this?</p> <p>thank you!</p>
javascript jquery
[3, 5]
2,477,196
2,477,197
How to change the name of the image that is being uploaded?
<p>I want to change the name of the image in file uploader using jquery.is there any chance to do that please let me know.I am struggling with that.</p> <p>I am using the regular html file uploader</p> <p></p> <p>Thanks, Sravz</p>
javascript jquery
[3, 5]
1,479,475
1,479,476
Passing variables to a PHP file through jQuery
<p>Really not familiar with jQuery. Is there anyway I can pass form data to a PHP file using jQuery?</p> <p>FORM:</p> <pre><code>&lt;div id="dialog-form" title="Fill in your details!"&gt; &lt;form&gt; &lt;fieldset&gt; &lt;label for="name"&gt;Name&lt;/label&gt; &lt;input type="text" name="name" id="name"/&gt; &lt;label for="email"&gt;Email&lt;/label&gt; &lt;input type="text" name="email" id="email" value=""/&gt; &lt;label for="phone"&gt;Phone&lt;/label&gt; &lt;input type="phone" name="phone" id="phone" value=""/&gt; &lt;/fieldset&gt; &lt;/form&gt; </code></pre> <p></p> <p>It's a pop-up dialog with jQuery and gets submitted with:</p> <pre><code>$("#dialog-form").dialog({ autoOpen: false, height: 450, width: 350, modal: true, buttons: { "Sumbit": function() { //VALIDATES FORM INFO, IF CORRECT if (Valid) { $.ajax({ url: 'process-form.php', success: function (response) { //response is value returned from php $("#dialog-success").dialog({ modal: true, buttons: { Ok: function() { $(this).dialog("close"); } } }); } }); $(this).dialog("close"); } } } }); </code></pre> <p>What I want to do is to send the form data that the user enters into <code>process-form.php</code>, where it will be processed and sent as an email (which I can do). Just not to sure on the jQuery side of things. Is it even possible?</p>
php jquery
[2, 5]
2,029,825
2,029,826
Force download file with jquery and asp.net server side function call
<p>i have one image and i was just trying to show save as dialog box for downloading that image by jquery ajax call. when some one will click on button then a client side code run and here code as follows</p> <pre><code>$("#btnSaveAsImage").click(function () { if (_TrackNumber == '') { alert('Track Number is not valid'); return; } var fname = _TrackNumber + '.gif'; var DTO = { FileName: fname }; jQuery.ajax({ type: "POST", url: "UPSLabelFormUK.aspx/SaveAs", data: JSON.stringify(DTO), contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { var retVal = data.d; alert(retVal); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); return false; }); </code></pre> <p>and this client side code actually call my server side function. the server side function look like</p> <pre><code>[WebMethod] public static void SaveAs(string FileName) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.WriteFile(HttpContext.Current.Server.MapPath(@"~/UPS_New/LabelImages/" + FileName)); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close(); } </code></pre> <p>when server side function execution end then jsuery show a error message like parse error. i just do not understand why the error comes and why save as dialog is not coming......any idea please share with me. thanks</p>
jquery asp.net
[5, 9]
3,803,942
3,803,943
JQuery - Javascript - .hasData() not working for me
<p>I am trying to check if an object with class sourceFocus has data in it. However when I check it, it does not have data when it should. What am I doing wrong here?</p> <pre><code>$('.source').click(function() { $('.source').removeClass('sourceFocus'); $(this).addClass('sourceFocus'); $(this).data('source_selected', true); console.log($.hasData(this)); console.log(this); }); $('.target').click(function() { $('.target').removeClass('targetFocus'); $(this).addClass('targetFocus'); $(this).data('target_used', true); //$('.sourceFocus').data('source_used', true); console.log($.hasData('.sourceFocus')); if($.hasData('.sourceFocus')){ console.log("has data worked"); check_for_duplicates(); } </code></pre>
javascript jquery
[3, 5]
1,336,906
1,336,907
Get jquery formatted value
<p>I have a div like this : </p> <pre><code>&lt;td id="length" data-length=&lt;?php echo $length;?&gt; &gt; </code></pre> <p>And I want to get the value of my php variable ($length) in a jquery script.</p> <p>After that I have to format it to replace the comma with point.</p> <p>With this snippet : </p> <pre><code>var $length = jQuery(this).find("#length"); console.log($length.data('length')); </code></pre> <p>I see read my variable in the console</p> <p>but when I want to format it to replace the comma with a point like this :</p> <pre><code>console.log(parseFloat($length.val().replace(",", "."))); </code></pre> <p>I get NaN</p> <p>Please help to solve that problem !</p>
javascript jquery
[3, 5]
4,823,568
4,823,569
Getting reference to form with no id or name
<p>I am working on a project where I need to recall the fields entered in a form so I can repopulate them later. When a form has a name, I can remember it and then later use some JavaScript (document.getElementsByName(...)[0]) to access it. However, if there is no name...I'm at a loss for how to get a reference to it later.</p> <p>I'm using jQuery, but am open to a JavaScript solution as well. One idea is to remember the index of the form. So, if it was document.forms[3] then later I can use the index. However, when someone submits a form, how do I know the index of the form that it is? (NOTE: I am blindly adding submit handlers to all forms when a page loads to capture the activity.)</p>
javascript jquery
[3, 5]
305,054
305,055
opacity in jQuery
<p>I want to make the opacity black ( if possible )</p> <p>My jQuery is:</p> <pre><code>jQuery('#list a[rel^="myPhoto"]').my422PortfolioThumbsHover({ defaultOpacity: 1, onMouseOverOpacity: 0.6, speed: 300, zoomImg: 'zoom.png' }); </code></pre> <p>I tried adding:</p> <p>background-color: #000000, into the above code... but doesnt wanna play.</p> <p>Also thought hmm, perhaps I need to wrap the hex color in ' and ' but again zilch ...</p> <p>Then wondered if I am just going MAD lol</p> <p>As it is it whitens opacity on hover to 60% , I need that opacity to be 60% but blackened not whitened.</p>
javascript jquery
[3, 5]
3,965,233
3,965,234
I need to fill text field programatically in a web page opened inside a WebView. How To?
<p>I have created a WebView and opened up a web page in it that contains a form. I need to fill that form programmatically (need to get some data form sqlite database and fill it). </p> <p>how i can do that ? can anyone please help me out.</p> <p>EDIT : the web page is a sign-up form and i do not own that web page.. i cannot add java script into that page.</p>
java android
[1, 4]
2,864,550
2,864,551
Using Alert in Response.Write Function in ASP.NET
<p>I have database code like this </p> <pre><code>try { string strConnectionString = ConfigurationManager.ConnectionStrings["SqlServerCstr"].ConnectionString; SqlConnection myConnection = new SqlConnection(strConnectionString); myConnection.Open(); string hesap = Label1.Text; string musteriadi = DropDownList1.SelectedItem.Value; string avukat = DropDownList2.SelectedItem.Value; SqlCommand cmd = new SqlCommand("INSERT INTO AVUKAT VALUES (@MUSTERI, @AVUKAT, @HESAP)", myConnection); cmd.Parameters.AddWithValue("@HESAP", hesap); cmd.Parameters.AddWithValue("@MUSTERI", musteriadi); cmd.Parameters.AddWithValue("@AVUKAT", avukat); cmd.Connection = myConnection; SqlDataReader dr = cmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); Response.Redirect(Request.Url.ToString()); myConnection.Close(); } catch (Exception) { Response.Write("&lt;h2&gt;ERROR&lt;/h2&gt;"); } </code></pre> <p>It works fine but what I want, in the catch function, is to call the javascript alert function.</p> <p>I've tried this</p> <pre><code>Response.Write("&lt;script language=javascript&gt;alert('ERROR');&lt;/script&gt;); </code></pre> <p>But there is an error <img src="http://i.stack.imgur.com/eW7g6.jpg" alt="enter image description here"></p> <p>How can I show error message in <code>javascript</code> <code>alert</code> function?</p>
c# javascript asp.net
[0, 3, 9]
5,223,473
5,223,474
jQuery function when one list item has the active class, I want all other list items to automatically not have the active class ?
<p>My webpage is at <a href="http://www.sarahjanetrading.com/js/status" rel="nofollow">http://www.sarahjanetrading.com/js/status</a></p> <p>All the HTML, CSS and jQuery code + images are available there for anyone to access.</p> <p>My issue is that currently the jQuery code I have only makes the active states toggle in the list items. What I want is that one list item becomes active(active class) when clicked, all others must have the active class removed.</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,314,452
5,314,453
List iterator causes heap allocations?
<p>I'm profiling my android game and surprised to see that:</p> <pre><code>for(O o : myArrayList) { } </code></pre> <p>Creates a bunch of heap allocations.</p> <p>Aside from using a numeric <code>i++</code> for loop, is there a better way to get around this problem? Can I preallocate my iterators or something?</p>
java android
[1, 4]
2,892,335
2,892,336
Update the database asynchronously
<p>I have a ListView in ASP.NET where one column consists checkBoxes. I want the user to be able to these CheckBoxes directly in the list (without having to go into edit mode). How I do that, I have received answers in <a href="http://stackoverflow.com/questions/5983132/get-database-id-from-a-row-in-listview-in-asp-net">this question</a></p> <p>The problem is when the user quickly press several CheckBoxes. It is only the first checkBox that is stored in the database, the other is restored. The user must for every checkBox, wait for the page updated. Is it posible to solve so that the changes are written to the database asynchronously?</p>
c# asp.net
[0, 9]
3,102,307
3,102,308
Create Google Image effect
<p>I am trying to create images effect just like when you search on Google images engine (like <a href="https://www.google.com/search?num=10&amp;hl=en&amp;site=imghp&amp;tbm=isch&amp;source=hp&amp;biw=1280&amp;bih=866&amp;q=seattle&amp;oq=seattle&amp;gs_l=img.3..0l2j0i3j0l7.959.2209.0.2359.7.5.0.2.2.0.141.538.1j4.5.0...0.0...1ac.gLlJ8Yvr-wg#hl=en&amp;site=imghp&amp;tbm=isch&amp;sa=1&amp;q=chicago&amp;oq=chicago&amp;gs_l=img.3..0l2j0i3j0l7.3578.4412.0.4651.7.5.0.2.2.0.215.833.0j4j1.5.0...0.0...1c.mZz0xuK7XgQ&amp;pbx=1&amp;bav=on.2,or.r_gc.r_pw.r_qf.&amp;fp=7ace7fd76d1e599e&amp;biw=1280&amp;bih=866" rel="nofollow">this</a>). I need to popup the image when user mouse over it and show the image info. Are there any plugins for this or I have to start from the scratch? Thanks a lot!</p>
javascript jquery
[3, 5]
5,869,786
5,869,787
PHP array to echo javascript array that I can access?
<p>I have a php array called $user.</p> <p>At the minute I am getting the variables across to javascript by manually adding them like so.</p> <pre><code>var username = ' . $user['username'] . '; </code></pre> <p>And so on is there a way I can make php echo a javascript array that I can access?</p>
php javascript
[2, 3]
4,743,410
4,743,411
How to make drop down menu enable with only one value
<p>I have a drop down menu that retrieved ID from database and four labels. From the user id, the labels will display data that belongs to the ID. In my case, the ID only has 1 value which it makes the auto post back not refresh the page. Is there any ways to make the labels show the data?</p> <pre><code> &lt;asp:DropDownList ID="DropDownList5" runat="server" DataSourceID="SqlDataSource3" DataTextField="Id" DataValueField="Id" Height="16px" Width="145px" AutoPostBack="True" onselectedindexchanged="DropDownList5_SelectedIndexChanged"&gt; &lt;/asp:DropDownList&gt; &lt;asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="&lt;%$ ConnectionStrings:Connection %&gt;" SelectCommand="SELECT [Id] FROM [Rsvp] WHERE (([Model] = @Model) AND ([Username] = @Username))"&gt; &lt;SelectParameters&gt; &lt;asp:ControlParameter ControlID="DropDownList2" Name="Model" PropertyName="SelectedValue" Type="String" /&gt; &lt;asp:ControlParameter ControlID="DropDownList3" Name="Username" PropertyName="SelectedValue" Type="String" /&gt; &lt;/SelectParameters&gt; &lt;/asp:SqlDataSource&gt; </code></pre>
c# asp.net
[0, 9]
3,472,149
3,472,150
accessing one window from another
<p>Say we have got 2 windows:<br /> 1) the main one;<br /> 2) pop uped;</p> <p>Is it possible to change the DOM of the first window after the second window was closed?<br /> <strong>N.B.</strong> In second window(the pop-up) were some redirection(with full page reload).</p> <p><strong>P.S.</strong><br /> <s>I've put rails tag because trying to do it within rails and probably there's some rails-way-solution for this.<br /></s> Sorry for my English and thanks in advanced.</p>
javascript jquery
[3, 5]
4,491,959
4,491,960
Settings Selector Dynamically in JQuery
<p>I have a table whose values are being generated dynamically with PHP, including the id and name attributes (e.g. id="question_".</p> <p>How can I set an element attribute with this in mind? For example, I have a div whose text will change after a successful ajax call, but the id is dynamic. </p> <p>I have tried making the following test function, and calling it on an onclick event:</p> <pre><code>function approve(question_id) { var div = 'suggestion_status_' + question_id; $('#div').html('test'); } </code></pre> <p>But that does not work. How can make the value of variable 'div' the selector?</p>
php jquery
[2, 5]
1,296,380
1,296,381
Creating product relations using PHP/Ajax/jQuery
<p>I'm working on a self-made e-shop CMS and in the backend and I need to be able to create relations between products. When adding a new product I want to be able to open a popup window in which I can select the related products and then, when I close the window, I need the selected items to be sent back to a field on my page (ie comma delimited string with the selected values). It doesnt <em>HAVE</em> to be a popup window, I'll be glad to use any other method as well, as long as it does the above. </p> <p>Which ways can I do this? I know Ajax/jQuery will probably do the trick but I don't have much experience with them. </p>
php javascript jquery
[2, 3, 5]
4,865,640
4,865,641
How to run asp.net application
<p>How to run asp.net application with encrypted web.config ,is it possible note that ASP.NET application have a database with encrypted connectionstring and a "cannot read connection string " message is generated </p>
c# asp.net
[0, 9]
2,306,544
2,306,545
Setting a textbox value by JQuery
<p>I am setting a <code>TextBox</code> controls value via an ajax post.</p> <pre><code>$('#txtSite').val(msg.d.SiteName); </code></pre> <p>This is working and the value of the <code>TextBox</code> is altered correctly. But, when I come to posting the information to the database, the <code>txtSite.Text</code> value is empty!!</p> <p>Any ideas? Am I going mad?</p> <p>Code to populate the <code>TextBox</code>:</p> <pre><code>$.ajax({ type:"POST", url: "MyPage.aspx/ValidateSite", data: "{ siteID: '" + $('#txtSiteID').val() + "' }", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { if (msg.d != null) { $('#txtSite').val(msg.d.SiteName); // It's definitely doing this } else { $('#txtSite').val(''); } }, error: function(msg) { } }); </code></pre> <p>Code to save to the server (all connectivity etc. is correct and working). This code is in an ASP button click event:</p> <pre><code>SqlCommand cmd = new SqlCommand("INSERT INTO [Sites] ([SiteName]) VALUES ('" + txtSite.Text + "')", conn); cmd.ExecuteNonQuery(); </code></pre> <p>The <code>TextBox</code> is defined like so:</p> <pre><code>&lt;asp:TextBox ID="txtSite" runat="server" AutoComplete="off" TabIndex="4" MaxLength="50" Style="width: 230px" Enabled="false" CssClass="FormDisabledTextWithSmallHeight" /&gt; </code></pre> <p>I have also tried changing my JQuery to use plain Javascript instead and doing this:</p> <pre><code>document.getElementById("txtSite").value = msg.d.SiteName; </code></pre> <p>Still returns me an empty value.</p>
jquery asp.net
[5, 9]
4,755,931
4,755,932
section of n number of items from a list
<p>I need to select three li on each click function. I need to hide all lis except first three. And on a click function I need to hide the first three li and need to show the next 3 items. How it is possible?</p>
javascript jquery
[3, 5]
3,159,208
3,159,209
multiple functions in the document.ready function
<p>here's my code:</p> <pre><code>$(document).ready(function () { $('.flip1').click(function () { $('.panel1').slideToggle("slow"); }); $('.flip2').click(function () { $('.panel2').slideToggle("slow"); }); $('.flip3').click(function () { $('.panel3').slideToggle("slow"); }); $('.flip4').click(function () { $('.panel4').slideToggle("slow"); }); }); </code></pre> <p>I want to make a loop with .flip as the variable (flipVar) and .panel as (panelVar)</p>
javascript asp.net jquery
[3, 9, 5]
2,818,937
2,818,938
Display Machine name on a label on master page
<p>I have a label on master page on which I want to display the machine name. I am using this but its not working: </p> <pre><code>&lt;asp:Label ID="Label1" style="font-size: large; color: #009999" runat="server" Text= 'MACHINE NAME IS &lt;%# Environment.MachineName %&gt;' &gt;&lt;/asp:Label&gt; </code></pre> <p>How to correct it?</p>
c# asp.net
[0, 9]
1,575,148
1,575,149
JavaScript to add class not working?
<p>I have the following JS function:</p> <pre><code>function addTopLinks() { $('#calendar .fc-view-resourceNextWeeks thead th .fc-resourceName') .addClass('top-cell'); }; </code></pre> <p>It is not adding the class.</p> <p>I have another:</p> <pre><code>function addDayClass() { $('#calendar .fc-view-resourceNextWeeks thead th') .filter(function () { if ($(this).text().indexOf('Mon ') == 0) return true; return false; }) .addClass('monday'); }; </code></pre> <p>That one works just fine.</p> <p>This is the hierarchy:</p> <p><img src="http://i.stack.imgur.com/t7c7Q.png" alt="enter image description here"> </p> <p>I am really not sure why the first one is working and not this one...</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,800,834
3,800,835
setText("test") is freezing UI
<p>I dont understand</p> <p>I have a background thread which gets cpu load and then set it to text view</p> <p>Problem is when setText() method is executed UI freezes for a second, i can feel it when scrolling through other elements of ui</p> <pre><code>Runnable runnable = new Runnable() { @Override public void run() { while(thread) { try { RandomAccessFile reader = new RandomAccessFile("/proc/stat", "r"); String load = reader.readLine(); String[] toks = load.split(" "); long idle1 = Long.parseLong(toks[5]); long cpu1 = Long.parseLong(toks[2]) + Long.parseLong(toks[3]) + Long.parseLong(toks[4]) + Long.parseLong(toks[6]) + Long.parseLong(toks[7]) + Long.parseLong(toks[8]); try { Thread.sleep(360); } catch (Exception e) { } reader.seek(0); load = reader.readLine(); reader.close(); toks = load.split(" "); long idle2 = Long.parseLong(toks[5]); long cpu2 = Long.parseLong(toks[2]) + Long.parseLong(toks[3]) + Long.parseLong(toks[4]) + Long.parseLong(toks[6]) + Long.parseLong(toks[7]) + Long.parseLong(toks[8]); fLoad = (float)(cpu2 - cpu1) / ((cpu2 + idle2) - (cpu1 + idle1)); } catch (IOException ex) { } final int load =(int) (fLoad*100); try { Thread.sleep(1000); } catch (InterruptedException e) { } mHandler.post(new Runnable() { @Override public void run() { setCpuLoad(load); } }); } } }; new Thread(runnable).start(); } </code></pre> <p>.</p> <pre><code> private final void setCpuLoad(int load){ cpuLoad.setProgress(load); cpuLoadTxt.setText(load+"%"); } </code></pre> <p>I tried a lot of stuff and eventually figure out that problem is in setText() because when i comment it UI is smooth</p>
java android
[1, 4]
195,700
195,701
how to update the every sec in jquery
<p>I am trying to get the data from the php file and update every second so when the information changes in the php file it will auto update </p> <pre><code> $(document).ready(function() { $.ajaxSetup ({ cache: false }); $("#hidden").hide(); $("#textfield").val(""); $("#textarea").val(""); var hol=$(this).attr('myval'); var formContent ="action=getlink&amp;link="+hol; $.getJSON("inc/json.php",formContent, function(json){ $("#textfield").val(json.name); $("#textarea").val(json.desc); $("#formHeader").text("Edit"); $("#ajaxBox").text("All info loaded OK"); }); }); </code></pre>
php jquery
[2, 5]
1,307,778
1,307,779
Jquery to javascript for small device, light code needed
<p>Okay so I'm new to javascript but I can handle jquery quite well... but jquery on a small mobile web experience is realy heavy... some time it's even too mutch.</p> <p>so I have this code that simply pop's up my menu bar and i wondered if there was any light way of geting this?</p> <pre><code>$(function() { $('div.menu').hide(); $("img#menu").click(function () { $("div#menu").toggle("slide", {direction: "right"}, 500); }); }); </code></pre>
javascript jquery
[3, 5]
5,000,574
5,000,575
Problem in using float on Android
<p>I am going to develop a calculator on android platform, it is fine in calculating numbers less than 1000000, when I tried to add 1000000 with 0, the result is "1.0000E7"?! I try to change the type of result from float to double, but the problem is still here, I try to use long, result becomes normal, but it cannot calculate decimal place anymore....</p>
java android
[1, 4]
6,014,317
6,014,318
Foreach loop javascript failing
<p>Why does this each statement cause my code to break? Also do I have to set an index with javascript?</p> <pre><code>var email = []; email['update'] = true; email['e_case_id'] = $("#e_case").val(); var i = 0; $.each($('.rowChecked'), function() { email['e_attachments'][i] = $(this).attr('id'); i++; }); </code></pre>
javascript jquery
[3, 5]