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,457,877
5,457,878
Does Python have a way to pass arguments through a function
<p>Javascript has a poorly constructed but convenient "arguments" variable inside every function, such that you can pass arguments through a function like so:</p> <pre><code>function foo(a, b, c) { return bar.apply(this, arguments); } function bar(a, b, c) { return [a, b, c]; } foo(2, 3, 5); // returns [2, 3, 5] </code></pre> <p>Is there an easy way to do a similar thing in Python?</p>
javascript python
[3, 7]
2,546,849
2,546,850
How to pass the textbox value in jquery autocomplete
<p>I'm using jquery autocomplete in some textboxes in my web application (.Net 3.5). My problem is the prefix text is always blank. The correct value won't be assigned to it.</p> <pre><code>function TextBoxAutoComplete(scope, controlId, contextKeyId) { var txtbox = null; var flagValue; if (scope) { txtbox = $('input[id$="' + controlId + '"]', scope); } else { txtbox = $('input[id$="' + controlId + '"]', document); } var contextKeyValue = $('input[id$="' + contextKeyId + '"]', document).val(); $(txtbox).autocomplete("../Handlers/MiscHandler.ashx", { minChars: 0, extraParams: { prefixText: $(this).val(), count: '10', contextKey: contextKeyValue, flag: 'codePart' }, selectFirst: false, width: 49 }).result(function(event, data, formatted) { // result is a separate function var dummy = new Object(); dummy.value = data[1]; dummy.text = data[0]; var test = new Test(dummy); }); } </code></pre> <p>I call the above method at document ready. Here the problem is I don't get the textbox value (currently typed text) when i pass it to the variable 'prifixText' <strong>prefixText: $(this).val()</strong></p> <p>Can anyone please help me in solving this issue? Thanks</p>
c# javascript jquery
[0, 3, 5]
1,383,285
1,383,286
php code transfer into js
<p>the javascript code in php is</p> <pre><code>&lt;script language="JavaScript" type="text/javascript"&gt; xajax_getCountry('&lt;?php echo $row['mradio_area']?$row['mradio_area']:0 ?&gt;', &lt;?php echo $row['mradio_country']?$row['mradio_country']:0 ?&gt;, &lt;?php echo ($row['mradio_rate']==1?1:0); ?&gt;); &lt;/script&gt; </code></pre> <p>I want to put it into the .js file.</p> <p>How do I change the <code>&lt;?php echo $row</code> into js format?</p> <p>Thanks a lot for any answer!</p>
php javascript
[2, 3]
4,522,135
4,522,136
Hover using javascript
<p>Here's what I would like to do. I have 2 identical lists that I would like to have change color on hover of a specific item on both lists simultaneously.</p> <p>Example:</p> <p><strong>List One</strong><br/> List Item 1<br/> List Item 2<br/> List Item 3 <br/></p> <p><strong>List Two</strong><br/> List Item 1<br/> List Item 2<br/> List Item 3 <br/></p> <p>So if you were to hover over List One's first item it would highlight List Two's first item also.</p> <p>Any help on this would save my life thanks very much. V</p>
javascript jquery
[3, 5]
3,421,943
3,421,944
Which technique is better?
<p>Which technique is better:</p> <pre><code>&lt;span onclick="dothis();"&gt;check&lt;/span&gt; </code></pre> <p>or:</p> <pre><code>&lt;span class="bla"&gt;check&lt;/span&gt; &lt;script type="text/javascript"&gt; $('.bla').click(function(e) {} ); &lt;/script&gt; </code></pre> <p>Are there any differences according to usability, performance etc.?</p> <p>Thank you!</p>
javascript jquery
[3, 5]
104,972
104,973
jQuery Trim String by Width
<p>I want to trim a string down to a particular pixel width so that it can properly fit in a container. It will be similar to substring, except that I am trimming based on pixel width as opposed to number of characters. is there a built in function for this?</p>
javascript jquery
[3, 5]
2,701,526
2,701,527
Javascript disable button event completely
<p>Hi I would like to know if its possible to do something similar to the example shown below.</p> <pre><code>// Script A $('.submitButton').click(function() { if (not valid) { $(this).attr("disabled", "disabled"); } }); // Script B $('.submitButton').click(function() { // Do something else here }); </code></pre> <p>I would like to know whether you can actually stop the click event in <strong><em>Script B</em></strong> if not valid in <strong><em>Script A</em></strong>. The reason for the two events being separate is due to the fact that <strong><em>Script A</em></strong> will be used as a sort of a plugin module which will be inserted at the header of the page.</p>
javascript jquery
[3, 5]
5,772,888
5,772,889
ASP.NET CompositeScript Path results in 404
<p>If I use the CompositeScript feature of the ASP.NET ScriptManager/ScriptManagerProxy controls, I cannot get the Path attribute to work:</p> <p>My code</p> <pre><code>&lt;asp:ScriptManagerProxy ID="scriptProxy2" runat="server"&gt; &lt;CompositeScript Path="~/Includes/Javascript/Combined.js"&gt; &lt;Scripts&gt; &lt;asp:ScriptReference Path="~/Includes/Javascript/MyFile1.js" /&gt; &lt;asp:ScriptReference Path="~/Includes/Javascript/MyFile2.js" /&gt; &lt;/Scripts&gt; &lt;/CompositeScript&gt; &lt;/asp:ScriptManagerProxy&gt; </code></pre> <p>My page gets the correct script tag in it:</p> <pre><code>&lt;script src="../Includes/Javascript/Combined.debug.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>But of course, that file doesn't exist and so the browser gets a 404.</p> <p>Am I missing something?</p>
javascript asp.net
[3, 9]
2,994,747
2,994,748
PHP variable not passing correctly to Javascript
<p>I am trying to validate input login via javascript by passing PHP variables. I cannot execute it properly for some reason. I'd appreciate your comments. Here's the code:</p> <p>PHP:</p> <pre><code>$personal = mysqli_query($connect,"SELECT * FROM basic ORDER BY user_id DESC "); while($row = mysqli_fetch_array($personal)){ $user = $row['username']; $user_password = $row['password']; } </code></pre> <p>Javascript / jQuery:</p> <pre><code>function enter_log() { var login_username = $("#username_field_log"); var pass_password = $("#pass_field_log"); var button = $("#enter_field_log"); var php = "&lt;?= echo $user; ?&gt;"; if ((login_username.val() == "") || (pass_password.val() == "")) { $("#user_log_info").fadeIn('slow'); $("#user_log_info").text("Not a proper login input"); login_username.addClass("error"); pass_password.addClass("error"); return false; } else if ((login_username.val() != php ) || (pass_password.val() == "")) { $("#user_log_info").fadeIn('slow'); $("#user_log_info").text("Not a proper login input"); login_username.addClass("error"); pass_password.addClass("error"); return false; } } </code></pre> <p>So in other words - the code should return false ( and it does so ) when the fields are empty but it doesn't return TRUE when the input is correct ( I mean when the username is correct ) so I assume the PHP variable <code>$user</code> is not passed by correctly to javascript?</p>
php javascript jquery
[2, 3, 5]
3,525,868
3,525,869
How to convert a currency string to a double with jQuery or Javascript?
<p>I have a text box that will have a currency string in it that I then need to convert that string to a double to perform some operations on it. </p> <p>"$1,100.00" -> 1100.00</p> <p>This needs to occur all client side. I have no choice but to leave the currency string as a currency string as input but need to cast/convert it to a double to allow some mathematical operations. </p>
javascript jquery
[3, 5]
932,116
932,117
__doPostBack is not working in firefox
<p>The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&amp;7 and it even works in Chrome??</p> <p>It's a simple asp:LinkButton with an OnClick event</p> <pre><code>&lt;asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you want to delete all pictures? \n This action cannot be undone.');" OnClick="DeletePictureLinkButton_Click" CommandName="DeleteAll" CssClass="button" runat="server"&gt; </code></pre> <p>The javascript confirm is firing so I know the javascript is working, it's specirically the __doPostBack event. There is a lot more going on on the page, just didn't know if it's work it to post the entire page.</p> <p>I enable the control on the page load event.</p> <p>Any ideas?</p> <p><hr /></p> <p>I hope this is the correct way to do this, but I found the answer. I figured I'd put it up here rather then in a stackoverflow "answer"</p> <p>Seems it had something to do with nesting ajax toolkit UpdatePanel. When I removed the top level panel it was fixed.</p> <p>Hope this helps if anyone else has the same problem. I still don't know what specifically was causing the problem, but that was the solution for me.</p>
c# asp.net
[0, 9]
4,757,182
4,757,183
is it possible to open a popup when a checkbox is checked using jquery?if yes how?
<p>In my application i have popup box whichis initially hidden and there is a checkbox.so when a user checks the checkbox a popupup should open .please help...</p>
javascript jquery
[3, 5]
1,537,302
1,537,303
How to check text file it contains delimiter at the end or not?if it is there how to remove it?
<p>actually i have text file with columns and rows colsep is "'" and row sep is "/" and my text file is sfsf'fsfsdf'sdfsdf/dfsdf'sfsf'sfsfs/</p> <p>if my text file contains "/" at the end of the file how to check and remove it it is there</p>
c# asp.net
[0, 9]
5,878,622
5,878,623
How-To jQuery alert boxes for beginner
<p>Apologies if this is overly basic, but I couldn't find much info with my searches.</p> <p>I have a simple link: <code>&lt;a href="delete"&gt;delete&lt;/a&gt;</code>.</p> <p>Clicking the link deletes an item from my database.</p> <p>How do I make the link show a popup (JavaScript <code>alert</code> box?) with a message:</p> <blockquote> <p>Are you sure? [Yes] [No]</p> </blockquote> <p>I'd like to use jQuery instead of inline JavaScript, if possible.</p>
javascript jquery
[3, 5]
1,772,981
1,772,982
jQuery 'Enter' and 'ESC' simulation
<p>I want to simulate a couple of clicks. A 'Save' and 'Cancel' anchor clicks.</p> <p>I have this as my enter simulation</p> <pre><code>$('.group').live('keypress', function(e){ code = e.keyCode ? e.keyCode : e.which; if(code.toString() == 13){ $(this).find('a.saveChanges').click(); } }); </code></pre> <p>and this as my esc simulation</p> <pre><code>$('.group').live('keypress', function(e){ code = e.keyCode ? e.keyCode : e.which; if(code.toString() == 0){ $(this).find('a.discardChanges').click(function(){ GROUP.find('.group-text') .text(GROUP.data('origText')) .end().removeData('origText'); GROUP.find('.groupcount').fadeIn('slow'); GROUP.find('.group-image').fadeIn('slow'); GROUP.removeClass('editmode'); }); } }); </code></pre> <p>My enter seems to work perfect, but my esc doesn't. I'm running this in Firefox at the moment.</p>
javascript jquery
[3, 5]
3,709,690
3,709,691
How to display List items in Listview?
<p>I have a ListView in my aspx file like this:</p> <pre><code>&lt;asp:ListView ID="ListView1" runat="server"&gt;&lt;/asp:ListView&gt; </code></pre> <p>and then I have List like this:</p> <pre><code>List&lt;string&gt; mylist = new List&lt;string&gt;(); </code></pre> <p>Im trying to populate the ListView like so:</p> <pre><code>foreach(string elem in mylist) { ListView1.Items.Add(new ListViewItem(elem)); } </code></pre> <p>But my compiler is telling me best overload match error &amp; cannot convert string to ListViewItem. This is a asp.net 4.0 web app. Any suggestions?</p>
c# asp.net
[0, 9]
528,864
528,865
Restrict Asp:TextBox to not allow more than 6 character in it
<p>I want to restrict the user that he cant enter more than 6 characters in a text box.As a user start entering in the text box and reach to the max limit and try entering 7th character, the text box will not allow him to do so and alert him that max size reached.How i achieve this?</p> <p>I had added JavaScript function in my code to do so but not getting that on which event i call this function , currently i am calling on on-blur but i m able to type more than 9 character in the text box and after that when i m clicking on a button then i m getting alert message.i want that while typing in the text box itself if max limit reached the user get prompted.My Current code is as follow:-</p> <pre><code> &lt;asp:TextBox ID="txtVolumeProcessed" runat="server" CssClass="text" MaxLength="999999" onblur="javascript:validate();" &gt;&lt;/asp:TextBox&gt; </code></pre> <p>and the Javascript Code is:-</p> <pre><code>function validate() { if (document.getElementById('&lt;%=txtVolumeProcessed.ClientID%&gt;').value.length &gt; 7) { alert("Volume Processed not exceed 999999"); document.getElementById('&lt;%=txtVolumeProcessed.ClientID%&gt;').select(); document.getElementById('&lt;%=txtVolumeProcessed.ClientID%&gt;').focus(); return false; } else { return true; } } </code></pre>
javascript asp.net
[3, 9]
5,883,260
5,883,261
go to page after the page is loaded
<p>okay so on my home page i'm doing a user name and password check and then im using jquery document.location to send you to a logged in page say secure.php.... while this works it sends you to secure.php first and then images start loading ... how can i do it in such a way that it loads the entire page and then send you to secure.php</p> <p>example : -</p> <pre><code> $.ajax ({ url: loginCheck.php, type: 'POST', data: username + password , success: function (check){ if(check==1) document.location= /loginpage/secure.php else alert(invalid username or pass) } }); </code></pre>
php javascript jquery
[2, 3, 5]
18,019
18,020
How can I capture the blur and focus of the entire browser window?
<p>I would like to capture the blur and focus of the actual browser window - meaning that change of focus to child frames is not of interest.</p> <p>Currently I have been using <code>$(top).focus()</code> <code>$(top).blur()</code></p> <p>and <code>$(window).focus()</code> <code>$(window).blur()</code></p> <p>However, these fire when the user changes focus to embedded iframes, which I don't want.</p> <p>Does anyone know of a way to capture TRUE activation and deactivation of the window?</p> <p>[EDIT]</p> <p>Blur and focus events fire when a user moves from a web-page, to the web-page of an embedded iframe. This is different from 'window activation' events, which only fire when the actual BROWSER WINDOW (or tab) is brought to the front, or sent away (i.e, tab changed, or minimized).</p> <p>I am not interested in blur, because the fact that the user has navigated to an embedded frame is of no consequence to the program. However, if the user minimizes the window, changes tabs, or switches to another program, I want to know about it...</p>
javascript jquery
[3, 5]
2,658,349
2,658,350
Persisting XML parsed object
<p>I am using an xml parser to parse the login response from a request to a server. The xml content returns me <code>sensitive data</code> that uniquely identifies a client so i can fetch more details about the client in other part of my app later on. </p> <p>In iOS, i would just create an object from the parsed values to hold the <code>clientAuthenticationDetails</code> and access it from anywhere else in the app using the <code>appDelegate</code> instance. </p> <p>Is there a way for me to do the same in Android? I have read up on <code>SharedPreferences</code> but i am not sure if that is how others implement this sort of functionality or how <code>secure</code> it is since i do have sensitive client data in the response.</p>
java android
[1, 4]
2,727,687
2,727,688
How can I set the background color in CSS by receiving the color value dynamically?
<p>I'm using the following code: </p> <pre><code>&lt;style&gt; .color-3 { background-color: &lt;%= this.BckColor %&gt;; } &lt;/style&gt; </code></pre> <p>to receive a value from a C# page. My C# code receives a background image color from a page called 'settings' page, and the C# code is:</p> <pre><code> string BckColor ="#" + Convert.ToString((Settings["DOTCOLOR"])); </code></pre> <p>but when I do this, the background color is missing. How can I solve this?</p>
c# asp.net
[0, 9]
2,056,650
2,056,651
jquery multiple and changing ids selectors
<p>i got a simple qiestion, i want to show and hide my divs according to their idies, but couldnt figure out, for example i have a different divs and inputs with different ids:</p> <pre><code>&lt;input onfocus="showtip(1)" onblur="hidetip(1); /&gt; &lt;div id="tip1"&gt;&lt;/div&gt; &lt;input onfocus="showtip(2)" onblur="hidetip(2); /&gt; &lt;div id="tip2"&gt;&lt;/div&gt; </code></pre> <p>and</p> <pre><code>function showtip(id) { $('.tip[id]').show('slow'); } function hidetip(id) { $('.tip[id]').hide('slow'); } </code></pre> <p>i can write it in javascript, to make it work, but i cant hide it with animation, thus i used jquery, but i can't define ids :( thank you all for the help! i really appreciate it!</p>
javascript jquery
[3, 5]
747,413
747,414
Should I make a method static that will be used across many aspx.cs files
<p>I have a method with the following signature:</p> <pre><code>string GetTableCellValue(DataTable table, string columnName, int rowIndex){} </code></pre> <p>As you might guess, this method returns the value of the cell located at the specified column of the specified row of the specifies table in string format. It turns out that I need this methods almost in all the webpages. Here's my quetion(s):</p> <ol> <li>Should I put this method in all the code files or?</li> <li>Should I have it as a static method of some class, like Utilities_Class or?</li> <li>Should I have it as a public NON-STATIC method of some class , like Utilities_Class?</li> </ol> <p>The last 2 choices seem to be better idea. But I don't know which one to choose eventually.</p>
c# asp.net
[0, 9]
4,100,328
4,100,329
Converting PHP code in Java
<p>I'm a PHP programmer starting my adventures in Java and I was trying to create a function in an auction program to award my suppliers (it's something really simple, that I am using just for doing some tests). </p> <p>As I wasn't finding a way to do this, I decided to write a sketch of how I could possibly do that in PHP and ask you here how could I transform this PHP code into Java:</p> <pre><code> $aux = null; $val = null; foreach (this-&gt;auction-&gt;getBids() as $bid) { if ($aux == null) { $aux = $bid-&gt;getValue(); } else { if ($bid-&gt;getValue() &gt; $aux) { $aux = $bid; } } } </code></pre> <p>just because u complained, I was starting doing something like this:</p> <pre><code>public void award() { for (int i = 0; i &lt; this.auction.getBids().size(); i++) { this.auction.getBids().get(i).getSupplier().getName(); this.auction.getBids().get(i).getProduct().getName(); this.auction.getBids().get(i).getBidTime(); this.auction.getBids().get(i).getValue(); } </code></pre> <p>I don't know how to do the same thing I can do using Php... something like a foreach, accessing the object...</p>
java php
[1, 2]
5,043,110
5,043,111
preloading page between two asp.net pages
<p>I posed a question that related where I could display "Page loading" in asp.net page using JQurey. But, I had no luck. </p> <p>So, say I have page1 and it navigates to page2 and page2 doesnt some heavy data access. Is there any way I could show the "preloading" page while the page2 is finished.</p> <p>I want to navigate from Page1 -> "Preload" -> Page2(once page2 is completed).</p> <p>I want to know if this is possible using javascript in the code behind.</p> <p>Thanks.</p>
javascript asp.net
[3, 9]
3,186,889
3,186,890
jQuery .toggle() called by window.setInterval() not functioning
<p>I am trying to alternate between two logos every 5 seconds using the following code:</p> <pre><code>window.setInterval( function () { //breakpoint 1 $("#logo").toggle( function() { //breakpoint 2 $(this).attr('src', '/Images/logo1.png'); }, function() { //breakpoint 3 $(this).attr('src', '/Images/logo2.png'); } ); }, 5000 ); </code></pre> <p>I can get a simple toggle to work, but when I introduce the toggle within window.setInterval(), the toggle's two handlers won't fire.</p> <p>I set breakpoints on the lines directly beneath the comments in the code above. Breakpoint 1 hits every 5 seconds. However, Breakpoint 2 and 3 never hit.</p> <p>Why are neither of the toggle function's handlers firing?</p>
javascript jquery
[3, 5]
4,508,380
4,508,381
Database Transactions in Java on Android
<p>I am trying to translate some of the code of Objective C in Java...</p> <pre><code>[_db beginTransaction]; Date now = [[NSDate alloc] init]; boolean result = [_db executeUpdate:updateQuery, [self stringToDB:account.userId], [self integerToDB:account.accountId], [self integerToDB:account.accountType], [self stringToDB:account.accountName], ]; [_db commit]; return true; </code></pre> <p>Can anyone tell me how can i implement <code>BeginTransaction and Commit</code> in Java?</p>
java android
[1, 4]
354,148
354,149
Why returns different value when use & operator in JavaScript and C#?
<p>I have worked the same process in JavaScript and C# with the &amp; operator, but the result was different.</p> <p><strong>C# Code</strong></p> <pre><code>Int64 x = (634586400000000000 &amp; 4611686018427387903); x= 634586400000000000; </code></pre> <p><strong>JavaScript Code</strong></p> <pre><code>var x = (634586400000000000 &amp; 4611686018427387903); x= 0; </code></pre> <p>Any ideas?</p>
c# javascript
[0, 3]
619,242
619,243
How do I assign a PHP array to a JS array?
<p>Below is my code where the <strong>php array $keys</strong> assigned to a <strong>JS array var keysArr</strong>, But the value display on the alert box is not correct.</p> <p>Thus, there is something wrong on assign Php array to Js array.</p> <p>Can anyone help me? Thanks in advance!</p> <pre><code>&lt;?php $keys = array(1, 2, 3, 4); ?&gt; &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; var keysArr = &lt;?php print $keys?&gt;; for (var i = 0; i &lt; keysArr.length; ++i){ alert(keysArr[i]); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
php javascript
[2, 3]
4,363,355
4,363,356
use jquery to build form
<p>I have an html table that pulls data from a DB. It has an edit button:</p> <pre><code>&lt;button id="editbutton" onClick='edit2("&lt;?php echo htmlentities($_SERVER['REQUEST_URI']); ?&gt;","&lt;?php echo $result_cameras[$i]["camera_name"]; ?&gt;", "&lt;?php echo $camera_quality; ?&gt;", "&lt;?php echo $camera_status; ?&gt;", "&lt;?php echo $email_notice; ?&gt;", "&lt;?php echo $result_cameras[$i]["camera_hash"]; ?&gt;")'&gt;Edit&lt;/button&gt; </code></pre> <p>I'm just passing in a number of things that I need to build the form. So that when the edit button is clicked it will create a form in javascript:</p> <pre><code>function edit2(to, cameraname, cameraquality, camerastatus, emailnotice, camerahash) { var mydiv = document.getElementById("editform"); var myForm = document.createElement("form"); myForm.method = "post"; myForm.action = to; var label = document.createElement("label"); label.for = "text"; label.innerHTML="Camera name: "; myForm.appendChild(label); myInput = document.createElement("input"); myInput.setAttribute("name", "camera_name"); myInput.setAttribute("value", cameraname); myForm.appendChild(myInput); mydiv.appendChild(myForm); } </code></pre> <p>Right now this contains only the processing for cameraname just for a proof point (which works). So now to the question. I'm starting to add some stuff with jquery so I also have:</p> <pre><code>var js = jQuery.noConflict(); js(document).ready(function(){ js('#webcamform').hide(); //initially hide form js("#editbutton").click(function(){ js('#webcamform').show();//Form shows on button click }); }); </code></pre> <p>I want to add more neat jquery stuff. Keeping in mind that I can't use Ajax at this point (Joomla reasons), should I combine this? All in jquery? How? Thanks in advance. </p>
javascript jquery
[3, 5]
506,680
506,681
jQuery: get the size of the overflowed div after appending more content
<p>The div:</p> <pre><code>&lt;div id="hilo" style="width:48%;height:380px;overflow:auto;float:right;"&gt; </code></pre> <p>The Javascript:</p> <pre><code>$('#re').click(function() { var error = 0; if($("#texto").val() == ""){ $("#texto").css("border","solid 1px #990000"); error = 1; } if(error == 1){ return false; } else { var texto = $("#texto").val(); var conv = $(this).attr("name"); $.ajax({ type: "POST", url: "ajaxHilo.php", cache: false, data: { 'texto' : texto, 'conv_id' : conv, 'regresar' : 'ultimo' }, success: function(data,status){ $("#hilo").append(data); $("#texto").val(""); var hei = $('#hilo').prop('scrollHeight'); alert(hei); $("#hilo").animate({ scrollTop: hei}, 500); return false; }, error: cualquierError }); } }); </code></pre> <p>the element with the id = re is a button.</p> <p>I get the strangest results for the size of the overflowed divs, the script inserts a new div into the div hilos with just two lines of new content every time, no more than 30 or 40 pixels each, however, the count starts in 1473 and then jumps to 2193 and then 2913 and so on...</p> <p>Firefox scrolls to the bottom but IE gives me different numbers (smaller ones) and don't scroll to the bottom at all...</p> <p>I hope is not too confusing...</p>
javascript jquery
[3, 5]
4,738,300
4,738,301
escape quotes in jquery selector not working
<p>In the code below how do I escape the double quotes in <code>"</code>myClass<code>"</code></p> <p>I tried <code>\"</code>myClass<code>\"</code> but its not working</p> <pre><code>var s = '&lt;span onclick="$($(this).text()).addClass("myClass")"&gt;test&lt;/span&gt;'; </code></pre>
javascript jquery
[3, 5]
3,095,523
3,095,524
How can I SlideToogle in repeater with anchor or linkbutton?
<p>I have a repeater, anchor tag and div tag inside it. The anchor has a jquery which is doing slidetoggle. But for example if I have 5 items in repeater div count is also 5 and when I click the anchor all divs are doing slidetoggle.</p> <p>If I use itemcommand it's ok, but this time js is not working. Because I'm using linkbutton and it has no click event as you know. So is there any solution to fix it? Here is my repeater and js.</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="jquery-1.8.4.js"&gt;&lt;/script&gt; &lt;script src="jquery-ui-1.9.2.custom.js"&gt;&lt;/script&gt; &lt;script src="jquery-ui-1.9.2.custom.min.js"&gt;&lt;/script&gt; &lt;script&gt; $(function () { $('[id*=aNotice]').click(function () { $('[id*=dvContent]').slideToggle(400); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Repeater ID="rptNotice" runat="server"&gt; &lt;ItemTemplate&gt; &lt;a id="aNotice" runat="server"&gt;click to see toggle&lt;/a&gt; &lt;div id="dvContent" runat="server"&gt;&lt;%#Eval("content") %&gt;&lt;/div&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery asp.net
[5, 9]
2,022,855
2,022,856
Get full query string in C# ASP.NET
<p>As a PHP programmer I'm used to using $_GET to retrieve the HTTP query string... and if I need the whole string, theres loads of ways to do it. </p> <p>In ASP however, I can't seem to get the query.</p> <p>Here is the code for news.aspx (embedded in some HTML):</p> <pre><code>&lt;% string URL = "http://www.example.com/rendernews.php?"+Request.Querystring; System.Net.WebClient wc = new System.Net.WebClient(); string data = wc.DownloadString(URL); Response.Output.Write(data); %&gt; </code></pre> <p>I am fetching a PHP script's output from a remote server, and this works perfectly without the Request.Querystring. </p> <p>The issue is that I'm trying to get the full query string on the first line: Request.Querystring. I am getting an error "<em>Object reference not set to an instance of an object</em>" which basically means that Request.Querystring doesn't exist.</p> <p>Any idea what the problem is here? How can I get that query string so when index.aspx is called like <a href="http://test.com/news.aspx?id=2" rel="nofollow">http://test.com/news.aspx?id=2</a> my script fetches <a href="http://www.example.com/rendernews.php?id=2" rel="nofollow">http://www.example.com/rendernews.php?id=2</a></p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
50,134
50,135
Execute a function when a <link> element has finished loading
<p>I'm using <a href="http://desandro.com/resources/jquery-masonry/" rel="nofollow">jQuery Masonry</a> to lay out my page, but I'm using a custom @font-face font. The problem being that Masonry doesn't know the metrics of the font until it's loaded.</p> <p>The Masonry docs suggest that you use <code>$(window).load()</code> instead of <code>$(document).ready()</code> to call the layout functions, but I don't want to have to wait until all the images etc. load. I can specify the dimensions of the images exactly, so Masonry doesn't need to wait until they're loaded. It's just the text that's the problem.</p> <p>How can I get jQuery to call a callback when the <code>&lt;link&gt;</code> element that links in the font finishes loading?</p> <p>EDIT: The obvious solution (that is, <code>$('#link_id').load(...)</code>) doesn't seem to work.</p> <p>EDIT2: I didn't realise (stupid of me) that the <code>&lt;link&gt;</code> element is actually linking in a <em>stylesheet</em> with a @font-face declaration. I want to wait until the <em>font</em> has been loaded, not just the stylesheet...</p>
javascript jquery
[3, 5]
3,940,058
3,940,059
javascript - change the alpha of an image
<p>How can I change the alpha of an image in javascript? Also, what browsers support this?</p>
javascript jquery
[3, 5]
4,293,987
4,293,988
How to map java's AffineTransform to android's Matrix?
<p>Suppose I initialize an AffineTransform as below:</p> <p>AffineTransform af = new AffineTransform(2, 3, 4, 5, 6, 7);</p> <p>How would I create an equivalent Matrix using android's sdk?</p>
java android
[1, 4]
799,214
799,215
How to append/prepend/create a text node with jQuery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/944436/escaping-text-with-jquery-append">Escaping text with jQuery append?</a> </p> </blockquote> <p>My HTML is somewhat like this:</p> <pre><code>&lt;div id="selector"&gt;Hello World&lt;/div&gt; </code></pre> <p>Now I'd like to append some text to this div. I know that I could simply use</p> <pre><code>$('#selector').append(text); </code></pre> <p>but this wouldn't escape any special characters in <code>text</code>. Another way is to wrap the text in a span:</p> <pre><code>$('#selector').append( $('&lt;span&gt;').text(text) ); </code></pre> <p>But this is ugly, because it creates unnecessary markup. So my current solution is to manually create a TextNode:</p> <pre><code>$('#selector').append( document.createTextNode(text) ); </code></pre> <p>I was wondering whether there is any <em>jQuery-style</em> way to do this?</p>
javascript jquery
[3, 5]
4,351,889
4,351,890
Html returned as a response to a jQuery ajax call
<p>My jQuery function is making a ajax call (GET request) and it has to return HTML that I will then inject in the page in the success event.</p> <p>What do I have to escape in the HTML to ensure there aren't any issues?</p>
c# jquery asp.net
[0, 5, 9]
5,130,179
5,130,180
Would porting parts of a PHP application to Python help it scale?
<p>I appreciate there are perhaps better ways of making a PHP application scale than the above, however I'm wondering more on principle. From what I've heard, Python is faster than PHP and I'm trying to decide which language to learn next, as a PHP developer. </p>
php python
[2, 7]
348,019
348,020
JQuery Calendar control only appears once when clicking on textbox
<p>I have a JQuery calendar which works perfectly on my webpage but only once. After i select the date and i try to click on the textbox to change the date the calendar doesn't appear.</p> <p>here is my code ` </p> <pre><code> $(document).ready(function () { $("#&lt;%= txtDatePicker.ClientID %&gt;").datepicker(); }); </code></pre> <p>`</p> <pre><code>&lt;asp:TextBox ID="txtDatePicker" runat="server" OnTextChanged="txtDatePicker_TextChanged" AutoPostBack="True" &gt;&lt;/asp:TextBox&gt; </code></pre>
jquery asp.net
[5, 9]
134,053
134,054
Registering JavaScript code in server control
<p>I need some help with jQuery. At the moment I am building my server control that has div in it. Inside that div there is an iFrame. I want to be able to resize my div with jQuery. I have acomplished this through simple samples. </p> <p>As Ive said, Im building a server control so I cannot add jQuerry manually on every page. It should be automated in a way that when I drag drop my control on designer surface I don't have to worry about resizing the Div.</p> <p>Currently I am registering all the relevant *.js files in master page. I have a child page wich inherits master page. On that page I have my control. I cannot make a *.js file and register it as I can have multiple instances of same control. </p> <p>Where do I register my script block? How is it done?</p> <p>Any clarification on this would be highly appreciated.</p> <p>Thank you in advance.</p>
jquery asp.net
[5, 9]
5,849,838
5,849,839
Unable to get JavaScript functionality to work in any browser besides Firefox?
<p>I'm having difficulty getting some JavaScript features to work in any other browser besides Firefox. I tried Chrome, Safari, IE and they all seem to produce a similar pattern of problems. In particularly when you click each one of the colored bars (try it in Firefox and it'll work properly), the containers do not open.</p> <p>My site: <a href="http://crossborders.tv/client/frisbie/brian/" rel="nofollow">http://crossborders.tv/client/frisbie/brian/</a></p>
javascript jquery
[3, 5]
5,022,173
5,022,174
How long is a piece of $string… too long… javascript P2
<p>How can I convert this PHP code to JavaScript?</p> <pre><code>$string = "string How Long is a Piece of String?"; if (strlen($string) &lt; 5) { echo "string is less than 5"; } else { echo "string is more than 5"; } </code></pre>
php javascript
[2, 3]
2,258,349
2,258,350
Variable passed into .on() function always is the last element
<p>I'm sort of emulating Backbone's event system with an object like this:</p> <pre><code>var events = { 'click .one': 'fnOne', 'click .two': 'fnTwo', 'click .three': 'fnThree' } </code></pre> <p>Then to set the event listeners with jquery I'm using the following:</p> <pre><code>var method, match, event_name, selector; var scope = { // Complex object literal passed to the event's // function for access... }; var delegateEventSplitter = /^(\S+)\s*(.*)$/; for (key in events) { if (events.hasOwnProperty(key)) { method = events[key]; match = key.match(delegateEventSplitter); event_name = match[1]; selector = match[2]; $('#element').on(event_name,selector,function(event){ method(event,scope); }); } } </code></pre> <p>The problem I'm having is that it's binding correctly except all of the events fire the last function <code>fnThree</code></p>
javascript jquery
[3, 5]
3,547,495
3,547,496
Call onBlur event only when tab key is pressed
<p>I have a textbox on which i want to execute onBlur event only when tab key is pressed to remove focus from textbox.</p> <p>How can i do this through javascript??</p> <p>Any help is appreciated..</p>
javascript asp.net
[3, 9]
2,992,794
2,992,795
Building custom controls
<p>I try to build my own GUI controls for game, i need to implement control with functionality like TextEdit, but i don't know how to call keyboard and get result from it.</p>
java android
[1, 4]
5,805,519
5,805,520
Android - Same content in multiple tabs
<p>My application consists of a tab layout with six tabs. Each tab represents a player in a game.</p> <p>I would like the activities within each tab to contain the exact same XML layout and code as the activities in the other tabs. Each player will get access to the same widgets and input fields.</p> <p>Is there a way to write one activity and have each tab use that activity as a template? I am trying to avoid copying the code for the six activities.</p>
java android
[1, 4]
3,797,603
3,797,604
C# application fails to call a method from C++ DLL/Project
<p>I try to integrate Web Camera support into C# solution. 1st of all I have learnt the nice example from Touchless.Vision. It contains C# solution with 3 components : - one windows form project (C#, Any CPU) - one wrapper project (C#, Any CPU) - WebCamLib project (C++, x64)</p> <p>I use Win7 x64. So the example works fine. At least from the moment when I changes Platform target from Win32 to x64 for C library/project.</p> <p>But then I have added two projects (C# wrapper and C++ project) under another C# solution. Now it always fails when it calls a method from C++ project.</p> <pre><code>System.BadImageFormatException was unhandled by user code Message="Could not load file or assembly 'WebCamLib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format." Source="Touchless.Vision" FileName="WebCamLib, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" FusionLog="" StackTrace: at Touchless.Vision.Camera.CameraService.&lt;BuildCameraList&gt;d__0.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source) at Touchless.Vision.Camera.CameraService.get_AvailableCameras() in C:\CustomWare.NET\CustomWare\WebCamWrapper\Camera\CameraService.cs:line 40 </code></pre> <p>The solution uses AnyCPU platform as well. I think there should not be any conflicts based on platform. </p> <p>What can be the different between these two cases? What should I check?</p>
c# c++
[0, 6]
1,579,042
1,579,043
Finding html source code between two html tag using java
<p><strong>Finding html elements by id</strong> </p> <p>In my project i want to something like this example</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;table &gt; &lt;tr&gt; &lt;td&gt;first column&lt;br&gt;&lt;/td&gt; &lt;td&gt;second column&lt;/td&gt; &lt;td&gt;third column&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I want the html source code between <code>&lt;tr&gt;&lt;/tr&gt;</code> tag. output:</p> <pre><code>&lt;td&gt;first column&lt;/td&gt; &lt;td&gt;second column&lt;/td&gt; &lt;td&gt;third column &lt;/td&gt; </code></pre> <p>I am successfully done find value of tag but in my project i want html source code. I am use htmlcleaner library for finding value. Is there any library available or method in htmlcleaner?</p>
java android
[1, 4]
2,378,552
2,378,553
Android: How do I allow access to only part of an objects members using an interface
<p>How do I "pass an interface", i.e. what CommonsWare suggested to the asker in the <a href="http://stackoverflow.com/questions/2719433/getting-reference-to-calling-activity-from-asynctask-not-as-an-inner-class">question below</a>?></p> <blockquote> <p>The other is to make DownloadFileTask public and pass something into the constructor. In this case, to minimize coupling, it may be that you don't want to pass an Activity, <strong>but some other sort of interface that limits what the AsyncTask can do.</strong> That way, you can choose to implement the interface on an Activity, or as a separate object, or whatever. – CommonsWare Apr 27 '10 at 17:44</p> </blockquote> <p>How do I allow a thread to access to only some (or just one) of the objects public methods?</p> <p>Answer> See the answers below. </p> <p>The real problem was my misunderstanding of what an interface does. If the input type of a method F (or parameterization of a class) is specified as an interface [i.e. F(my_interface i)], and an object X is passed to that method which implements my_interface [F(X)], then only the members of X which implement my_interface will be accessible to the method F even if other members exist. </p> <p>I thought an interface put a constraint only on the implementing class. I didn't understand that when an interface was used as a type it would also constrict access to the members of the implementing class. In retrospect, given that Java is statically typed this is obvious. See the <a href="http://download.oracle.com/javase/tutorial/java/IandI/summary-interface.html" rel="nofollow">Java tutorial</a> for more info.</p>
java android
[1, 4]
3,874,488
3,874,489
ASP.NET C# - How to retain value after Response.Redirect
<p>I'm working in ASP.NET c# application. I came to a part where I need to retain some value after response.redirect to the same page <strong>without using additional QueryString or Session</strong>, because Session more or less may burden the server's performance even just a small value.</p> <p>Below is my code fragment:</p> <pre><code> protected void ddl_SelectedIndexChanged(object sender, EventArgs e) { string id = ddl.SelectedValue; string id2 = ddl2.SelectedValue; Response.Redirect("http://sharepoint2007/sites/home/Lists/CustomList/DispForm.aspx?ID=" + id); } </code></pre> <p>I wanted to retain the value id2 after the Response.Redirect, I've tried ViewState but seem like after the redirect, it treat the page as new page and ViewState value gone.</p> <p><strong>Update:</strong></p> <p>My intention to retain the value after redirect is wanted to bind back the dropdownlist selected value.</p> <p>Please help.</p> <p>Thank you in advanced.</p>
c# asp.net
[0, 9]
3,944,028
3,944,029
How to include jQuery in ASP.Net project?
<p>I've read that Microsoft now <a href="http://weblogs.asp.net/scottgu/archive/2008/09/28/jquery-and-microsoft.aspx" rel="nofollow">bundles jQuery with Visual Studio</a>. How then do I "include" the jQuery source in my ASP.Net project?</p>
asp.net jquery
[9, 5]
5,201,841
5,201,842
Serving Python website on it's own server next to apache serving other websites
<p>I have Apache server serving several PHP driven websites. I'm developing a websites in Python/Pyramid and want to host it on the same server. What options do I have available?</p>
php python
[2, 7]
1,507,240
1,507,241
How to sort a customized listview alphabatically?
<p>I have a customlist view with an ImageView and a textview. I am retrieving that list view by this method:</p> <pre><code>private List&lt;Currency&gt; getModel() { List&lt;Currency&gt; list = new ArrayList&lt;Currency&gt;(); for (int i = 0; i &lt; countryCode.length; i++) { list.add(get(countryCode[i], flag[i])); } return list; } </code></pre> <p>this method returns a list of an image and a textview in a particular list item, and I am setting this in a adapter to show it in a listview. But how can I sort this list by alphabetically comparing with the text of that text view in the list? I have tried this</p> <pre><code>Collections.sort(list, new Comparator&lt;String&gt;() { @Override public int compare(String s1, String s2) { return s1.compareToIgnoreCase(s2); } }); </code></pre> <p>but this method only works for string types list, but my list is not in string type? What to do?</p>
java android
[1, 4]
2,397,669
2,397,670
What is "i" in "function(i)" in the following JavaScript?
<p>In the following code there is "function(i)", but "i" hasn't been declared anywhere previous to this statement.</p> <pre><code>ul.css({width: 10, overflow: 'visible'}).retarder(100, function(i){ i.css('visibility', 'visible').animate( {width: ul[0].wid,left:-50}, {duration: 500, complete : function(){ ul.css('overflow', 'visible'); }} ); }); </code></pre> <p>It looks like it could be similar to a c++ "this" statement. Is that correct at all?</p>
javascript jquery
[3, 5]
3,781,568
3,781,569
Asynchronous call doesn't return json
<p>I am running wamp on an xp box. I am fairly new to web programming, this is for a student project, and have run out of avenues to try to solve this problem. </p> <p>Problem </p> <p>We have client side JavaScript code that uses GDownloadUrl- from the Google api- to wrap xmlHttpRequest calls to a php server side program that is accessing our database. In my callback program, the result of this call is always " ". </p> <p>However, if I use an alert to display the http:// call, with the arguments, and cut and paste that into my browser, the json I expected is displayed. I zipped my dir containing all the files, and tried it out on another team member's computer, and they were able to get the json in the callback function. Note this is exactly the same code and structure I was using, he just unzipped and ran. </p> <p>So now I'm thinking this is something about Firefox or Wamp? Would this be a config problem? I'm running wamp server 2.0, and Firefox 3.5.8. </p> <p>I have no problems with synchronous php, or reading in files asynchronously. Any help would be greatly appreciated. </p> <p>Rebecca</p>
php javascript
[2, 3]
2,260,960
2,260,961
defining a shape xml element in drawable?
<p>I dropped the following into the drawable directory in my Android 1.5 project:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;shape xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gradient"&gt; &lt;gradient android:startColor="#FFFF00" android:endColor="#FFFFFF" android:angle="270"/&gt; &lt;corners android:radius="0dp" /&gt; &lt;/shape&gt; </code></pre> <p>I get </p> <pre><code>java.lang.ClassNotFoundException at com.android.ide.eclipse.adt.internal.resources.manager.ProjectClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(Unknown Source) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:198) at android.view.BridgeInflater.onCreateView(BridgeInflater.java:99) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:562) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:122) at android.view.LayoutInflater.inflate(LayoutInflater.java:385) </code></pre> <p>etc etc etc in my Eclipse console. </p> <p>I also get the same ClassCastError in my logcat when I try to run the thing in my emulator, setting that drawable to be the background on a linear layout.</p> <p>Any ideas?</p>
java android
[1, 4]
3,083,580
3,083,581
Android SDK: NSDictionary dictionary with objectsForKeys Equivalent
<p>I have the following objective-c code </p> <pre><code> NSDictionary *dictionary = [NSDictionary dictionaryWithObjects:names forKeys:dates]; </code></pre> <p>The names and dates are NSMutableArrays</p> <p>What is the java equivalent of this code?</p> <p>Thanks</p>
java android
[1, 4]
4,218,464
4,218,465
advice on how to best to reveal additional content based on the contents height
<p>I have a #banner that holds content, basically what i want to do is show a certain amount of the content and then have a more button that will show the rest of the content if clicked. This in turn will also animate the height of #banner, I have set the #banner height at 300px but want to find the height of the content #inner and animate this accordingly. At the moment I have the following version but reckon Im using a lot of #ids / to achieve the effect, can anyone advise how I can make this better?</p> <p>Fiddle here: <a href="http://jsfiddle.net/43gTt/1/" rel="nofollow">http://jsfiddle.net/43gTt/1/</a></p> <p>Thanks Kyle</p>
javascript jquery
[3, 5]
3,667,453
3,667,454
Recommend a jQuery Slider
<p>Can anyone recommend a good slider where the "Next" and "Prev" buttons are actually the next image. For example, this is the functionality I'd like to acheive:</p> <p>www.patohomes.com</p> <p>The user would be able to see the images to the left and right and if they click them, they come in to view.</p> <p>Please advise if there is a better place to pose this sort of question on the StackExchange network.</p>
javascript jquery
[3, 5]
156,401
156,402
select random value NOT in array
<p>How would I select a random value (0 to 30) that is not in this array?</p> <pre><code>var list = new Array(1,3,4,7,8,9); </code></pre>
javascript jquery
[3, 5]
5,984,664
5,984,665
Issue while Retrieving DateTime from session and calculating TimeSpan in ASP.Net using c#.
<p>I am storing Datetime in a session as mentioned below:-</p> <pre><code>Session["LoggedInTime"] = System.DateTime.Now; </code></pre> <p>Then i m retrieving this value on a page load like this:-</p> <pre><code>DateTime _loggedInTime = Convert.ToDateTime(Session["LoggedInTime"]); </code></pre> <p>I debug the above code code and find that up to here the _loggedInTIme is showing the correct date which i m storing in it. After that i m calculating the time span like this:-</p> <pre><code>TimeSpan elapsedtimespan = System.DateTime.Now.Subtract(_loggedInTime); int elapsedtime = Convert.ToInt32(elapsedtimespan.TotalSeconds); </code></pre> <p>I found while debugging the code that ,while subtraction the _loggedInTime = {1/1/0001 12:00:00 AM} and due to which i m not able to get exact elapsedtime .</p> <p>Please help me to solve this issue as i m not getting why the _loggedInTime become {1/1/0001 12:00:00 AM} at calculating TimeSpan.</p>
c# asp.net
[0, 9]
3,128,497
3,128,498
Android java how to make a edit text transparent but the text still visible?
<p>How can i make a EditText box invisiable but the text still visiable</p> <pre><code>&lt;EditText android:layout_height="wrap_content" android:visibility="invisible" android:text="TestttttttttttttttttTTTTTTTTTTTTTTTTTTTTTTTT" android:layout_width="wrap_content" android:id="@+id/editText1" android:layout_above="@+id/trait1" android:layout_alignParentLeft="true" android:layout_marginBottom="78dp"&gt; &lt;requestFocus&gt;&lt;/requestFocus&gt; &lt;/EditText&gt; </code></pre> <p>is my code but <code>android:visibility="invisible"</code> makes it all invisible </p>
java android
[1, 4]
2,823
2,824
Cant set drop down list selected value in page load
<p>I'm trying to set the selected value of a ddl during page load ie. before databind.</p> <p>This causes "selected value does not exist" errors. So I force a databind, and add a new element if it does not exist in the data source.</p> <p>However it looks like when the databind is performed later in the page lifecycle that my added element(s) are removed/overwritten.</p> <p>Am I setting the values in the wrong part of the life cycle? what I'm doing seems rather hackish and I think im going about this the wrong way... is there a better way to do this?</p>
c# asp.net
[0, 9]
3,837,417
3,837,418
What is the best way of "overriding" the .toggle() function of jquery?
<p>I want to change the toggle function so that it changes the text of the link to say "show/hide" or "expand/collapse".</p> <p>The function definition and call in classic JS would be:</p> <pre><code>function myToggle(expandText, collapseText, id,o){ // expandText: "expand", "show", "display" // collapseText: "collapse", "hide" // id: the id of the div to toggle // o: the object from where the function has been called } </code></pre> <p>I would then call it as such:</p> <pre><code>&lt;a href="#" onclick="myToggle('Show','Hide', 'myId', this); return false;"&gt;Show the div&lt;/a&gt; &lt;div id='myId'&gt;Hi!&lt;/div&gt; </code></pre> <p>It would do a replacement of the "Show" string by "Hide" and show() the div. Clicking again will reverse back to the previous state. Pretty simple stuff, that is not the problem.</p> <p><hr /></p> <p>I'm new to jquery but I already love it. I know there is a clean way of creating something like this but I'm not sure how to use it...</p> <p>So the question is: <strong>How would you define and call such a function? What's the best and cleanest way of doing so (should I change jquery's toggle, create my own...) ?</strong></p> <p>Any pointers or reading up (no books please, I still need to get that done today :) ) will be appreciated. You do not need to actually write the function body to get accepted.</p>
javascript jquery
[3, 5]
5,978,010
5,978,011
How to Assign a data column value to specific word uisng C#
<p>I have a field in my table in which I would like to set a string like “COMPLETE”. Initially the field is empty and I want to set it some kind of text like “COMPLETE” Here is what I have so far…</p> <pre><code> string ID = GV_Action.Rows[0].Cells[1].Text; SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand("sp_Update", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.VarChar).Value = ID; cmd.Connection = con; con.Open(); cmd.ExecuteNonQuery(); con.Close(); </code></pre> <p>in my Strored procedure below i am using a default ID but would like to pass the paramter ID and not use the fixed value how can i do that? here is how i created the proc CREATE PROC sp_Update</p> <p>AS</p> <p>EXEC msdb.dbo.sp_start_job N'UpdateField';</p> <p>GO</p> <p>EXEC sp_Update</p> <p>and here is job that i am calling when the procedure kicks off update MyTable</p> <p>set Status = 'Complete' where Post_ID = 303</p>
c# asp.net
[0, 9]
5,799,681
5,799,682
reading bytes without using any loop
<p>I have a 16mb binary file and I want to read bytes without using any loop. like if i want to read 16 byte i can pass 16 to some method(if there is any) and it give me my desired result... right now i am using loop for reading bytes but my application is so huge i am afraid that it do not get slow.kindly give me some hint.</p> <p>thanks alot.</p>
java android
[1, 4]
1,825,877
1,825,878
jQuery - setInterval issue
<p>I am using jQuery to generate and add a random amount of Clouds to the Header of the page and move them left on the specified interval. Everything is working fine, execpt the interval only runs once for each Cloud and not again. Here is my code:</p> <pre><code>if(enableClouds) { var cloudCount = Math.floor(Math.random() * 11); // Random Number between 1 &amp; 10 for(cnt = 0; cnt &lt; cloudCount; cnt++) { var cloudNumber = Math.floor(Math.random() * 4); var headerHeight = $('header').height() / 2; var cloudLeft = Math.floor(Math.random() * docWidth); var cloudTop = 0; var thisHeight = 0; var cloudType = "one"; if(cloudNumber == 2) { cloudType = "two"; }else if(cloudNumber == 3) { cloudType = "three"; } $('header').append('&lt;div id="cloud' + cnt + '" class="cloud ' + cloudType + '"&gt;&lt;/div&gt;'); thisHeight = $('#cloud' + cnt).height(); headerHeight -= thisHeight; cloudTop = Math.floor(Math.random() * headerHeight); $('#cloud' + cnt).css({ 'left' : cloudLeft, 'top' : cloudTop }); setInterval(moveCloud(cnt), 100); } function moveCloud(cloud) { var thisLeft = $('#cloud' + cloud).css('left'); alert(thisLeft); } } </code></pre> <p>Any help is appreciated!</p>
javascript jquery
[3, 5]
3,881,808
3,881,809
CSV2Table appearst to be caching results - how can I stop it?
<p>I'm using the CSV2Table plugin: <a href="http://code.google.com/p/jquerycsvtotable/" rel="nofollow">CSV2Table</a></p> <p>The body of the html page is:</p> <pre><code> &lt;body onload="JavaScript:timedRefresh();"&gt; &lt;div id="CSVTable"&gt;&lt;/div&gt; &lt;/body&gt; </code></pre> <p>The TimedRefresh script is:</p> <pre><code> &lt;script type="text/JavaScript"&gt; function timedRefresh() { setInterval(function(){ ref()},30000); &lt;/script&gt; </code></pre> <p>The script to load the CSV into the DIV is:</p> <pre><code> &lt;script type="text/javascript"&gt; function ref(){ $('#CSVTable').CSVToTable('q.csv', { loadingImage: 'images/loading.gif', startLine: 0, tableClass:'table table-condensed table-striped table-bordered table-hover' }).bind("loadComplete",function() { $('#CSVTable').find('TABLE').tablesorter().tableClass('table table-condensed'); }); &lt;/script&gt; </code></pre> <p>The problem is, although the <strong>ref</strong> is called, CSV2Table appears to be caching the result - and not re-reading the CSV file (which is updated dynamically elsewhere).</p> <p>Is there a way of stopping the caching from happening on CSV2Table? I've tried googling, but can't find a cache setting for it!</p> <p>Thanks for any help,</p> <p>Mark</p>
javascript jquery
[3, 5]
5,887,982
5,887,983
Json error on jQuery's load method
<p>I get the following error when playing with JSON request:</p> <blockquote> <p>Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.</p> </blockquote> <p>This is the jQuery code:</p> <pre><code>//load partial view contain grid $('#rptProductsRates').load('@Url.Action("ProductsRatesFlipPagination", "Reports")', { flipPagination: true }, function (data) { if (data.toString().substr(0, 15) == "&lt;!DOCTYPE html&gt;") { window.location = '@Url.Action("ProductsRates", "Reports")'; } else { debugger; var resultError = data.toString().substr(0, 9); if (resultError == "&lt;!DOCTYPE") { var exceptionURL='@Url.Content("~/Reports/Exception?controller=Reports&amp;action=ProductsRates")'; window.location = exceptionURL; //unblock the UI $.unblockUI(); } else { $('#contentDiv').show(); //unblock the UI $.unblockUI(); var bottomMarginFirst = (screen.height * .29) var bottomMargin = (screen.height * .42) if ($('.renderBody').height() &lt;= ($(document).height() - bottomMarginFirst)) { $('.renderBody').css({ 'height': ($(document).height() - bottomMargin + @System.Configuration.ConfigurationManager.AppSettings["GridHeight"] - 100) }) } } } </code></pre> <p>What's the cause and a possible solution to this error?</p>
javascript jquery
[3, 5]
5,635,957
5,635,958
Rendering out a table
<p>I'm working on an application for converting Celsius to Fahrenheit and vice versa.</p> <p>The application contains of fields and radiobuttons. The user fills in "start temperature", "end temperate" and "iterator" and chooses to convert from C to F or F to C.</p> <p>After clicking a button a table is rendered showing the temperature in C and the converted temperature in F (or vice versa). I've tried to do it with a while-loop as well as a for loop, but it doesn't work as it shall.</p> <p>I know that it is an unnecessary complex solution, and I really should appreciate help with creating a more elegant solution, that works.</p> <pre><code> var i = 0; while (startTemp &lt; endTemp) { i += 1; TableRow tRow = new TableRow(); tRow.CssClass = (i % 2 == 0 ? "white" : "grey"); tempTable.Rows.Add(tRow); startTemp = startTemp + iterator; if (startTemp &lt; endTemp) { for (int j = 0; j &lt;= 1; j++) { TableCell tCell = new TableCell(); if ((j % 2) == 0) { tCell.Text = startTemp.ToString(); } else { if (tempType1 == "°C") { convertedTemp = TemperatureConverter.CelsiusToFahrenheit(startTemp); } else { convertedTemp = TemperatureConverter.FahrenheitToCelsius(startTemp); } tCell.Text = convertedTemp.ToString(); } tRow.Cells.Add(tCell); } } </code></pre> <p>Wanted output (iterator = 2):</p> <p>C--------------------F</p> <pre><code>39 102 41 105 43 109 45 113 47 116 49 120 </code></pre> <p>EDIT: The solution works fine, except for one thing. If I use 1 as start temp, 10 as end temp and 1 as iterator, it stops at 9 (not at 10 as it should), and I just can't figure out why.</p>
c# asp.net
[0, 9]
3,649,098
3,649,099
Find the value of a div id based on partial match
<p>I have several divs on a page. They are formatted like:</p> <pre><code>&lt;div id='profile-1'&gt;&lt;/div&gt; &lt;div id='profile-2'&gt;&lt;/div&gt; &lt;div id='profile-3'&gt;&lt;/div&gt; &lt;div id='profile-4'&gt;&lt;/div&gt; </code></pre> <p>I need to find the value of the div with the highest id. In the previous example it would be "profile-4" (because 4 is the highest).</p> <p>I've figured out how to search through the divs by using:</p> <pre><code>var elements = $('[id^=profile-]') </code></pre> <p>This returns an object. I need to take that object and figure out that "profile-4" is the highest and if possible extract the value "4". </p> <p>Any ideas? </p>
javascript jquery
[3, 5]
327,791
327,792
how to protect my process being killed?
<p>Some task killer app can kill my process like 360 safer. How do I protect my process from being killed? Or how do I detect if my app's process has been killed? I found tencent app can restart their app's process after being killed, but I don't know how they implement?</p>
java android
[1, 4]
3,629,118
3,629,119
Get relevant image and summary from URL
<p>I'm not sure how to define it but basically I want to retrieve a relevant image and text summary from a given URL.</p> <p>For example - when a user pastes a link to the share box on Facebook, it immediately gets the article title and/or a short text block from the article itself and a relevant image. It never gets the wrong image, like the logo of the site or text from around the article itself...</p> <p>Same for Google+ and other social networks or services like these.</p> <p>I started by assuming I need to read the page content using the below code, how can I determine which image is the relevant one (from the article body) and which text is the article text?</p> <pre><code>URL oracle = new URL("http://www.oracle.com/"); BufferedReader in = new BufferedReader( new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); </code></pre> <p>I'm of course not asking for code here (unless someone has a snippet for example and is willing to share) but more for how to even approach this... where do I start?</p> <p>Any help will be appreciated!</p>
java android
[1, 4]
670,783
670,784
Membership provider class
<p>I want to know how I can implement membership provider class to have ability to remember users who signed in. <br /></p> <p>I have Membership provider class and I need functionality of "Remember Me" checkbox but I don't know how I can implement some methods</p>
c# asp.net
[0, 9]
4,710,423
4,710,424
jQuery Syntax Meaning
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1490853/how-do-you-read-this-javascript-code-var1-var2var3">How do you read this JavaScript code? (var1 ? var2:var3)</a><br> <a href="http://stackoverflow.com/questions/6259982/js-how-to-use-the-ternary-operator">JS How to use the ?: (ternary) operator</a> </p> </blockquote> <p>I was looking at a website's code and found this:</p> <pre><code>$.body = $('body'); $.scroll = ($.browser.mozilla || $.browser.msie) ? $('html') : $.body; </code></pre> <p>What is the second line saying? Looks like some sort of if statement</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,084,833
3,084,834
Is it possible to have jQuery.click trigger on the top element only?
<p>I'm trying to make a site where the user can click on any element to edit it's css. I use the following to add the click function to all lis, divs and uls.</p> <pre><code>$('li,div,ul').click(function () { alert(this.id); }); </code></pre> <p>The problem is if I click on an li element, then I get the alert for that, and any element underneath it. (all the containers).</p> <p>Is it possible to have only the top element trigger when clicked?</p>
javascript jquery
[3, 5]
4,022,306
4,022,307
disabling ASP.NEt Validtor such that its disabled on postback
<p>I am trying to disable ASP.Net Validator such that its disabled on postback.</p> <p>I am disabling the validator on client side using</p> <pre><code>$('.c_MyValidator').each(function() { ValidatorEnable(document.getElementById($(this).attr('id')), false); }); </code></pre> <p>but when the page postbacks, my page is still invalid. I am in UserControl (.ascx) so no override for Validate() for me. </p> <p>How can I disable the validator such that its enabled=false when the page postbacks. </p> <p>Any ideas?</p>
asp.net javascript jquery
[9, 3, 5]
4,918,446
4,918,447
jQuery exception if element doesn't exist
<p>I working with jQuery and I need to get anytime and anywere exception (with any operation), if I attach some event or try to perform some action with elements (got from selector) that don't exist. Is there some internal "strict" mode in jQuery for this issue?</p>
javascript jquery
[3, 5]
5,821,884
5,821,885
How can we set time or delay of 5 seconds in dropdown sub menu?
<p>How can we set time or delay of 5 seconds in dropdown.</p> <p>Requirement are like this: When someone hover over main menu then its shows that submenu for 5 sec only when your mouse is away from main menu or sub menu.</p> <p>For now i have increased the height of ul upto height of banner images so that it will not be hide untill you move your mouse out of that banner area.</p> <p>Below is the site link: <a href="http://transitions.advisorproducts.com/home" rel="nofollow">http://transitions.advisorproducts.com/home</a></p> <p>and this is one reference site link : <a href="http://focusyou.com/home" rel="nofollow">http://focusyou.com/home</a> (my requirement are like this, but i don't want to copy this code, i want to implement in my own code)</p> <p>Below is the js:</p> <pre><code>$(function() { $("ul.dropdown li").hover(function() { $(this).addClass("hover"); $('ul:first',this).css('visibility', 'visible'); }, function() { $(this).removeClass("hover"); $('ul:first',this).css('visibility', 'hidden'); }); $("ul.dropdown li ul li:has(ul)").find("a:first").append(" &amp;raquo; "); }); </code></pre> <p>Thanks in advance :)</p> <p>You can test here : <a href="http://jsfiddle.net/alokjain_lucky/KQAYT/2/" rel="nofollow">http://jsfiddle.net/alokjain_lucky/KQAYT/2/</a></p>
javascript jquery
[3, 5]
455,614
455,615
php in javascript?
<p>i need to have some php code inside javascript</p> <pre><code> &lt;script ...&gt; &lt;?php echo " ... "; ?&gt; &lt;/script&gt; </code></pre> <p>but this doesnt work. how can u implement php inside javascript that is in a own file javascript.php?</p>
php javascript
[2, 3]
774,027
774,028
Android SoftInput layout
<p>I am scaling down a phonegap android application to fit on smaller screened devices. This seemed to be a perfect solution for this particular application with one exception.</p> <p>When the soft-keyboard pops up it snaps the app back to it's original larger scale.</p> <p>Dose anyone know of any settings to prevent this behavior other then separate css, files for each of the different dimensions.</p>
javascript android
[3, 4]
2,451,693
2,451,694
a question on unit conversion
<p>I am devloping an unit converter.Is thr any in-built java classes or anything in android which can convert from one unit to other like celsius to farheinheit or KM to meter like that ?</p>
java android
[1, 4]
2,361,410
2,361,411
Does being good in jQuery imply being good in JavaScript?
<p>I'm pretty efficient in jQuery, having implementing it in several projects for my company. However, I found myself a little lost when reading stuff like <code>node.js</code>.</p> <p>Do I have to go back to basics and learn the JavaScript language or should I just stick with jQuery?</p> <p>One more thing I would like to ask: Does coding in plain JavaScript increase performance compared to coding with jQuery? For my own experience, coding heavy, complex combination of animation in jQuery always seems to take up large amount of the computer memory.</p>
javascript jquery
[3, 5]
4,057,096
4,057,097
Can this all be done in php and JQuery
<p>I want to do the following but I want to find out if its possible and whats the easiest way to do it before I spend hours looking on google for something that isn't possible. The situation is a web app that would run of a users localhost so they can configure a config.php file.</p> <ol> <li><p>Can the number of available check boxes be set in a config.php file. ie. </p> <p><code>$numberofcheckboxes ="4"</code></p></li> <li><p>Can descriptions be set for these in the config.php ie.</p></li> <li><p>When these check boxes are displayed and ticked and then submitted can a php function be run with variables depending on which checkboxes were ticked. So in the config.php you would set the different variables for each checkbox. ie.</p> <p><code>$check1name = "name 1"</code><br> <code>$check1size ="120"</code></p> <p><code>$check2name ="name 2"</code><br> <code>$check2size ="160"</code></p></li> </ol> <p>The function is always exactly the same function however the variables will be different for each checkbox.</p> <p>Is this possible?</p> <p>Thanks</p>
php jquery
[2, 5]
1,480,428
1,480,429
Why cant i combine javascript and php in my code?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/168214/pass-a-php-string-to-a-javascript-variable-and-escape-newlines">Pass a PHP string to a Javascript variable (and escape newlines)</a> </p> </blockquote> <p>I am quite new to the concepts of Javascript/jQuery and PHP. I have been using PHP implemented in Appserv for two weeks now to get data from a modbus device and store it in a csv file. Now i want to plot the data using jQplot. I am trying to write a simple program to first see if i can implement php and javascript code together in html. This is a code that i have written in html and uses both javascript and php. </p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Demo&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;This is a script&lt;/h2&gt; &lt;script type="text/javascript"&gt; var out = &lt;?php echo "Hello"?&gt;; //var out = "Hello" document.write(out); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When i run this code in the browser ( I use google chrome with windows 7) I only get the heading "This is a script". However if i remove the line with the php code and uncomment the next line</p> <pre><code>var out = "Hello"; </code></pre> <p>then the code prints the output with "Hello" like its supposed to. Why is this?</p>
php javascript
[2, 3]
969,091
969,092
Is there a way to export the content in DIV to a image programmatically?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/60455/take-a-screenshot-of-a-webpage-with-javascript">Take a screenshot of a webpage with javascript?</a> </p> </blockquote> <p>I hope to export the content in DIV to a image programmatically? How can I do? which code can do that ,server code or client code? Thanks! </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="a"&gt; Content to export to image &lt;/div&gt; &lt;div id="b"&gt; Normal text &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript asp.net
[3, 9]
3,818,824
3,818,825
how to send text message
<p>I'm a bit confused. I think following API is used to send messages from one instance of the emulator to another. Will it also work on the real phone to send SMS?</p> <pre><code>SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage(destinationAddress, null, "Hello world", null, null, null); </code></pre>
java android
[1, 4]
452,723
452,724
Inserting JQUERY value into hidden field of html
<p>Hi I want to insert a cookie value which I am getting by using jQuery.</p> <p>I want to grab the value of the cookie and insert it into the html <code>value</code> attribute.</p> <pre><code>&lt;input id="visitorcookie" type="hidden" value="&lt;script&gt;$.cookie('visitorCookie');&lt;/script&gt;" name="com.silverpop.iMAWebCookie"&gt; </code></pre> <p>Is this correct how I am doing it?</p>
javascript jquery
[3, 5]
3,564,885
3,564,886
Need some help understanding this JavaScript
<p>I have the following strange looking code in a js file and i need some help in understanding whats going on. What im confused about is why is the whole thing put in paranthesis ?. What does that mean ?</p> <pre><code>(function() { var someobj = window.someobj = []; var parentId = '#wrapper'; $(document).ready(function() { //some code here }); $(document).ready(function() { //some code here } }); </code></pre>
javascript jquery
[3, 5]
2,325,424
2,325,425
Display objects from an array in order, depending on an specific value
<p>i have this json:</p> <pre><code>var projects_array = [ {name:"proj1", category:"a", index:1}, {name:"proj2", category:"a", index:2}, {name:"proj3", category:"b", index:3}, {name:"proj4", category:"c", index:4} ]; </code></pre> <p>I am displaying them in order with something like this:</p> <pre><code>for (var i = 0 ; i &lt;proj_num; i++){ var numClass="p_"+projects_array[i].index; var act="&lt;li class='"+numClass+"'&gt;&lt;/li&gt;"; $('#lookfor').append(act); } </code></pre> <p>What i need now is to display first all the objects with the value "a" in the category attribute and then all the other objects in any order, i tried using .sort() in this way:\</p> <pre><code> function compare(obj){ if(obj.category == "a"){ return 1;} else{return 0;} } obj.sort(compare); </code></pre> <p>But it does not worked because it kind of group all the objects of the category...</p> <p>do you have any possible solution for this problem?</p> <p>ps: I tried to simplify my code to make it understandable, i hope it be clear for you, thanks in advance</p>
javascript jquery
[3, 5]
5,298,561
5,298,562
Prevent printing url while window.print
<p>I am using javascript <code>window.print();</code> to print web-page. On printout, it is showing url like <code>http:\...</code></p> <p>How i could avoid it?</p>
javascript asp.net
[3, 9]
4,787,716
4,787,717
Assign foreground color property to a string dynamically
<p>I have a label and i assigned foreground color to it dynamically using the following code:</p> <pre><code>string xCol = "#F8951D"; Color c = System.Drawing.ColorTranslator.FromHtml(xCol); string abc = Convert.ToString(c); string[] col = abc.Split(); for (int k = 1; k &lt;= 4; k++) { col[k] = col[k].Replace("A", ""); col[k] = col[k].Replace("=", ""); col[k] = col[k].Replace("[", ""); col[k] = col[k].Replace(",", ""); col[k] = col[k].Replace("R", ""); col[k] = col[k].Replace("G", ""); col[k] = col[k].Replace("B", ""); col[k] = col[k].Replace("]", ""); if (k == 1) { int abc1 = Convert.ToInt32(col[k]); Session["abc1"] = abc1; } else if (k == 2) { int abc2 = Convert.ToInt32(col[k]); Session["abc2"] = abc2; } else if (k == 3) { int abc3 = Convert.ToInt32(col[k]); Session["abc3"] = abc3; } else if (k == 4) { int abc4 = Convert.ToInt32(col[k]); Session["abc4"] = abc4; } } int c1 = Convert.ToInt32(Session["abc1"].ToString()); int c2 = Convert.ToInt32(Session["abc2"].ToString()); int c3 = Convert.ToInt32(Session["abc3"].ToString()); int c4 = Convert.ToInt32(Session["abc4"].ToString()); lblDept.ForeColor = Color.FromArgb(c1,c2,c3,c4); </code></pre> <p>How can I assign a foreground color property to a string dynamically using <code>a,r,g,b</code> components?</p> <p>Is it possible to assign it using <code>string strColor = Color.FromArgb(c1,c2,c3,c4);</code>?<br> How can I set a color property to a string dynamically?</p>
c# asp.net
[0, 9]
3,711,569
3,711,570
jQuery hide div function
<p>Is there any function for hiding 'DIV's or other html elements on right click, some tutorial, script, simple code javascript or jquery. Example: when is click on link or <p> tag or 'li' or 'Ul' or 'a' with right click to hide this element... How to do that?</p> <p><strong>UPDATE:</strong> Yes, all your solutions is OK but please view this code and why doesn' work:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"&gt;&lt;/script&gt; &lt;script&gt; $(document).on("mousedown", "div, img, span, a", function () { if (event.which === 3) $(this).hide(); }); &lt;/script&gt; &lt;?php $url = 'http://www.kupime.com/'; $data = file_get_contents($url); $data = '&lt;head&gt;&lt;base href='.$url.' target="_blank" /&gt;&lt;/head&gt;'.$data; echo $data; ?&gt; </code></pre> <p>And when I click nothing happend. WHY?</p>
javascript jquery
[3, 5]
3,098,391
3,098,392
Get propertyinfo value
<p>Im trying to get the value from a <code>PropertyInfo[]</code>, but i cant get it to work:</p> <pre><code>foreach (var propertyInfo in foo.GetType().GetProperties()) { var value = propertyInfo.GetValue(this, null); } </code></pre> <p>Exception: <code>Object does not match target type.</code></p> <p>Isnt this how its supposed to be done?</p> <p>Thanks</p>
c# asp.net
[0, 9]
5,124,903
5,124,904
date format of textfield using java script and php
<p>i am making a form that has a date field using textfield, i want my date field to have a label format inside the textfield, here's the picture: <img src="http://i.stack.imgur.com/uRxPV.jpg" alt="enter image description here"> after clicking on the textfield the format will be erased and the hyphen will remain like this picture: <img src="http://i.stack.imgur.com/lqZtq.jpg" alt="enter image description here"> i already made the code for the label format, here's my code:</p> <pre><code>&lt;input type="text" name="date" value="DD_MM_YYYY" id="date" style="width:180px" onclick="if(this.value=='DD_MM_YYYY'){this.value=''}" /&gt; &lt;/p&gt; </code></pre> <p>My problem now is the hypen that will remain after clicking the textfield.</p> <p>Anyone knows how to do that?</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
916,997
916,998
Python URL decoding?
<p>In javascript I do the following:</p> <pre><code>encodeURIComponent(comments) </code></pre> <p>while in Python i do the following:</p> <pre><code>urllib2.unquote(comments) </code></pre> <p>For some reason, when I do the following:</p> <pre><code>encodedURIComponents('ø') </code></pre> <p>I get <code>%C3%B8</code>, but when I decode</p> <pre><code>urllib2.unquote('%C3%B8') </code></pre> <p>I get <code>ø</code> instead of <code>ø</code>, which is the original character.</p> <p>What gives?</p> <p>I'm on a platform that uses jQuery on client side, and Python/Django server side.</p>
javascript python
[3, 7]
1,829,844
1,829,845
jquery trouble when id changes
<p>i have a page, that the problem is the following. I have a bunch of javascript, and popups that works great when the logged in id is equal to the profile id, but when this id changes to another user's id, the javascript wont work. Its driving me crazy. Im not pasting the code because its a loot of lines of code here.</p> <p>If someone can have a clue of whats going one please tell me</p>
php javascript
[2, 3]
71,309
71,310
Accessing child elements in jquery
<pre><code>&lt;div id="main"&gt; &lt;div id="1"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;div id="2"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;div id="3"&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;div&gt;contents..&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>How can i access all <code>div object</code> into a single array who have <code>contents in there innerHTML</code>?</p> <p><strong>EDIT</strong></p> <p>OK I tried this :</p> <pre><code>var totaldiv = $("#main").children(); var totalElements = []; var c = 0; $.each(totaldiv, function (i, v) { $(totaldiv[i]).children().each(function () { totalElements[c++] = $(this); }); }); </code></pre> <p>Is there any more efficient way to do this?</p>
javascript jquery
[3, 5]