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
4,948,494
4,948,495
Call javascript dynamic method in object
<p>If I create a Class with two method like following:</p> <pre><code>var Car = function() {} Car.prototype = { run: function() { alert('run'); }, stop: function() { alert('stop'); } } </code></pre> <p>And when the DOM is ready will call test() method,<br /> and this test() method will create a instance of Car and call the method of Car</p> <pre><code>$(document).ready(function() { test("run"); }); function test(method) { var instance = new Car(); // call instance.run() } </code></pre> <p>I know I have to use apply() method, <br /> but I have tried lots of times and failed<br /> So, how can I use apply() method in Object?</p>
javascript jquery
[3, 5]
2,219,290
2,219,291
tokeninput jquery plugin - preventDuplicates not working
<p>I am using jquery plugin Tokeninput. I need to prevent user from entering duplicate values, the Js code is as follows:</p> <pre><code>$(document).ready(function () { // Configure Tags $('#Tags').tokenInput(tagSource(), { prePopulate: selectedTags(), theme: "facebook", propertyToSearch: "Code", preventDuplicates: true }); function tagSource() { var data = []; @if (Model.SourceTags != null &amp;&amp; Model.SourceTags.Count() &gt; 0) { &lt;text&gt; data = @(Html.Raw(Model.SourceTags)); &lt;/text&gt; } return data; } function selectedTags() { var selectedData = []; @if (Model.SelectedTags != null &amp;&amp; Model.SelectedTags.Count() &gt; 0) { &lt;text&gt; selectedData = @(Html.Raw(Model.SelectedTags)); &lt;/text&gt; } return selectedData; } }); </code></pre> <p>When I select the same item again, the existing item in the Input field is highlighted and nothing is added. </p> <p>Also, when I select a different item, the first item is highlighted and nothing is added.</p> <p>Any idea?</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,287,566
1,287,567
How to use 'Curl' in php to send data to android
<p>I have a listener in an android application to detect messages sent by the server php</p> <pre><code> public class Threa implements Runnable { public static final String SERVERIP = "192.168.1.4"; public static final int SERVERPORT =6060 ; //4444 public BufferedReader in; public int x=0; public void run() { try { ServerSocket serverSocket = new ServerSocket(SERVERPORT); while (true) { x++; Socket client = serverSocket.accept(); try { in = new BufferedReader(new InputStreamReader(client.getInputStream())); String str = in.readLine(); } catch(Exception e) { } finally { client.close(); } } } catch (Exception e) { } } } </code></pre> <p>I found this code on the Internet</p> <pre><code>function get_url($url) { $ch = curl_init(); if($ch === false) { die('Failed to create curl object'); } $timeout = 5; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); $data = curl_exec($ch); curl_close($ch); return $data; } echo get_url('http://www.apple.com/'); </code></pre> <p>using cURL in php to send the message is correct, if not what is the solution to solve this problem, please give me an idea </p>
php android
[2, 4]
4,276,388
4,276,389
Is there any reason to use the 'return' in the second line in the method ?
<p>I have this code that we can write in two ways </p> <p><strong>First Way</strong></p> <pre><code>void func(int val) { if(val == 0) return; // Do something ... } </code></pre> <p><strong>Second Way</strong></p> <pre><code>void func(int val) { if(val != 0) { // Do something ... } } </code></pre> <p>The Question:</p> <p>Is there any reason to use the first way ? Is there any Advantage to use the first way ( in C++ or in C# ) </p>
c# c++
[0, 6]
118,500
118,501
Convert imageUrl to byte[] for caching
<p>I have an image that I capture from an ip camera and post it on a webpage to an image tag. Now I would like to convert to access the picture so that I can save it to our cache blob. Here is my code:</p> <p>asp tag:</p> <pre><code>&lt;asp:Image ID="imgPhoto" runat="server" ImageAlign="Middle" /&gt; </code></pre> <p>code behind image assignment:</p> <pre><code>imgPhoto.ImageUrl = "http://10.10.40.35/axis-cgi/jpg/image.cgi?resolution=640x480"; </code></pre> <p>my attempt to convert the image to byte[]:</p> <pre><code>System.Drawing.Image _newImage = System.Drawing.Image.FromFile(imgPhoto.ImageUrl); MemoryStream ms = new MemoryStream(); _newImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] _fileBytes = new byte[ms.Length]; </code></pre>
c# asp.net
[0, 9]
5,698,081
5,698,082
Check if value exists in JavaScript object
<p>How would I check in my array of objects, if a specific item exists (in my case MachineId with id 2)?</p> <pre><code>[{"MachineID":"1","SiteID":"20"},{"MachineID":"2","SiteID":"20"},{"MachineID":"3","SiteID":"20"},{"MachineID":"4","SiteID":"20"}] </code></pre> <p>I tried this:</p> <pre><code>if (index instanceof machineIds.MachineID) { alert('value is Array!'); } else { alert('Not an array'); } </code></pre>
javascript jquery
[3, 5]
5,137,332
5,137,333
jquery, undefined variable problem, how to?
<p>i have this situation:</p> <pre><code>&lt;div class="cont_picture"&gt; &lt;?php echo "&lt;a id=\"mine_click\" href=\"#\" &gt;a test&lt;/a&gt;"; ?&gt; &lt;/div&gt; &lt;div id="number"&gt;&lt;?php echo $number; ?&gt;&lt;/div&gt; </code></pre> <p>this will give me something like: <a href="http://www.google.com" rel="nofollow">a test</a> 123456 (<em>the link is as an example only</em>)</p> <p>then i have the jquery:</p> <pre><code>$('#mine_click').live('click', function() { var strtalentnum = $('#number').text(); $('#mine').trigger('click'); }) </code></pre> <p>and;</p> <pre><code>if($strtalentnum){ alert ($strtalentnum); } </code></pre> <p>but the alert doesnt work. </p> <p>Any ideas how to get this working? see <a href="http://jsfiddle.net/qrNtK/" rel="nofollow">jsfiddle</a></p> <p>thanks</p>
php javascript jquery
[2, 3, 5]
4,125,970
4,125,971
How to get date between start date and end date? (excluding date on weekend)
<p>Hi want to get a date list between start date and end date. For example start date is 27-08-2010 and end date is 31-08-2010. So the date list is 27-08-2010,30-08-2010 and 31-08-2010. 29-08-2010 and 30-08-2010 will be ignore because it is in the weekend. I attach the picture for more clearer explanation. How to achieve this using javascript or jquery? I only want to get the list of date, for the business day calculation already done.</p> <p><img src="http://i.stack.imgur.com/vpZrS.jpg" alt="alt text"></p>
javascript jquery
[3, 5]
5,486,407
5,486,408
How to get alerts at client side
<p>I want to set an alert service for my website users for there tasks.</p> <p>These alerts are like Messenger alerts. My web site is in asp.net C#.</p> <p>Here is the scenario I want to set for alerts:</p> <p>I retrieve the alert messages for users through a webservice and I want utility which displays alerts for users at client site.</p> <p>Can anyone help me to sort out the problem?</p>
c# asp.net
[0, 9]
5,152,022
5,152,023
Export to pdf AND generate a pdf file in asp.net
<p>I have to create PDF files in 2 ways:</p> <ul> <li><p>The first way is just to convert the html to PDF. It can be done in server-side or client-side (javascript?). In this case, I'd like to convert the html with all css styles. This is just to user save the page.</p></li> <li><p>The second ways is generate a PDF report file. I'm thinking if its better to generate it using a background desktop application and send the url later, or just do in client-side. This is for big reports.</p></li> </ul> <p>I've never done this before. What do you recommend me to do?</p>
c# asp.net
[0, 9]
2,950,024
2,950,025
$.slideToggle() & $.hover() animation queue issue
<p>I'm trying to set up a pretty basic hover animation in jQuery. Mouse over a div and the major content is slid down, mouse up and it slides up.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { $('.listItem').hover(function () { $(this).find('.errorData').slideToggle('slow'); }); });&lt;/script&gt; </code></pre> <p>This piece of code works fine, but the obvious problem is the animation queuing if you mouse in and out really quickly.</p> <p>To alleviate this I have read that the <code>.stop(true)</code> function placed before the <code>.slideToggle()</code> stops the previous animation and clears the animation queue. So I tried this code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { $('.listItem').hover(function () { $(this).find('.errorData').stop(true).slideToggle('slow'); }); });&lt;/script&gt; </code></pre> <p>My problem now is that this only seems to work on the first mousein and mouseout. After that the animations no longer trigger and nothing happens. This is Google Chrome DEV channel.</p> <p>This seems to be exacerbated by how fast you move the mouse in and out.</p> <p>I can't seem to work out what the issue is, this <a href="http://jsfiddle.net/SNhky/" rel="nofollow">JSFiddle</a> has a working (and breaking on my computer) example.</p> <p>EDIT: I suspect this is a bug in jQuery 1.4.2 and have lodged a bug ticket: <a href="http://dev.jquery.com/ticket/6772" rel="nofollow">http://dev.jquery.com/ticket/6772</a></p>
javascript jquery
[3, 5]
4,480,440
4,480,441
What would be the right syntax in jQuery
<p>I have a jquery function which on submit event is generating an url.If one the parameter is not defined, adding to url should be skipped </p> <pre><code> var category =$("#prod_category").val(); var group =$("#prod_group") window.location.href = "/page/" + **//add to url if category is definned** encodeURI(category) + "/" + **//add to url if group is definned** encodeURI(group) + "/" + </code></pre>
javascript jquery
[3, 5]
2,834,679
2,834,680
Div Slider Slideshow?
<p>I am trying to create a slideshow similar to the one on <a href="http://lifeandtimes.com" rel="nofollow">lifeandtimes.com</a>, and would like to know what is the best method to do so. I have tried <a href="http://www.smoothdivscroll.com" rel="nofollow">www.smoothdivscroll.com</a> and many other solutions to no avail. Any help would be appreciated.</p>
javascript jquery
[3, 5]
1,832,161
1,832,162
Get a numeric value from specific string using javascipt/jquery
<p>I have a grid and I am getting selected row's html by its id using JavaScript.</p> <pre><code>var parentRow1 = document.getElementById('__' + parentrowid).innerHTML; </code></pre> <p>this will return me the following html:</p> <pre><code>&lt;td class="rgExpandCol"&gt; &lt;img title="Expand" onclick="$find(&amp;quot;&amp;quot;)._toggleExpand(this, event); return false;" src=" style="border-width:0px;"&gt;&lt;/td&gt;&lt;td&gt;TEST&lt;/td&gt;&lt;td&gt;my details&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;01/06/2011&lt;/td&gt; &lt;td&gt;198307&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt; &lt;span id="lblDCount"&gt;2&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;span id="lblUCount"&gt;1&lt;/span&gt; &lt;/td&gt; &lt;td&gt; &lt;input name="$btn" id="btn"&gt; &lt;/td&gt; </code></pre> <p>Is there a way to get this portion(the number count will not be static), and get the number value then substract it by one:</p> <pre><code>&lt;span id="lblUCount"&gt;1&lt;/span&gt; </code></pre> <p>so final result will be <code>&lt;span id="lblUCount"&gt;0&lt;/span&gt;</code> it it is 2 then 1 and so on</p>
javascript jquery
[3, 5]
1,522,458
1,522,459
How do I implement this pop up box that displays when hovered over "Shopping Cart" link in this website
<p>I want exactly like this...not a simple box but the one with shadow borders like this one..I have been googling but all I came across is Slide down boxes and tool tips..that's not what I want..How do I implement the one in this website..oh and this box's got HTML stuff in it...like buttons and all</p> <p>Is there any way I can see the code of this in that website ?</p>
javascript asp.net jquery
[3, 9, 5]
4,202,334
4,202,335
Why @Override needed in java or android?
<p>In java or Android there are @Override annotations. What does it mean? I found that it is used when method is from subclass or inherited interface's method, I want to know further and other is @SuppressWarnings its also Anonation, if yes how many annonation used by java and for which purpose.</p>
java android
[1, 4]
1,141,223
1,141,224
setInterval( ) -- unexpected identifier - but it works once
<p>Why do I get <code>Uncaught SyntaxError: Unexpected identifier</code> if it works once?</p> <p>There are a bunch of these on <a href="http://stackoverflow.com/search?q=unexpected%20identifier">StackOverflow</a>. The punchline is usually a typo somewhere in the script.</p> <p>It works once, then it gives 1 error message a second. </p> <p>Here I am changing the colors of states on a map:</p> <pre><code>&lt;!-- language: lang-js --&gt; &lt;script type="text/javascript"&gt; colors = [ 'rgba(255,0,0,0.1)','rgba(0,255,0,0.1)','rgba(0,0,255,0.1)' ]; $(document).ready(function(){ setInterval( $("ul").children().eq( Math.floor(50*Math.random())).css('color', colors[Math.floor(3*Math.random())] ) ,1000); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,460,529
3,460,530
Android Database Creation Problems MVC Pattern
<p>Hi sorry i'm new in this android developing and i'm doing a sqlite project. So i wanted to create the database once the application is initiated but it doesn't do it here is the application: <a href="http://www.mediafire.com/?6oalfamfes2b5fy" rel="nofollow">http://www.mediafire.com/?6oalfamfes2b5fy</a> . I work like MVC Patterns so maybe that is the problem but i don't think so because i did a similar project before and it work just fine.</p>
java android
[1, 4]
5,213,276
5,213,277
Can I restrict a ViewFlipper from flipping until an AsyncTask has been performed?
<p>My application has a <code>ViewFlipper</code> with <code>3 ViewGroups</code> in it. Each <code>ViewGroup interaction</code> is dependent on data from a database. I'm using an AsyncTask to read from a database and return a Cursor when it's done. Before the AsyncTask is executed, I just want to display a single View in the <code>ViewFlipper</code> saying "Loading data, please wait.", is this possible somehow?</p>
java android
[1, 4]
5,147,778
5,147,779
How to return status when using Jquery's .load() function?
<p>I have this action in my controller</p> <pre><code>public function actionInsertComment() { if (isset($_POST['liga'])) { if(condition) { $status = "success"; } else { $status = "error"; } $this-&gt;renderPartial('ligaWallMessages'); } } </code></pre> <p>And I'm using JQuery's load function in the following manner:</p> <pre><code>$('#div_wall_messages').load('insertComment',{comment: comment, liga:idLiga},function(response, status, xhr){ attachHandlers(); }); </code></pre> <p>In this example, I am setting the status variable (in the controller) in a way I know for a fact it doesn't work. I read <a href="http://www.w3schools.com/jquery/ajax_load.asp" rel="nofollow">this link</a> and there I understood there are predefined values for status; "success", "notmodified", "error", "timeout", or "parsererror". </p> <p>I was wondering if there is anyway to set the status variable manually or if I can have a variable returned in some other way. </p>
php jquery
[2, 5]
3,583,422
3,583,423
Overriding instantiateItem(...) won't compile
<p>I am trying to use a PageAdapter. I found out that <code>public Object instantiateItem( View pager, int position )</code> has been deprecated. So I am trying up update but ran into a problem. The new definition changes the deceration to <code>public Object instantiateItem( ViewPager pager, int position )</code>, when I do this and push it to my device the app crashed. </p> <p>Here is my logcat output.</p> <blockquote> <p>12-26 19:24:30.701: ERROR/AndroidRuntime(25431): FATAL EXCEPTION: main java.lang.UnsupportedOperationException: Required method instantiateItem was not overridden at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:175) at android.support.v4.view.PagerAdapter.instantiateItem(PagerAdapter.java:110) at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:649) at android.support.v4.view.ViewPager.populate(ViewPager.java:783) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1016)</p> </blockquote> <p>So I added <code>@Override</code> to the method call, but when I compile it ,using maven, I get the following output that corresponds to my method.</p> <blockquote> <p>Chronos/ChronosApp/src/com/kopysoft/chronos/view/ClockViewer.java:[67,4] error: method does not override or implement a method from a supertype</p> </blockquote> <p>I am at a lose as what to do. Any advice would be greatly appreciated!</p> <p>The entire code can be found here: <a href="http://pastebin.com/da5Kqcmg" rel="nofollow">http://pastebin.com/da5Kqcmg</a></p>
java android
[1, 4]
5,116,974
5,116,975
Strange IE7 quirk
<p>I am getting the following error in <code>IE9</code> when in <code>IE7</code> mode. Using a small counting script:</p> <blockquote> <p>SCRIPT1028: Expected identifier, string or number</p> </blockquote> <p><em><strong>Code</em></strong></p> <pre><code>$.fn.countTo.defaults = { from: 0, // the number the element should start at to: 100, // the number the element should end at speed: 1000, // how long it should take to count between the target numbers refreshInterval: 100, // how often the element should be updated decimals: 2, // the number of decimal places to show onUpdate: null, // callback method for every time the element is updated, onComplete: null, // callback method for when the element finishes updating }; </code></pre> <p><strong>Line 185</strong> is the last curly bracket and semi colon</p> <p>We need this to work in <code>IE7</code> but this error is breaking the script.</p>
javascript jquery
[3, 5]
2,883,338
2,883,339
"hasClass" with javascript? or site with jquery to javascript translation?
<p>How do you do jQuery's <code>hasClass</code> with plain ol' javascript? E.g., <code>&lt;body class="thatClass" /&gt;</code> What's the javascript way to ask if <code>body</code> has "thatClass"?</p> <p><em>Also, anyone know of a site that explains that gives javascript versions of many jQuery functions? I often find myself looking for answers to similar questions.</em></p>
javascript jquery
[3, 5]
5,187,264
5,187,265
Most Accurate jQuery Transition Time Translation Delay
<p>So; I've heard that a fair translation for jQuery transition delay time could be 1000 = 1 Second.</p> <p><strong>Is this the most accurate / approximate way to translate?</strong></p> <p><em>EG</em>: Looking at the script below; I am trying to translate the delays / animations to the most approximate in seconds / milliseconds.</p> <pre><code>onReady=function(){ $('#chart1_lines').delay(1000).animate({ width:97 }, 1000, 'easeOutQuad', onComplete1 ); } onComplete1=function () { $('#chart1_values').css('width',156); $('#chart1_lines').delay(250).animate({ width:183 }, 1000, 'easeOutQuad', onComplete2 ); }; </code></pre>
javascript jquery
[3, 5]
5,650,892
5,650,893
jQuery $.get from local directory producing different behaviour in IE vs FF, Chrome
<p>I have the following simple jQuery:</p> <pre><code> $.get('Data.csv', function(data) { alert(data); }); </code></pre> <p><code>Data.csv</code> is stored in the same folder as the html file which accesses it.</p> <p>If I run this in all browsers when the url is a domain (i.e. www.mysite.com/path/to/file), then the alert will display a string value of the contents of <code>Data.csv</code>.</p> <p>If I create a hosts file link to the local folder (i.e. host.mysite.com/path/to/file) then alert will display a string value of the contents of <code>Data.csv</code> in all browsers.</p> <p>If I run this in IE 9 when the url opens the file locally (i.e c:\path\to\file) then the alert will display a string value of the contents of <code>Data.csv</code>.</p> <p>However, if I run this in FF or Chrome when the url opens the file locally (i.e file:///c:/path/to/file) then the alert will display <code>[object XMLDocument]</code>.</p> <p>Does anyone know why this is and how to open the local file as a string in FF and Chrome?</p> <p>n.b. - I have tested this in order to rule out cross-platform-security issues. I don't think that that is the cause because otherwise it would not assign the content of the csv file at all.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,917,638
4,917,639
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]
5,850,002
5,850,003
Save a Javascript file as .php
<p>I have done this before to get data which needed to be looped into the javascript but this time it won't work. It all works fine when it is internal on the <code>index.php</code> file but doesn't work when it's an external file.</p> <p>This is the code that is breaking it</p> <pre><code>$('#filter').append('Select Club: &lt;select name="users" id="users" onchange="showUser();"&gt;&lt;option value="0" selected&gt;All Clubs:&lt;/option&gt; &lt;?php $query = "SELECT * FROM clubs"; $clubs = mysql_query($query); while($row = mysql_fetch_array($clubs)){ ?&gt; &lt;option value="&lt;?php echo $row['name']; ?&gt;"&gt;&lt;?php echo $row['name']; ?&gt; &lt;/option&gt; &lt;?php } ?&gt; &lt;/select&gt; '); </code></pre>
php jquery
[2, 5]
552,354
552,355
How to maintain JavaScript function variable states (values) between calls?
<p>I am looking for getters and setters functionality but cannot rely on <code>__defineGetter__</code> and <code>__defineSetter__</code> yet. So how does one maintain a function variable's value between function calls?</p> <p>I tried the obvious, but myvar is always undefined at the start of the function:</p> <pre><code>FNS.itemCache = function(val) { var myvar; if( !$.isArray(myvar) myvar = []; if( val === undefined) return myvar; .. // Other stuff that copies the array elements from one to another without // recreating the array itself. }; </code></pre> <p>I could always put another <code>FNS._itemCache = []</code> just above the function, but is there a way to encapsulate the values in the function between calls?</p>
javascript jquery
[3, 5]
2,731,660
2,731,661
OnClick event - check which is the sender
<p>Is there a way to call one event every time when something on my page is clicked (whether a control or something else), and then in that function to check which is the sender?</p>
javascript jquery
[3, 5]
1,910,248
1,910,249
Android: Reading wav file and displaying its values
<p>Hi i'm trying to read the data in a wav file so that i can plot it as a waveform. Following is the code that i have tried:</p> <pre><code> try { RandomAccessFile file = new RandomAccessFile(myFile,"r"); while(file.read()&gt;-1){ byte b1 = (byte) file.read(); byte b2 = (byte) file.read(); Log.d(TAG,"DATA:"+ (double) (b2 &lt;&lt; 8 | b1 &amp; 0xFF) / 32767.0); } file.close(); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } </code></pre> <p>My output is a value that ranges between -1 and +1 initially but later it gives only DATA:0 it seems like an infinite loop and there is a force close. According to me the loop should terminate when the end of file is reached. Can anyone pls suggest some terminating condition for the loop. Please Help.... Thanks is advance...</p>
java android
[1, 4]
2,840,571
2,840,572
how to surround user selection in editable iframe
<p>I need to wrap user's selection within editable <code>&lt;iframe&gt;</code> in a <code>&lt;b&gt;</code> (or <code>&lt;span&gt;</code>) tags in IE. How can I do it? I create a range:</p> <pre><code>rng = document.selection.createRange(); </code></pre> <p>and can't understand what to do next.</p>
javascript jquery
[3, 5]
1,715,731
1,715,732
Why is my Javascript not valid?
<p>Can anyone please help?<br> I have a div with ID 'adpictureholder', to which I dynamically add (or remove) images.<br> On Form submit I want to get SRC values of all these images within that DIV and put them to the value of one hidden input with ID 'piclinkslisttosubmit'. <br> The thing is that my current Javascript does not function, as if there is some syntax typo there, but I don't see where. <br>Can anyone please have a quick look at it?</p> <pre><code>function copyonsubmit(){ var strump1 = ''; var i=0; var endi = document.getElementById('adpictureholder').childNodes[].length - 1; var images = document.getElementById('adpictureholder').childNodes[]; for (i=0;i&lt;=endi;i++) { strump1 = strump1 + '|' + images[i].src; } document.getElementById('piclinkslisttosubmit').value = strump1; } </code></pre>
javascript jquery
[3, 5]
545,964
545,965
How to set document.getElementById(progressPanel.ID) in aspx.cs page
<p>I have javascript which sets the location of panel and javascript is below</p> <pre><code>function ShowProgressPanel(progresspanel) { var progressPanelId = document.getElementById(progressPanel.ID); alert(progressPanelId); if (progressPanelId != null) { var height = Math.min(document.documentElement.clientHeight, document.body.offsetHeight); alert(height); var width = Math.min(document.documentElement.clientWidth, document.body.offsetWidth); var xPos = Math.round((width / 2) - (progressPanelId.clientWidth / 2)); var yPos = Math.round((height / 2) - (progressPanelId.clientHeight / 2)); setLocation(progressPanelId, { x: xPos, y: yPos }); } function setLocation(element, point) { Sys.UI.DomElement.setLocation(element, point.x, point.y); } } </code></pre> <p>I am passing client id from aspx page </p> <pre><code>var progressPanel = document.getElementById('&lt;%=_progressPanel.ClientID %&gt;'); ShowProgressPanel(progressPanel); </code></pre> <p>it is set to html div tag.above code works fine.when i send through aspx.cs page it shows contentplace holder element and height is not set.</p> <pre><code>string script = string.Format(@"ShowProgressPanel('{0}');", _progressPanel.ClientID); ScriptManager.RegisterStartupScript(this, typeof(Page), _progressPanel.ID, script, true); </code></pre> <p>But in both progress panel is placed in contetnplaceholder. How shall i do it in aspx.cs page</p>
javascript asp.net
[3, 9]
3,496,307
3,496,308
How to call C++ functions/methods via JavaScript
<p>does anybody know how to call C++ functions or methods via JavaScript. Need scripting like Lua/Python-C++ but with JavaScript.</p> <p>Thanks in advance.</p>
javascript c++
[3, 6]
3,004,295
3,004,296
How to find the Vertical size of a window displaying a web page
<p>I have an ASP.NET Site that has a single Master Page. On one of my pages in this site I display a PDF file as the content of the page.</p> <p>I need a way to know the size that I can make the PDF control so that I do not create a scroll bar for the webpage (the PDF control has it's own scroll bar).</p> <p>I was able to solve this horizontally by setting the width of the control to 100%. Sadly this does not work for the Vertical size.</p> <p>Any help is appreciated.</p> <p>Vaccano</p>
asp.net javascript
[9, 3]
473,339
473,340
Using Javascript/jQuery to crop image
<p>I have a page showing several thumbnail images. When the user mouseovers these images, a modal window showing the full image will appear.</p> <p><strong>Problem:</strong> In order to save space, I want to just store 1 version (the original version) of the image on the server, and create the thumbnail "dynamically" on the client side, probably doing a crop (no resize necessary) using javascript/jquery. Is this possible?</p> <p><em>I have seen (but not tried) those jquery cropping plugins, which seem to have many features like a interactive cropping tool. I dont need these features, just want to crop using javascript. Most likely cropping with gravity in the center of the image.</em></p>
javascript jquery
[3, 5]
4,918,195
4,918,196
jQuery: how to refresh javascript value on select event?
<p>I have such code:</p> <pre><code>var regions = [{'label': 'array', 'value': '1'}]; //default values $("#auto1").select({ regions = jQuery.parseJSON( //updating process $.ajax({ type: 'POST', url: '/ajax/place/', data: { country: value } }) ); return false; }); $("#auto2").some_func({ initialValues: regions, //here must be updated values, but it's not }); </code></pre> <p>I think it is understandable from above code: when page loaded, element #auto2 has default values, but when I select smth from #auto1 it must be updated, but it's not.</p> <p>How can I update the values corresponding to data value.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,860,423
2,860,424
Idiomatic way of calling a jQuery function on a Javascript object?
<p>Given a Javascript DOM object, what is the most idiomatic way of calling a jQuery function on it? Currently, I am using:</p> <p><code>$('#' + object.id).someFunction()</code></p> <p>However, this doesn't feel quite right. Isn't there a better way?</p>
javascript jquery
[3, 5]
2,534,713
2,534,714
Trigger JavaScript Anchor Function (Without User Clicking on it)
<p>I have a page where users see this anchor...</p> <pre><code>&lt;a href="javascript:launchSomething("1", "2", "1")"&gt;Test&lt;/a&gt; </code></pre> <p>Is it possible to execute/call <code>launchSomething(.....)</code> function without having the user to click it? If the params were fixed values then I could just do something like ... </p> <pre><code>//on document.ready() { // launchSomething( .... ); //} </code></pre> <p>but the web page is generated dynamically and these params change too so what do I need to do to trigger it automatically once the web page has loaded? </p> <p>thanks for help.</p> <p>UPDATE</p> <p>I have just got the markup changed to </p> <pre><code>&lt;a class="click1" href="javascript:launchSomething('1', '2', '1')"&gt;Test&lt;/a&gt; </code></pre> <p>so it always has a class "click1"</p>
javascript jquery
[3, 5]
5,788,329
5,788,330
Change the format of a date
<p>I submit a date through a form such as below</p> <pre><code>2012-07-24 17:50 </code></pre> <p>but on the result page I want to change it's format and echo it to </p> <pre><code>Tuesday, 24 of July </code></pre> <p>How do I do this? Should I use PHP or JavaScript?</p>
php javascript
[2, 3]
4,896,948
4,896,949
Unbind an element and add back after animation stops
<p>I am trying to <code>unbind</code> an element, an then <code>bind</code> it back after a page scroll animation completes:</p> <pre><code>$(".trigger").click(function(){ $(".class1 a, .class2 a").unbind(); $('html, body').stop().animate({scrollTop: $('#container').offset().top}, 1000); $(".class1 a, .class2 a").bind(); }); </code></pre> <p><code>.class1 a</code> and <code>.class2 a</code> never get binded back, however?</p>
javascript jquery
[3, 5]
4,815,880
4,815,881
JQuery drop down bobs up and down continuously
<p>I am using jquery to hide/show an DIV on hover of an LI. When I do this the div appeared but pops up and down without stopping until I take my mouse off the LI.</p> <pre><code>$(document).ready(function () { $('li.menu_head').mouseover(function () { $('div.newsadviceDrop').slideToggle('medium'); }); }); </code></pre>
javascript jquery
[3, 5]
380,555
380,556
error with jquery offset
<p>I'm trying to get a div to appear underneath another div so that I can slide the top div down to reveal the appended second.</p> <p>I'm pretty far off, but I keep getting an error that jquery's <code>[offset][1]</code> (which I'd like to use to get the position of the top div) is returning undefined. </p> <p>Maybe this is just the wrong approach for this. Any help is appreciated.</p> <pre><code>$(document).ready(function() { $('.obscure').on('click', function() { var blueDiv = $('.blue').clone(); // blueDiv.css('display', 'none'); $('#wrapper').append(blueDiv); var obscure = $('#obscure'); var offset = obscure.offset(); console.log(offset); /*Uncaught TypeError: Cannot read property 'top' of undefined */ var y = offset.top; var x = offset.left; console.log(y); //blueDiv.css('top', y); $('.obscure').css('z-index', 10000); }); });​ </code></pre> <p><a href="http://jsfiddle.net/loren_hibbard/U7tAV/" rel="nofollow">http://jsfiddle.net/loren_hibbard/U7tAV/</a></p>
javascript jquery
[3, 5]
5,304,542
5,304,543
Basic framework for private album using keys?
<p>I'm trying to implement a private album feature on my site and I'm looking for some basic framework. Are there any scripts available or frameworks to start with?</p> <p>I've looked through Google but can't seem to find anything useful.</p> <p>Basically all I want to do is let a user request access to another users private photo album. If the second user agrees he can generate a private key that will allow the first user to access the private album. </p>
php jquery
[2, 5]
5,130,980
5,130,981
Create intermediate element with jQuery
<p>I want to invoke a creation of div with certain class just below the invoke button, how can I do that most efficiently with jquery?</p>
javascript jquery
[3, 5]
5,220,070
5,220,071
How can I detect how yellow an image is
<p>I want to ignore all other colours. I just want to count the colours between white and yellow(Bright yellow, Light yellow.. all the way to white). and then give a rating of how yellow a certain image is. is that possible?</p> <p>I have been playing with <code>Bitmap.getPixel()</code> but I can't figure out how to ignore other colours.</p> <p><img src="http://i.stack.imgur.com/MgwDN.jpg" alt="enter image description here"></p> <p>In this example, image 1 would be the one select because it has more colour between bright yellow and white.</p> <p>How can I detect yellowish colours only?</p>
java android
[1, 4]
764,282
764,283
How to get copied text from memory without pasting?
<p>I got one requirement which is when the user copy any text the system should get the copied text from the memory into the program without require the user to paste it in a txtbox or similar control. I searched on the internet but I didn't get any information. can somebody suggest or provide some references so that I can follow...???? </p> <p>any help would be highly appreciated...!!!! </p>
c# asp.net
[0, 9]
3,501,496
3,501,497
select a range of dom elements based on index
<p>I need to select a specific grange of jquery elements based on there index using <code>:eq()</code> (or something else if you have a better solution)</p> <p>my html structure is the following:</p> <pre><code>&lt;ul&gt; &lt;li&gt;slide0&lt;/li&gt; &lt;li&gt;slide1&lt;/li&gt; &lt;li&gt;slide2&lt;/li&gt; &lt;li&gt;slide3&lt;/li&gt; &lt;li&gt;slide4&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When the user hovers slides over the slide2 i need to select <code>li:eq(0), li:eq(1)</code> and <code>li:eq(3), li:eq(4)</code> separatly, because they have a different animation.</p> <p>This is my solution, but this feels a little messy...</p> <pre><code>var $slides, theOthers, slidesTotal; $slides = $('ul &gt; li'); slidesTotal = $slides.length; theOthers = function(slideIndex ,slidesTotal){ var before = [], after = [], i=0; while (i&lt;=slideIndex - 1){ before[i] = ":eq(" + i + ")" i++ }; while (i &lt;= slidesTotal) { after[i] = ":eq(" + i + ")" i++ }; return [ before.join(",") , after.join(",") ] } $slides.mouseenter(function(){ var groups, slideIndex, $that = $(this); slideIndex = $that.index(); groups = theOthers(slideIndex, slidesTotal); $slides.filter(groups[0]).dosomething(); $slides.filter(groups[1]).dosomethingelse() }) </code></pre> <p>is there a more simple way to do this with jQuery?</p>
javascript jquery
[3, 5]
2,516,377
2,516,378
Show hidden div (slide) when click on button (change text)
<p>I have a page where I want to hide some content (#hidden_content) as default. On this page there is a CSS button with text example "Show content".</p> <p>When click on this button I want the div #hidden_content to show with a slide effect and at the same time the text on the button "Show content" will change to example "Hide content" and when click the content will hide again.</p> <p><strong>Button</strong></p> <pre><code>&lt;a href="" id="button" class="button_style"&gt;Show content&lt;/a&gt; </code></pre> <p><strong>Div</strong></p> <pre><code>&lt;div id="hidden_content"&gt;Content&lt;/div&gt; </code></pre> <p><strong>Slide script</strong></p> <pre><code>$(document).ready(function(){ $("#button").click(function(){ $("#hidden_content").slideToggle("slow"); }); }); </code></pre> <p>Now I want the text on the button so change when click. How do I do that?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
593,404
593,405
Android using data out of datepicker
<p>Im trying to get the Day / Month / Year from my datepicker. I have the problem that the Month en the day never is correct. I give you the code below. The month is correct but it fails when the month is december. The day is never correct.</p> <pre><code> public class myOnDateChangedListener implements OnDateChangedListener { public void onDateChanged(DatePicker view, int year, int monthOfYear, int dayOfMonth) { if (view.getId() == R.id.datePicker1) { startDay = view.getDayOfMonth(); if(view.getMonth() == 11){ startMonth = 12; }else{ startMonth = (view.getMonth() + 1); } startYear = view.getYear(); } if (view.getId() == R.id.datePicker2) { endDay = view.getDayOfMonth(); if(view.getMonth() == 11){ endMonth = 12; }else{ endMonth = (view.getMonth() + 1); } endYear = view.getYear(); } } } </code></pre>
java android
[1, 4]
1,343,094
1,343,095
Calling a method in another class to convert an object to that class
<p>I was wondering about something very basic but that I haven't been able to figure out. I've read the similar questions, but they don't particularly answer my question.</p> <p>Let's say I have a string. I want to convert it into a double. Now I see that there is a function known as parseDouble in java.lang.Double. However, how do I call it? The string is in my Android strings.xml file if that's any help.</p> <p>Thanks.</p>
java android
[1, 4]
3,130,335
3,130,336
How to get Form Values from Javascript-added Checkboxes in ASP.NET?
<p>I am adding checkboxes to a by setting the innerHtml property as below.</p> <pre><code>function ShowCheckbox(uid) { document.getElementById("samplediv").innerHTML += "&lt;input type='checkbox' value='on' name='box_" + uid + "' id='box_" + uid + "'/&gt; Some Text Here"; } </code></pre> <p>This is on a .aspx page</p> <p>I am trying to retrieve the values of the dynamic checkboxes from the codebehind in c# but am not finding them being posted back. I've read on the IE issue (pre-IE8) about it not handling the name attribute well however I'm in IE9 and apparently it's not a problem if you use the innerHtml approach rather than directly adding to the DOM.</p> <p>I tried requesting values in codebehind via Request.Form and Request.Params with no luck either way.</p> <p>Any idea why the dynamic checkboxes aren't getting posted back?</p>
javascript asp.net
[3, 9]
642,719
642,720
Java or Android
<p>I am using eclipse, and I have just tried making an android project instead of a java project. Things that I do in java don't work in android. Are they different programming languages?</p>
java android
[1, 4]
5,278,192
5,278,193
Zooming an application
<p>I've one application in running successfully. I've installed this to my device (Samsung Galaxy SII) also. But, i can't view this application in zoom view. How can i view this? If possible means tell me how? Otherwise, tell the another way to proceed this? Thanks in Advance</p>
java android
[1, 4]
237,683
237,684
How do you pass data between pages where the source data is in IN an asp:Content block?
<p>So I've noticed that PreviousPage and Request.Form don't work if my SOURCE page has the TextBox's and such within an asp:Content block (master pages)</p> <p>Is there a workaround or am I not understanding something?</p> <pre><code> &lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" MasterPageFile="Menu.master" %&gt; &lt;asp:Content ID="pageHead" ContentPlaceHolderID="pageHead" Runat="Server"&gt; &lt;title&gt;Whatever&lt;/title&gt; &lt;/asp:Content&gt; &lt;asp:Content ID="pageContent" ContentPlaceHolderID="pageContent" Runat="Server" &gt; &lt;asp:TextBox runat="server" ID="txtTester" Text="YES"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button runat=server ID="btnTest" PostBackUrl="~/Process.aspx" /&gt; &lt;/asp:Content&gt; </code></pre> <p>Target Codebehind:</p> <pre><code>public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ltlDebug.Text = Request.Form["txtTester"]; //Doesn't get the var, only if I remove it from master page model in source page } } </code></pre>
c# asp.net
[0, 9]
2,073,090
2,073,091
Setting a time for flicker animation on img
<p>I'm using this code to make my logo flicker on my website. But It becomes annoying when it continues to flicker while browsing, how can I set a time to allow it to flicker for something like the first 15seconds on page load, then stops?</p> <p><strong>JS code I'm using:</strong></p> <pre><code>$(document).ready( function(){ var t; const fparam = 100; const uparam = 100; window.flickr = function(){ if(Math.round(Math.random())){ $("#logodcoi").css("visibility","hidden"); t = setTimeout('window.unflickr()',uparam); } else t = setTimeout('window.flickr()',fparam); } window.unflickr = function(){ if(Math.round(Math.random())){ $("#logodcoi").css("visibility","visible"); t = setTimeout('window.flickr()',fparam); } else t = setTimeout('window.unflickr()',uparam); } t = setTimeout('window.flickr()',fparam); }); </code></pre>
javascript jquery
[3, 5]
1,340,471
1,340,472
Determining when the user has scrolled to the end of a DIV
<p>My page has a DIV, with overflow and I've placed two buttons on either side of the div to act as secondary scrolling methods.</p> <p>When pressing the left button, the following script is run and seems to work perfectly:</p> <pre><code> function slideLeft() { if ($("#divfieldWidgets").scrollLeft() == 0) { $('#divScrollWidgetsLeft').animate({ opacity: 0.1 }, 250); window.clearInterval(animationHandler); } $('#divfieldWidgets').animate({ scrollLeft: "-=100px" }, 250); } </code></pre> <p>However I just can't seem to be able to find a method to determine when the DIV has hit it's limit when scrolling right.</p> <p>I'm pretty sure I need some calculation based on $("#divfieldWidgets").scrollLeft() and $("#divfieldWidgets").width(), but all arithmetic calculations I've performed on those two values don't yield any results that show any relation to the width, it's maximum, etc, etc.</p> <p>There is ONE final option I thought of, and that's storing the current scrollLeft value in a temporary variable and comparing the new value; if there's no change, then it's reached the end but I'm sure there must be a more cleaner way of achieving this.</p> <p>Any thoughts?</p>
javascript jquery
[3, 5]
2,976,893
2,976,894
Serialize string to standard URL-encoded notation
<p>I need serialize a string to a standard URL-encoded notation my string has some blank spaces and parentheses: </p> <pre><code>string = "( 3.141516, 3.1415), 3,1415"; </code></pre> <p>and I need get it at serverside as a only value - var, how can I do that in order to sent it as a query string??? </p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,082,466
4,082,467
JQuery Condition If Else bug in else
<p>I am trying to hide a next button <code>div</code> until the input in it is populated so I've added this code:</p> <pre><code>&lt;script&gt; $(document).ready(function () { if ($('#myDiv').val().length == 0) { $('#next_btn').hide(); } else { $('#next_btn').show(); } }); &lt;/script&gt; </code></pre> <p>Here is myDiv</p> <pre><code>&lt;textarea id="myDiv"&gt;&lt;/textarea&gt; </code></pre> <p>If hiding the next button <code>div</code> but when I populate the input in <code>#myDiv</code> the <code>#next_btn</code> is not showing up.</p> <p>Am I doing something wrong here?</p>
javascript jquery
[3, 5]
623,093
623,094
Problem with Scrolling a list
<p>I've one application which is containing some item in List. I've successfully installed this into my device (Samsung Galaxy SII). In my emulator i can view the items by scrolling that. But, in my device it seems black shaded on the item. How can i reduce that? Is it possible? Thanks in advance.</p>
java android
[1, 4]
5,840,379
5,840,380
Validation for Dropdown
<p>I have two dropdowns with same list populated from database . I want to validate where dropdown 1 value is not same as dropdown 2 . Thanks SmartDev</p>
c# asp.net
[0, 9]
2,521,155
2,521,156
How to disable page validation when clicking previous in a wizardstep
<p>When I try to click the previous button in a wizard step on my page, it wont return to the previous page until all of the fields are valid. I have turned of CausesValidation. Is there an issue with this in a wizard? My code follows:</p> <pre><code>&lt;StepNavigationTemplate&gt; &lt;asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Previous" OnClientClick="DisableButton(this);" UseSubmitBehavior="False" CssClass="bigButton" /&gt; </code></pre> <p>Cheers</p>
c# asp.net
[0, 9]
4,004,749
4,004,750
Send Values of the Checkboxes Groups
<p>I have interesting case. I have a page where I have groups of checkboxes created dynamically, I don't know their names before they're generated.</p> <p>There might be name "type", "profile" and many more. There's possibility of displaying multiple groups at one time.</p> <p>Do you have any idea how to send them via AJAX request in following format? type=val1,val2 user=val1,val2</p> <p>All data comes from database - it may depends on user selection, that's why I don't know their names.</p> <p>Cheers!</p>
javascript jquery
[3, 5]
2,622,909
2,622,910
jQuery plugin for timeout user and display lightbox alert warning
<p>I am looking fo ra jQuery plugin that does the following behaviour: 1. Find user inactivity for a period of 10 minutes. 2. After 10 minutes display an alert or lightbox message. I believe lightbox would be better. 3. After 5 more minutes, perform an action. </p> <pre><code> My javascript code is : &lt;script type="text/javascript"&gt; var idleTime = 0; var activeTime = 0; var warningFlag = 0; setInterval(function checkIdle() { idleTime += 1; activeTime += 1; //document.write(idleTime + ' ' + activeTime); if(idleTime &gt; 5) { alert("Idle from last 5 seconds!! You have been active for last "+ activeTime); warningFlag=1; } if((idleTime &gt; 10) &amp;&amp; (warningFlag==1)) { alert("Idle from last 10 seconds!! You have been active for last "+ activeTime); window.location = "www.tinyprints.com"; } window.onload = resetTimer; document.onmousemove = resetTimer; document.onkeypress = resetTimer; },1000); function resetTimer() { idleTime = 0; } &lt;/script&gt; But i was thinking to use a jQuery plugin. </code></pre>
javascript jquery
[3, 5]
3,875,103
3,875,104
What is the difference between $(document).ready(function() and $(function() ?
<p>So I know what this does:</p> <pre><code>$(document).ready(function(){ // Your code here... }); </code></pre> <p>Now I have seen people doing this lately:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(){ // Your code here... }); &lt;/script&gt; </code></pre> <p>Are these two ways of doing the same thing?</p> <p>I see an anonymous function being declared inside a jquery selector here, but never actually being invoked, yet by the way the page runs it seems that this may just run on pageload.</p>
javascript jquery
[3, 5]
4,469,914
4,469,915
Override all requests from javascript
<p>I have an asp.net application. I need to implement that every request to the server for a page will contain an additional parameter in query string. My idea was to capture all reqests in javascript and add this parameter.</p> <p>I might use jQuery selector for every link and change it href and override jquery ajax to add this parameter to request but this is not the best solution.</p> <p>Is this possible in JS ?</p> <p>Thanks, Bartek</p>
javascript jquery asp.net
[3, 5, 9]
4,472,709
4,472,710
jquery shortcut for multiple clicks
<p>well i am still new to js/programming. can anyhow guide me on how can i optimize my code? i am sure that there are multiple ways to write a small and fast code that does the same thing.</p> <pre><code>$('.ourservices-content .left ul li:nth-child(1)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '0px' },800) }) $('.ourservices-content .left ul li:nth-child(2)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-600px' },800) }) $('.ourservices-content .left ul li:nth-child(3)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-1200px' },800) }) $('.ourservices-content .left ul li:nth-child(4)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-1800px' },800) }) $('.ourservices-content .left ul li:nth-child(5)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-2400px' },800) }) $('.ourservices-content .left ul li:nth-child(6)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-3000px' },800) }) $('.ourservices-content .left ul li:nth-child(7)').click(function(){ $('.our-services-content-box &gt; ul.box').stop().animate({ marginLeft: '-3600px' },800) }) </code></pre>
javascript jquery
[3, 5]
3,059,843
3,059,844
How to discover and load one web application into another?
<p>I've been googling for a bit now, and maybe I'm not searching for the correct term. I want to have a single "shell" asp.net web application that is able to load/run other web applications (much like prism does with Silverlight xap files). However, I can't seem to find any verbage other than "sub projects", which require one to add the project to the solution. I simply want to drop WebApplicationB.dll into the Bin folder and have ShellWebApplication load the dll and display the default page in an iframe or something.</p> <p>How can this be done or where can I find information on how this can be done?</p> <p><strong>Update:</strong> Offering a bounty to someone who can show code or point me to a sample project that shows how this can be done. Want to be able to "load" another asp.net web site/web application and its dependencies (dll or no) AND display that loaded asp.net web application's default.aspx start page without altering a Visual Studio solution that already contains the shell asp.net web application.</p>
c# asp.net
[0, 9]
973,419
973,420
find() not working
<p>I'm creating a bunch of <code>li</code> elements dynamically </p> <pre><code>$.each(data.attributes.listingImages, function (i, obj){ if(i == 1){ $('#js-carousel-menu').append('&lt;li media class="active"&gt;&lt;a media-frame&gt;&lt;img class="js-carousel-item" src=" '+obj.thumbnail+ ' " /&gt;&lt;/a&gt;&lt;/li&gt;' ); }else{ $('#js-carousel-menu').append('&lt;li media&gt;&lt;a media-frame&gt;&lt;img class="js-carousel-item" src=" '+obj.thumbnail+ ' " /&gt;&lt;/a&gt;&lt;/li&gt;' ); } </code></pre> <p>then when i try search for the 'active' <code>li</code> its not finding it</p> <pre><code>$gallery = $(this.el).find('#js-carousel-menu'); var _this = $gallery.find('li.active'); </code></pre> <p>however if i trace out <code>$gallery</code> it give me :</p> <pre><code>&lt;ul&gt; &lt;li media&gt;...&lt;/li&gt; &lt;li media class="active"&gt;...&lt;/li&gt; &lt;li media&gt;...&lt;/li&gt; ... &lt;li media&gt;...&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>am i missing something? thanks </p>
javascript jquery
[3, 5]
2,995,726
2,995,727
.Net - call client side and server side method on click of asp:LinkButton
<p>I have an asp:LinkButton which require following -<br> - call jQuery to open link url in another tab of current browser<br> - then call server side method to perform some logging stuff</p> <p>Please guide me for a </p> <ul> <li><p>safe (which can help avoid having 'popup blocked' messages as far as possible), I understand I shouldn't override any user personal setting for popup blocker but as it is a direct user click on asp:LinkButton, was wondering if there is a neat solution to avoid Popup blocker messages and </p></li> <li><p>an efficient and user friendly way of calling server side method (where I can avoid postback)</p></li> </ul> <p>Thank you!</p>
c# jquery
[0, 5]
2,858,676
2,858,677
What javascript event is tied to "waiting for localhost"?
<p>I want to wait until the "waiting for localhost" message in the browser goes away before running some function.</p> <p>Is it </p> <pre><code>$(document).ready(#myfunction) or $(window).load( #myfunction ); </code></pre> <p>or is it something else?</p>
javascript jquery
[3, 5]
1,799,536
1,799,537
display button only when page loads completely
<p>I have a button like this:</p> <pre><code>&lt;input type="submit" id="product_197_submit_button" class="wpsc_buy_button" name="Buy" value="Add To Cart"&gt; </code></pre> <p>Now the thing is that if user clicks button before all scripts are loaded -> I get error in shopping cart. Is there a way to disable clicking on the button (or hide it from display) UNTIL complete page is loaded into users browser ?</p> <p>Thanks, Peter</p>
javascript jquery
[3, 5]
1,140,141
1,140,142
Most effective way to make jquery field validation
<p>what is the most effective way to make a jquery field validation? For example if field name is empty, it will add empty checkmark next to field? I understand, that PHP validation is needed, and I have it, so no worries about that.</p>
javascript jquery
[3, 5]
2,001,834
2,001,835
Enabling close pop up similar to markers in Google maps
<p>I think my problem is fairly simple, however I am unable to figure it out. I want to close a note pop up with an "x" icon/div in the top right corner of the note. </p> <p>Currently I have this as the code. The only solution to minimize the note is to double click on it, which obviously isn't a viable solution.</p> <pre><code>$('.note').click(function (event) { $(this).find('.notepopup').show(); }); $('.note').dblclick(function (event) { $(this).find('.notepopup').hide(); }); </code></pre> <p>I tried changing the second part to target the '.close' div, like this:</p> <pre><code>$('.close').click(function (event) { $(this).find('.notepopup').hide(); }); </code></pre> <p>I am beginning to think it has something to do with the relationship between .close and .notepopup - as in - .close is within the popup, whereas .note is in a sense the parent element of .notepopup</p> <p>Any help would be great. If you really want to get crazy, you can look at what I'm working on: <a href="http://www.scottefloyd.com/notewebapp/demo.php" rel="nofollow">http://www.scottefloyd.com/notewebapp/demo.php</a></p>
javascript jquery
[3, 5]
308,665
308,666
What's the equivalent of Java's Thread.sleep() in Javascript?
<p>What's the equivalent of Java's Thread.sleep() in Javascript?</p>
java javascript
[1, 3]
2,352,010
2,352,011
How to express jquery ajax call with only javascript?
<p>Can you help me convert this jquery to javascript? Thanks.</p> <pre><code> &lt;script&gt; $(document).ready(function() { $("a.false").click(function(e) { $(this).closest("tr.hide").hide("slow"); var main_id = this.title; var display = "false"; e.preventDefault(); $.ajax({ url: "/useradminpage", data: {main_id: main_id, display: display}, success: function(data) { //display_false(); } }); }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,135,881
1,135,882
Throwing a Javascript error on button click event
<p>I have a Javascript function that's fired on the onclick event of a button on my webform. It's possible for invalid parameters to be passed to the function, in which case I'd like to throw an error so that the browser can report to the user that something went wrong, and that they might want to check their configuration settings. However, throwing an error causes a postback as the <code>return false;</code> statement is never reached.</p> <p>In this situation, what sort of feedback can/should I give to the user? I don't particularly want to throw up an alert as I'd prefer something more subtle. Any/all suggestions appreciated.</p>
javascript asp.net
[3, 9]
2,326,642
2,326,643
Why is object/associative array values not setting when I use $item.data("something").x
<p>Why is it when I do something like </p> <p><a href="http://jsfiddle.net/sUhn9/" rel="nofollow">http://jsfiddle.net/sUhn9/</a></p> <p><em>Added relevant HTML</em></p> <pre><code>&lt;div id="container" data-physics='{x: 10, y: 5}'&gt;Hello&lt;/div&gt; </code></pre> <p>JavaScript:</p> <pre><code>$(function() { var obj = $("#container").data("physics"); console.log("b4", obj); obj.x = -2; obj.y = -6; console.log("after", obj); }); </code></pre> <p>I get </p> <pre><code>b4 {x: 10, y: 5} after {x: 10, y: 5} </code></pre> <p>Where x and y are not being set</p>
javascript jquery
[3, 5]
4,456,869
4,456,870
Appending a string variable in jQuery
<p>I'm not sure if I have the syntax correct in the code below, I'm trying to append a var to a string parameter within the find function. I'm trying to search for a unique id within each input element of a particular form.</p> <pre><code> //Get value attribute from submit button var name = $('#myForm').find('input#submitThis').val(); //Other code that manipulates the name variable //Submit button in hidden form $('.submitLink').click(function(){ $('#myForm').find('input#'+name).click(); return false; }); </code></pre> <p>The element with a <code>submitLink</code> class is supposed to be tied to the submit button in the form. I don't think I have the syntax correct though, when I go back and click the element that has the <code>submitLink</code> class, nothing happens.</p>
javascript jquery
[3, 5]
4,726,842
4,726,843
Calling a JavaScript function onclick event of button when the function is define in a separate PHP file
<p>How do you call a JavaScript function from one PHP file that is defined in another PHP file?</p>
php javascript
[2, 3]
4,970,567
4,970,568
jquery show hide
<p>look I have this question, how can i do something like this (look at images)</p> <p>I think it's possible to do with jQuery or ajax, but i don't know how..</p> <ol> <li>i have page something like this : <img src="http://i.stack.imgur.com/fEY01.png" alt="enter image description here"></li> <li>when i click on 1st green cube slides up one #div container at the bottom of page : <img src="http://i.stack.imgur.com/AeirN.png" alt="enter image description here"></li> <li>when i click on red 1st cude #div container at the bottom of page slides down : <img src="http://i.stack.imgur.com/NjnfN.png" alt="enter image description here"></li> <li>but when i click for example (on image 2) at the green cube #div container at the bottom slides down and up with new information abou title 2.</li> </ol> <p>I hope so you will help me with this..</p> <p><strong>And one more thing, when i click o green cube it color chancing to red, and when i click on red cube it's changes back to green.</strong></p>
javascript jquery
[3, 5]
1,492,882
1,492,883
Cycle through list and call function based on id
<p>I have a list of items as such:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#" id="Viewer1"&gt;click&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="Viewer2"&gt;click&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="Viewer3"&gt;click&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="Viewer4"&gt;click&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#" id="Viewer5"&gt;click&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>There are various functions attached to each ID:</p> <pre><code>$j('#Viewer1').click(viewer1); function viewer1() { some code... return false; } $j('#Viewer2').click(viewer2); some code... return false; } $j('#Viewer3').click(viewer3); function viewer3() { some code... return false; } $j('#Viewer4').click(viewer4); function viewer4() { some code... return false; } $j('#Viewer5').click(viewer5); function viewer5() { some code... return false; } </code></pre> <p>What I'd like to do is use jQuery to loop over each id and call the appropriate function for a specific interval.</p> <p>First, Viewer1() is called for say 4 seconds and then Viewer2() and so on ---looping back to Viewer1() and starting over. I hope that makes sense.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
5,599,353
5,599,354
On input:focus hide other inputs with jQuery
<p>Im trying to build a function so that when users are scrolling over input fields on my form, other input fields fade out... </p> <p>Ive made a fiddle so that hopefully explains what im after better, but there is a label and input in each li, when the user hovers the li, the other fields ('li') should become semi transparent?</p> <p><a href="http://jsfiddle.net/WR4bJ/" rel="nofollow">http://jsfiddle.net/WR4bJ/</a></p> <p>Not sure if this is possible but any helps great, thanks </p>
javascript jquery
[3, 5]
3,220,167
3,220,168
Check if a layout exsists in Android Java
<p>I have in String name of layout:</p> <pre><code>String l_name = "fragment_item_detail"; </code></pre> <p>I want to check if this layout exsist (check if isset R.layout.fragment_item_detail) and get this int id. How can do it?</p>
java android
[1, 4]
1,713,953
1,713,954
How to return the ID of this span under a LI nodeObject using javascript or Jquery
<p>So I have </p> <pre><code>&lt;li&gt; &lt;span id="foobar"&gt; abc &lt;/span&gt; &lt;/li&gt; </code></pre> <p>I now have <code>li</code> as an nodeObject. I could get <code>"LI"</code> by using <code>li.nodeName</code>.</p> <p>Now how could I get <code>"foobar"</code> out of <code>li</code> which is an ID of a span inside it.</p> <p>I tried:</p> <pre><code> $node = li; alert($node&gt;span.Id); </code></pre> <p>but not working, thanks!</p>
javascript jquery
[3, 5]
64,750
64,751
Swallowing exception thrown in catch/finally block
<p>Usually I come across situations where I have to swallow an exception thrown by the clean up code in the <code>catch</code>/<code>finally</code> block to prevent the original exception being swallowed.</p> <p>For example:</p> <pre><code>// Closing a file in Java public void example1() throws IOException { boolean exceptionThrown = false; FileWriter out = new FileWriter(“test.txt”); try { out.write(“example”); } catch (IOException ex) { exceptionThrown = true; throw ex; } finally { try { out.close(); } catch (IOException ex) { if (!exceptionThrown) throw ex; // Else, swallow the exception thrown by the close() method // to prevent the original being swallowed. } } } // Rolling back a transaction in .Net public void example2() { using (SqlConnection connection = new SqlConnection(this.connectionString)) { SqlCommand command = connection.CreateCommand(); SqlTransaction transaction = command.BeginTransaction(); try { // Execute some database statements. transaction.Commit(); } catch { try { transaction.Rollback(); } catch { // Swallow the exception thrown by the Rollback() method // to prevent the original being swallowed. } throw; } } } </code></pre> <p>Let's assumed that logging any of the exceptions is not an option in the scope of method block, but will be done by the code calling the <code>example1()</code> and <code>example2()</code> methods.</p> <p>Is swallowing the exceptions thrown by <code>close()</code> and <code>Rollback()</code> methods a good idea? If not, what is a better way of handling the above situations so that the exceptions are not swallowed?</p>
c# java
[0, 1]
1,787,838
1,787,839
Can I insert PHP and javascript code in the same HTML file?
<pre><code>&lt;HTML&gt; &lt;script language="JavaScript"&gt; &lt;script language="php"&gt; &lt;/script&gt; &lt;/script&gt; &lt;/HTML&gt; &lt;HTML&gt; &lt;script language="php"&gt; &lt;/script&gt; &lt;script language="JavaScript"&gt; &lt;/script&gt; &lt;/HTML&gt; </code></pre> <p>I want to insert PHP and javascript code in HTML code like above. Can I do this work??</p>
php javascript
[2, 3]
3,151,786
3,151,787
jQuery after onclick
<p>I've a form with different field, a validation summary and a button Sign up! When I click on Sign up, if a field is empty, it active validation summary and until here there's no problem.</p> <p>So the problem is that I would want active a jQuery script after it was clicked Sign up button and it appeared validation summary.</p> <p>I try with </p> <pre><code>$(this).load(function() </code></pre> <p>but in effect it occur when the page is load and not after the button is clicked. I try also use button's onclick ,but I have to use script after onclick and not while.</p> <p>I used Validation group for all field of form, also button and for this reason it seems doesn't postback!</p>
asp.net jquery
[9, 5]
1,821,005
1,821,006
reading namespaced attributes with jquery
<p>Given a document like this:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de"&gt; &lt;body&gt; ... &lt;/body&gt; </code></pre> <p>How can I read the <code>xml:lang</code> attribute using jquery? I can query for elements that have <code>xml:lang</code> like this:</p> <pre><code>$('[xml\\:lang]') </code></pre> <p>but I don't know how to get the attribute itself. <code>attr('lang')</code> and <code>attr('xml\\:lang')</code> don't work. I've a jsfiddle showing this <a href="http://jsfiddle.net/paleozogt/HRL7E/" rel="nofollow">here</a>.</p>
javascript jquery
[3, 5]
1,177,459
1,177,460
document.getElementById() vs $()
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4069982/document-getelementbyid-vs-jquery">document.getElementById vs jQuery</a> </p> </blockquote> <p>I am learning jQuery and javascript.</p> <ul> <li><p>I wonder why the <code>$()</code> function of jQuery does not replace the <code>document.getElementById()</code> function of javascript.</p></li> <li><p>Isn't it the role of <code>$()</code> ?</p></li> <li><p>If not, what's the role of <code>$()</code> ?</p></li> </ul> <p>I got to this question because <code>$().outerHeight</code> doesn't work.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
2,064,165
2,064,166
how jQuery $.data() method differs from directly attaching variables to DOM elements?
<p>I can do this:</p> <pre><code>$('#someid').data('dataIdentifier', 'someVariable'); </code></pre> <p>And in my understanding I can do this:</p> <pre><code>document.getElementById('someid').dataIdentifier = someVariable; </code></pre> <p>What are the pros of using jQuery for this versus raw javascript?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
5,120,029
5,120,030
replace in jQuery
<p>Can some one help me in this</p> <p>I had a variable </p> <pre><code>var myValue = "what is you name? what is your age?" </code></pre> <p>i want to find the '?' in the string and replace it with a html input text element</p> <p>where the user can enter the answer in the text box and at last i need a string as out put like this</p> <p>"what is your name my name is xyz what is your age i am 25"</p> <p>Please help me in this</p> <p>Thanks Kumar</p>
javascript jquery
[3, 5]
2,806,778
2,806,779
How can I add elements to this object
<p>If I had this structure </p> <pre><code>var data = { "people": [ { "name" : "John", "id" : 1 }, { "name" : "Marc", "id" : 2 } ] } </code></pre> <p>I want to add more elements to this, in JavaScript, specifically in jQuery to then send it like this</p> <pre><code>var dataString = JSON.stringify(data); $.post('some.php', { data: dataString}, showResult, "text"); </code></pre>
javascript jquery
[3, 5]
3,979,312
3,979,313
Executing client-side script on link click
<p>I need my web page to open a window and enable a disabled button when a link or a button is clicked. From what I've read on other posts on here, if I try and open a new window in Page_load most browsers will assume it's a pop-up and block it so I've been trying to do it client side with JS. </p> <p>Currently, I'm trying it with a link declared like so:</p> <p><code>Please click &lt;a href="javascript:OpenDoc()"&gt;here&lt;/a&gt; to open the document.</code></p> <p>This calls the following JS:</p> <pre><code> function OpenDoc() { &lt;%= btnSubmit.ClientID %&gt;.Visible = true; Window.Open('GetDocument.aspx') } </code></pre> <p>Unfortunately, instead of rending the JS as "btnSubmit.Visible = true" it comes out as "MainContent_btnSubmit.Visible = true" which doesn't work.</p> <p>Assuming this is the best way of doing what I want, where am I going wrong?</p>
c# javascript asp.net
[0, 3, 9]
6,027,848
6,027,849
How to Passing value javascript variable to php?
<p>Passing value JavaScript variable to PHP.</p> <p>Example</p> <p><strong>JavaScript</strong></p> <pre><code>Var ddd='aaaa' </code></pre> <p><strong>PHP</strong></p> <pre><code>if (ddd="aaaa"){do somehting...} </code></pre>
php javascript
[2, 3]
3,015,345
3,015,346
can not use Closure right
<p>I wrote JS function and it must bind the buttons it generates depending on values in the array. But it gives me the last value. I read that i had to use closure, I did, and I'm still not able to bind them right! I'm still a beginner I read about closure, I got the idea but still did not know what I'm missing</p> <pre><code>function addNewServices(newServicesArray){ var j=0; var x; for (i in newServicesArray){ var html=''; html='&lt;div style="width: 33%; float: leftt"&gt;&lt;a href="#" data-role="button" data-icon="home" id="btn-'+newServicesArray[j].servicename+'" value="'+newServicesArray[j].servicename+'" class="ui-btn-up-c"&gt;'+newServicesArray[j].servicename+'&lt;/a&gt;&lt;/div&gt;'; $("#main-menu").append(html); $('#btn-'+newServicesArray[j].servicename).bind('click', function (){bindThis(j)}); j++; } var bindThis = function( j ) { return function() { alert(j); // gives 2 always alert( newServicesArray[j].servicename ); }; }; } </code></pre>
javascript jquery
[3, 5]
1,199,185
1,199,186
How to dynamically keep input field empty when select box option is no?
<p>Ì have form where writing on input field autofills other input field while user types email</p> <pre><code>$("#edit-submitted-yhteystiedot-sahkoposti").keyup(function(){ $("#edit-submitted-saannot-newsletter-newsletter-email-address").val(this.value); }); </code></pre> <p>The thing is that if user does not want to receive newsletter and chooses no option for select box, the Input field with ID #edit-submitted-saannot-newsletter-newsletter-email-address should remain empty, even if user makes changes to default email field. ID of SELECT is #edit-submitted-saannot-haluan-uutiskirjeen</p>
javascript jquery
[3, 5]
212,518
212,519
convert Javascript function to c#
<p>I want to convert following javascript function to c# can anyone help?</p> <pre><code>function parseCoordinate(coordinate,type,format,spaced) { coordinate = coordinate.toString(); coordinate = coordinate.replace(/(^\s+|\s+$)/g,''); // remove white space var neg = 0; if (coordinate.match(/(^-|[WS])/i)) { neg = 1; } if (coordinate.match(/[EW]/i) &amp;&amp; !type) { type = 'lon'; } if (coordinate.match(/[NS]/i) &amp;&amp; !type) { type = 'lat'; } coordinate = coordinate.replace(/[NESW\-]/gi,' '); if (!coordinate.match(/[0-9]/i)) { return ''; } parts = coordinate.match(/([0-9\.\-]+)[^0-9\.]*([0-9\.]+)?[^0-9\.]*([0-9\.]+)?/); if (!parts || parts[1] == null) { return ''; } else { n = parseFloat(parts[1]); if (parts[2]) { n = n + parseFloat(parts[2])/60; } if (parts[3]) { n = n + parseFloat(parts[3])/3600; } if (neg &amp;&amp; n &gt;= 0) { n = 0 - n; } if (format == 'dmm') { if (spaced) { n = Degrees_to_DMM(n,type,' '); } else { n = Degrees_to_DMM(n,type); } } else if (format == 'dms') { if (spaced) { n = Degrees_to_DMS(n,type,' '); } else { n = Degrees_to_DMS(n,type,''); } } else { n = Math.round(10000000 * n) / 10000000; if (n == Math.floor(n)) { n = n + '.0'; } } return comma2point(n); } } </code></pre>
c# javascript
[0, 3]
5,763,707
5,763,708
Remove string after last occurrence of character "/" - Android (JAVA)
<p>In my application, I am appending string to create path to generate URL. Now I want to remove that appended string on pressing back button.</p> <p>Suppose this is the string : </p> <pre><code>/String1/String2/String3/String4/String5 </code></pre> <p>Now I want a string like this: </p> <pre><code>/String1/String2/String3/String4/ </code></pre> <p>How can I do this??</p> <p>Please help me.</p> <p>Thanks</p>
java android
[1, 4]
1,300,105
1,300,106
Android: Is it possible to have dual sim with different ringtone for receiving call for each sim?
<p>Is it possible to set different ringtone for each sim card through which the call receiver can identify the sim that receives the call?</p>
java android
[1, 4]