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
389,536
389,537
Change background color for rows of an HTML table on click
<p>I need that when i check a checkbox i apply different background color to HTML table rows according to and ID of a user in database using jquery, and then i uncheck the checkbox go to previous state. For the record i am not asking for code i am asking for concept.</p> <p><a href="http://www.freeimagehosting.net/image.php?ef44cf44a5.jpg" rel="nofollow">http://www.freeimagehosting.net/image.php?ef44cf44a5.jpg</a></p>
javascript jquery
[3, 5]
1,349,761
1,349,762
Mask input for time(`01:55`)
<p>I want mack a mask input for time(<code>01:55</code>) without use plugin,as only accept to user typed four number, (i mean, when user type number <code>01</code> put after it this <code>:</code> and next user type <code>55</code>), how is it?</p> <p>This is my code that not work:</p> <pre><code>&lt;input name="text" class="time"&gt; $('.time').live('keyup change',function(){ this.value = this.value.replace(^[0-1]?[0-9]{1}:[0-5]{1}[0-9]{1}, "") }); </code></pre> <p>Here is full code: <a href="http://jsfiddle.net/yGLsH/" rel="nofollow">http://jsfiddle.net/yGLsH/</a></p>
javascript jquery
[3, 5]
4,045,238
4,045,239
How to empty the <ul> in the nest <li> using jquery
<p>I'm trying to create a menu and its sub menu, but receiving the data from database. And I created the menu successfully, this is my code :</p> <pre><code> $(document).ready(function () { var url = '&lt;%: Url.Content("~/") %&gt;' + "Products/GetMenuList"; $.getJSON(url, function (data) { var mainMenu = $("#content ul#navmenu-v"); $.each(data, function (index, dataOption) { var new_li = $("&lt;li id='level1'&gt;&lt;a href='javascript:void(0);' id='" + dataOption.ID + "' class ='selectedcategory'&gt;" + dataOption.Name + "&lt;/a&gt;"); mainMenu.append(new_li); }); $('.selectedcategory').mouseover(function () { $("ul#subCat").empty(); $("li#level1").append("&lt;ul id='subCat'&gt;"); var urlCat = '&lt;%: Url.Content("~/") %&gt;' + "Products/GetCategoryList"; $.getJSON(urlCat, { Depid: this.id }, function (dataCat) { $.each(dataCat, function (indexCat, dataOptionCat) { $("ul#subCat").append("&lt;li&gt;&lt;a href='javascript:void(0);' class='selectedsubcat' id='" + dataOptionCat.id + "'&gt;" + dataOptionCat.Name + "&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;"); }); }); }); }); }); </code></pre> <p>This is the HTML :</p> <pre><code>&lt;div id="content"&gt; &lt;ul id='navmenu-v'&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>But it didn't get the right sub menu due to the main menu. Could anyone show me some suggestion please.</p> <p>Thanks so much.</p>
javascript jquery
[3, 5]
1,778,434
1,778,435
PageMethods what is issue with it?
<p>I'm getting "Object Error" on line</p> <pre><code>function readWURecord() { var ifUSD = ""; try {var mtcnNo=document.getElementById('ctl00_ContentPlaceHolder1_TxtReferenceNo').value; if(mtcnNo=='') { alert('Provide Reference Number');return false;} var adoConn=new ActiveXObject("ADODB.Connection"); var adoRS=new ActiveXObject("ADODB.Recordset"); var filename; var filenamecsv1; fs=new ActiveXObject("Scripting.FileSystemObject"); filename=document.getElementById('ctl00_ContentPlaceHolder1_hdPath').value+'Trans.mdb'; filenamecsv1="D://Data.csv"; if(fs.FileExists(filename)==true) { adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+filename+";Persist Security Info=True;Jet OLEDB:Database Password=tradb897"); } else if(fs1.FileExists(filenamecsv1)==true) { PageMethods.GetCurrentTime(document.getElementById("&lt;%=TxtReferenceNo.ClientID%&gt;").value); </code></pre> <p>and</p> <pre><code>function OnSuccess(response, userContext, methodName) { alert("response"); } </code></pre> <p>Can anybody help me what issues are with <strong>PageMethods.GetCurrentTime</strong> method?</p>
c# javascript asp.net
[0, 3, 9]
2,164,776
2,164,777
focus div element
<p>Concept: Focus the div when user click the Comment link. There was two link in my php page. one is <code>comment link</code> and another one is <code>readmore link</code>. The two link goes to the same page but i want to <code>focus the div element</code> when click comment link .</p>
javascript jquery
[3, 5]
2,803,916
2,803,917
java.lang.SecurityException: No active admin owned by uid 10034 for policy #3
<p>I create a lock screen widget app recently. It always has the exception:</p> <pre><code>( java.lang.SecurityException: No active admin owned by uid 10034 for policy #3) </code></pre> <p>I try many methods and can not eliminate the exception. I open the activity to realize the purpose of the lock screen when the condition was founded.</p> <pre><code>public class tempActivity extends Activity { private static final String TAG = "tempActivity"; private DevicePolicyManager policyManager; private ComponentName componentName; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.temp); Log.e(TAG, "Activity created~"); policyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); componentName = new ComponentName(this, AdminReceiver.class); mylock(); } private void mylock() { boolean active = policyManager.isAdminActive(componentName); if (!active) { // Without permission Log.e(TAG, "No authority~"); activeManage(); // To get access policyManager.lockNow(); // And lock screen } else { Log.e(TAG, "Has authority"); policyManager.lockNow(); // lock screen directly } this.finish(); } private void activeManage() { Log.e(TAG, "activeManage"); Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN); intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, componentName); intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION, "developers:liushuaikobe"); startActivityForResult(intent, 1); } } </code></pre>
java android
[1, 4]
5,973,547
5,973,548
Sending data from service to activity
<p>I am having issue for sending data from service to Activity through notification , I click a notification a activity get invoked but when i try to add some parameters through bundle i am not able to get the parameters in that called intent , I have gone through the link <a href="http://stackoverflow.com/questions/1198558/how-to-send-parameters-from-a-notification-click-to-an-activity">http://stackoverflow.com/questions/1198558/how-to-send-parameters-from-a-notification-click-to-an-activity</a></p> <p>but still no luck has any body occured with the same issue Thanks in advance.</p>
java android
[1, 4]
160,369
160,370
Value is undefined when element is obtained with jQuery
<p>Below is the code where I obtain my input element with jQuery:</p> <pre><code>var txt = $(tableRow).find('input:text'); if (txt.value == null) { //TO DO code } </code></pre> <p>and here's how I do it </p> <pre><code>var txt = document.getElementById('txtAge'); if (txt.value == null) { //TO DO code } </code></pre> <p>With the first way the value of the txt is undefined. But with the second way the value is what's inside the input element. Now more interesting is, on the bottom-right pane of the Mozilla Firebug if I scroll down to the "value" of the txt I can see it there, both ways. </p> <p>I know I can simply say <code>$(txt).val()</code>, but I also want to understand why I can't access the value of an element if it's been selected by jQuery. Isn't jQuery just a library of JavaScript functions?</p>
javascript jquery
[3, 5]
3,189,547
3,189,548
Sequence of command?
<p>I wrote this code</p> <pre><code> WindowManager.LayoutParams params = getWindow().getAttributes(); params.flags |= LayoutParams.FLAG_KEEP_SCREEN_ON; params.screenBrightness = 0.1F; getWindow().setAttributes(params); SystemClock.sleep(5000); TextView Text01 = (TextView) findViewById(R.id.Text1); Text01.setText("Hello"); </code></pre> <p>to set the screen brightness and then, after 5 seconds, it displays text. The problem is that it waits 5 secs then Android dims the screen and output the text at the same time. Why it does not work sequentially? Thanks</p>
java android
[1, 4]
2,450,358
2,450,359
Generate charts with Google chart API
<p>i'am trying to generate a chart like this one: <code>http://chartpart.com/</code> but i don't know how to do that exactly.Do i need to make the string that generates the chart manually or do i need to send the data to a google server and receive the string?(if so how do i send the data?) PS:i would like to do all this in c# and send the resulting string via web service.</p>
c# android
[0, 4]
1,705,906
1,705,907
solve linear equations with 3 variables that is given by user
<p>i'm trying to figure out how to write down a program in java to solve 2 equations that have 3 variables, which is given by the user:</p> <pre><code>A11 * X1 + A12 * X2 = B1 A21 * X1 + A22 * X2 = B2 </code></pre> <p>numbers are given by user, per say 1 2 3 4 5 6 (for a11 a12 a21 a22 b1 b2) and the answers are "no solution" "many solutions" "single solution (x1,x2) i'm stuck.... don't even know where to begin help?</p>
java javascript
[1, 3]
2,839,034
2,839,035
How and where are variables that are used throughout the ASP.net Project created/stored?
<p>I want to be able to store variables that are accessible to all of the other files in my ASP.net project but can be modified programatically. What I am looking for is something akin to being able to pull information from the web.config file for say the database connection strings (ex System.Configuration.ConfigurationManager.ConnectionStrings["cnDatabase"].ToString())</p> <p>I have variables that have values that are shared amongst all of the other pages and I would like to be able to modify in one location instead of having to update the same value in 4+ aspx.cs pages.</p>
c# asp.net
[0, 9]
2,543,091
2,543,092
Problem with concat string in jquery animate
<pre><code>count = 0; total = 2; jQuery("#slide").everyTime(5000,function(i){ if(count == total-1) { count = 0; jQuery(this).stop().animate({backgroundPosition: "0px 0"}, {duration:1000}); } else{ jQuery(this).stop().animate({backgroundPosition: "-"+950*count+"px 0"}, {duration:1000}); count++; } }); </code></pre> <p>Hi all, i am trying to work on this. there are some problem with the "950*count". When ever i put an operator into this, it wont' work, but if i remove the *count, it work just fine.</p> <p>Can someone point out what the problem is?</p> <p>Thank you</p>
javascript jquery
[3, 5]
210,454
210,455
Javascript - How to make a browser switch tabs?
<p>In my code a timed event launches a ModalDialog. If the user switches tabs before the event the tab blinks but that is it.</p> <p>Is there a way to make the browser switch to the tab the dialog is on?</p> <p>Thank you</p> <p>Cheers for all your advice. I should of said before but code will only be run through IE and the users are not allowed to alter any settings.</p>
javascript jquery
[3, 5]
1,453,656
1,453,657
Why I am getting OutOfMemory Exception?
<p>I am getting OutOfMemory Exception. Why? I am using this code for logging. Does this approach correct? Exceptions and closing of streams are handled in parent methods.</p> <pre><code>private static void writeToFile(File file, FileWriter out, String message) throws IOException { if (file.exists() &amp;&amp; file.isFile()) { if ((file.length() + message.getBytes().length) &lt;= FILE_MAX_SIZE_B) { out.write(message); } else { int cutLenght = (int) (file.length() + message.getBytes().length - FILE_MAX_SIZE_B); FileInputStream fileInputStream = new FileInputStream(file); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(fileInputStream)); char[] buf = new char[1024]; int numRead = 0; StringBuffer text = new StringBuffer(1000); while ((numRead=bufferedReader.read(buf)) != -1) { text.append(buf,0,numRead); } String result = new String(text).substring(cutLenght); result += message; FileWriter fileWriter = new FileWriter(file, appendToFile); writeToFile(file, fileWriter, result); bufferedReader.close(); } } } </code></pre> <p>EDIT:</p> <p>I am using this method for writting my logs in file. So for example in one second I can call 10 logs. I am getting error on lines:</p> <pre><code>while ((numRead=bufferedReader.read(buf)) != -1) { text.append(buf,0,numRead); } </code></pre>
java android
[1, 4]
4,028,013
4,028,014
how to access the user control controls in aspx code behind
<p>I created a user control with tab container in my project. I want to access the tab container from aspx page for the reason of disable the some tabs. For example i need to hide the first tab and third tab dynamically from aspx page. Because i am using the same user control for different page. Please help me to fix this issue.</p> <pre><code>&lt;%@ Register TagPrefix="cust" TagName="Creation" Src="~/Cust_Creation.ascx" %&gt; &lt;div&gt; &lt;cust:Creation ID="uc_more_pack" runat="server" /&gt; &lt;/div&gt; </code></pre> <p>I </p>
c# asp.net
[0, 9]
3,396,467
3,396,468
Cookie not being set in IE
<p>I am setting a cookie in js and then checking in php whether it exists or not to determine whether the user has js enabled.</p> <p>The non-js and js users are then served a different version of certain pages. This is working fine in ff, but not in IE? in IE we are seeing the version of the page as if no js is enabled, but it is.</p> <p><a href="http://edinburghfloorsanding.com/gallery/" rel="nofollow">http://edinburghfloorsanding.com/gallery/</a></p> <p>Any help gratefully received.</p>
php javascript
[2, 3]
1,001,654
1,001,655
Get Dates betwen Ranges, c#
<p>I've two dates</p> <blockquote> <ol> <li>21/01/2011 [From Date]</li> <li>25/01/2011 [To Date]</li> </ol> </blockquote> <p>How can I get all the dates between these ranges using c#</p> <p>The answer should be </p> <blockquote> <p>21/01/2011<br> 22/01/2011<br> 23/01/2011<br> 24/01/2011<br> 25/01/2011</p> </blockquote>
c# asp.net
[0, 9]
4,571,478
4,571,479
Sending mail periodically in ASP.net
<p>I'm trying to send confirmation mails to users periodically in ASP.NET. </p> <p>To do this I polulate a queue with mails and check it every 30 seconds. Any confirmation emails in the queue at this time are sent and then cleared from the queue. </p> <p>Does anyone know how to do this? </p> <p>Here is my sending mail code</p> <pre><code>public static bool SendMail(string AdminMail,string AdminPassword,string subject,string toAddress, string content,DateTime SendTime) { toAddressListProperty.Enqueue(toAddress); if(date==null) { date = DateTime.Now.Second; } if (date-SendTime.Second &gt; 120) { var message = new MailMessage { From = new MailAddress(AdminMail) }; foreach (var toAddressl in toAddressListProperty) { message.To.Add(new MailAddress(toAddressl)); } message.Subject = subject; message.Body = content; message.IsBodyHtml = true; var smtp = new SmtpClient { Credentials = new System.Net.NetworkCredential(AdminMail, AdminPassword), Port = 587, Host = "smtp.gmail.com", EnableSsl = true }; smtp.Send(message); //date = SendTime; return true; } return false; } </code></pre>
c# asp.net
[0, 9]
1,956,424
1,956,425
Element ID can't be found after beind appended to DIV
<p>I'm using this bit of jQuery to append a text input field to a div after a checkbox is checked:</p> <pre><code>$('.sharewithfriends').on("click", ".manual-invite", function () { if ($('input[name=manual-invite]').is(':checked')) { $('&lt;li style="margin-top:0;display:none"&gt;&lt;input type="text" id="invite_email1" name="invite-email1" value="Add an E-Mail" onfocus="clearText(invite_email1);" onblur="fillText(invite_email1);"/&gt;&lt;span&gt;&lt;a class="add" href=""&gt;Add&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;').appendTo('#invite-emails').slideToggle(); } </code></pre> <p>All of that works fine, except for the <code>onfocus</code> and <code>onblur</code> events. They call the following simple functions, which are supposed to clear the field on focus and fill it with the default text on blur:</p> <pre><code>function clearText(thefield){ if (thefield.defaultValue==thefield.value) thefield.value = "" } function fillText(thefield){ if (thefield.value=="") thefield.value=thefield.defaultValue; } </code></pre> <p>But when I click the field, I get an error saying "invite_email1 is not defined" even though it clearly is.</p> <p>Anyone know what I need to do to get this to work?</p>
javascript jquery
[3, 5]
3,429,046
3,429,047
Dynamic table with multiple datepickers
<p>I have a web form which has dynamic table using repeating rows. New rows are added by calling the addRow function below:</p> <pre><code>function addRow(tableID) { var table = document.getElementById(tableID); var rowCount = table.rows.length; var row = table.insertRow(rowCount); var colCount = table.rows[0].cells.length; for(var i=0; i&lt;colCount; i++) { var newcell = row.insertCell(i); newcell.innerHTML = table.rows[0].cells[i].innerHTML; //alert(newcell.childNodes); switch(newcell.childNodes[0].type) { case "text": newcell.childNodes[0].value = ""; break; case "checkbox": newcell.childNodes[0].checked = false; break; case "select-one": newcell.childNodes[0].selectedIndex = 0; break; } </code></pre> <p>I would like one datepicker (or more) in each row. Datepicker from here: <a href="http://www.frequency-decoder.com/2011/10/11/unobtrusive-accessible-datepicker-widgit-v6" rel="nofollow">http://www.frequency-decoder.com/2011/10/11/unobtrusive-accessible-datepicker-widgit-v6</a></p> <p>I need the following script for each datepicker:</p> <pre><code>&lt;script&gt; datePickerController.createDatePicker({ // Associate the text input to a DD/MM/YYYY date format formElements:{"formInputName":"%Y-%m-%d"} }); &lt;/script&gt; </code></pre> <p>How can I easily execute this script for each table row that is added? I'm aware that using in innerHTML does not work. Please see the attached image for the desired result.</p> <p><img src="http://i.stack.imgur.com/sDq1p.jpg" alt="http://i.stack.imgur.com/HHn2w.jpg"></p> <p>Thanks for your help!</p>
php javascript jquery
[2, 3, 5]
3,308,889
3,308,890
"Waiting" for ReadyState to be 4 before returning a value
<p>I have looked in lots of places for this, and I'm probably being an idiot because this is done a lot, but here's my situation.</p> <p>I am trying to display a checkbox next to an e-mail field on my website iff the e-mail has not been used to register already.</p> <p>What I have is something like this:</p> <pre><code>$('[name=reg_email]').change( function() { if(!emailUsed()) { //Update image to be a green checkmark } else { //Update image to be a huge red X } } </code></pre> <p>And my "emailUsed" function should be returning a Javascript boolean variable depending on whether or not the e-mail address is in the database. To facilitate this, I've created a script which will determine if it's there or not. So the emailUsed() function just needs to call the script and return, but I need to wait until readystate == 4 before I return, and all of the methods I have found for waiting for readystate to equal 4 prevent me from returning a value at all:</p> <pre><code>function emailUsed() { var req = $.get('scripts/email_used.php?email='+$('[name=reg_email]').val()); //Wait for req.readystate to be 4 return req.responseText == 'True'; } </code></pre> <p>But nowhere can I find something that explains how to do this and still return a value. Everything seems to use callback functions and this and that, but I can't get THIS method to return a value.</p> <p>Help, please!</p>
javascript jquery
[3, 5]
3,780,563
3,780,564
How do I increment CSS Y position coordinates using jQuery?
<p>I am creating an animation that changes the value of a background image. It is working perfectly if I hard code in the coordinates, but I am trying to modify it so that it simnply increments the position by 20px.</p> <p>Here's the code I am using to retrieve the original Y position - works perfectly:</p> <pre><code>$('.rss,.twitter,.jquery').each(function(){ // Returns "##px" and "##px" var backgroundPositions = $(this).css('background-position').split(" "); // Retrieve the original Y position $(this).data("originalYpos", backgroundPositions[1].slice(0, -2)); }); </code></pre> <p>Now I am trying to increment the value of originalYpos by 20px but this isn't working:</p> <pre><code>var animateNum = function() { $('.rss,.twitter,.jquery').animate({ var YPos = $(this).data('originalYpos')+20; backgroundPosition: 0 + "px " + YPos + "px"}, 400, "easeOutCirc"); }; </code></pre> <p>I do believe it is because the declaration of var Ypos isn't allowed inside the .animate(), but I need to refer to $(this), meaning the value of each of the 3 individual selectors as they are being animated.</p> <p>Any suggestions are greatly appreciated!</p>
javascript jquery
[3, 5]
2,894,146
2,894,147
Efficient way to detect window.load in this case
<p>My requirement is, I have to execute a script after all the page scripts execution is done. I am using the below code to do the same </p> <pre><code>$(window).load(function () { var j = setTimeout (function () { alert("All page scripts have been executed and DOM is ready."); // And here the script will work to update the DOM changes made by the pagescripts. },100); // Here execution time cant be less than 100 all the time, right? }); </code></pre> <p>But the problem is, In the above case I have used time 100. But sometimes the page is being loaded in 101 milliseconds. In such cases the script is failed to update the changes. Lets see an example for this </p> <p>There is a page script which will add images to the DOM when DOM is ready. And if I use </p> <pre><code>$(document).ready() </code></pre> <p>the script is failed to detect images as the images are not yet added to the DOM.</p> <p>Please let me know if you need some more clarification on Question.</p>
javascript jquery
[3, 5]
4,820,039
4,820,040
Android Rotate Matrix
<p>I have matrix. This matrix represents array x and y coordinates. For example </p> <pre><code>float[] src = {7,1,7,2,7,3,7,4}; </code></pre> <p>I need to rotate this coordinates to 90 degrees. I use <code>android.graphics.Matrix</code> like this:</p> <pre><code> float[] src = {7,1,7,2,7,3,7,4}; float[] dist = new float[8]; Matrix matrix = new Matrix(); matrix.preRotate(90.0f); matrix.mapPoints(dist,src); </code></pre> <p>after operation rotate I have array with next values</p> <pre><code>-1.0 7.0 -2.0 7.0 -3.0 7.0 -4.0 7.0 </code></pre> <p>Its is good for area with 360 degrees. And how do rotate in area from 0 to 90? I need set up center of circle in this area but how ?<br> Thanks.</p>
java android
[1, 4]
2,435,464
2,435,465
Dynamically create an ImageButton
<p>I’m trying to dynamically declare an ImageButton.</p> <p>I declare it and assign an ID and Image to it as follows:</p> <pre><code>ImageButton btn = new ImageButton(); btn.ImageUrl = "img/Delete.png"; btn.ID = oa1[i] + "_" + i; btn.OnClick = "someMethod"; </code></pre> <p>But when I try to assign an OnClick handler for the button it throws the following exception:</p> <pre><code>System.Web.UI.WebControls.ImageButton.OnClick is inaccessible due to protection level </code></pre>
c# asp.net
[0, 9]
5,591,972
5,591,973
Is it possible to bounce an image with jQuery
<p>Hi i trying to bounce a jpg with jquery but its not going anywhere you can check the code at</p> <p><a href="http://jsfiddle.net/sethportman/WZumy/6/" rel="nofollow">http://jsfiddle.net/sethportman/WZumy/6/</a></p>
javascript jquery
[3, 5]
1,380,406
1,380,407
jquery How to access only checked checkbox?
<p>I have a div which contains <code>7 checkboxes</code> , i wrote this following code for accessing <code>only the checked checkbox</code> into the <code>array icons</code></p> <pre><code>var icons = $("div").find("input[type=checkbox]").each(function () { if($(this).attr("checked") == "checked") return this; }); alert(icons.length); </code></pre> <p>but it always alert 7 .Can anybody tell me the problem?</p>
javascript jquery
[3, 5]
5,429,629
5,429,630
How do I send an array of hashes as a parameter in a jQuery.get() request?
<p>I have an array of hashes in Javascript, which I need to send as a parameter in a jQuery.get() request. I've tried this:</p> <pre><code>$.get('../notes/notes_temp_path',{temp_param:notes_array}, function(data) { console.log("done"); }); </code></pre> <p>but the server doesn't get the <code>temp_param</code> parameter. What do I need to do? Thanks for reading.</p> <p>EDIT:</p> <p>If I do</p> <pre><code>for (index in notes_array) { console.log(notes_array[index]); } console.log(window.JSON.stringify(notes_array)); </code></pre> <p>I get</p> <pre><code>[ ] note_name "note1" [ ] note_name "note2" [[],[]] </code></pre> <p>The server receives this as well:</p> <pre><code>"temp_param"=&gt;"[[],[]]" </code></pre>
javascript jquery
[3, 5]
2,755,125
2,755,126
jQuery Syntax error, unrecognized expression error when Tag id contains `$` sign
<p>I want to hide a specific <code>div</code> element, the name of which contains <code>$</code> sign, but I get the following error in firebug:</p> <pre><code>Syntax error, unrecognized expression: $Frame </code></pre> <p>jQuery code:</p> <pre><code>$(document).ready(function() { $("#Button1").click(function() { $("#ctl00_content_TabContainer1_TabPanel1_PdEnd$Frame").hide(); }) </code></pre> <p>What's wrong??</p>
jquery asp.net
[5, 9]
4,267,265
4,267,266
jquery color coding
<p>I have some part numbers as a string.For example : <code>partnumber = "a1;a2;a3"</code></p> <p>Now I am displaying it using <code>text()</code> function like</p> <pre><code>$("#id").text("Part number(s) " + partnumber+ " is shown"); </code></pre> <p>But I want to change the color of <code>partnumber</code> only and not the full text.</p> <p>So I should get something like this :</p> <p>Part number(s) (some color) a1;a2;a3 (some color) is shown. How to do this using jquery?</p>
javascript jquery
[3, 5]
2,472,415
2,472,416
Conflict between the different INCLUDED JavaScript files
<p>When I include the <a href="http://filamentgroup.github.com/EnhanceJS/enhance.js" rel="nofollow">enhance.js</a> plugin it makes a conflict with other jquery plugins, such as UI jquery plugins </p> <p>I can't use the date picker functions for example .</p> <p>what is the possible solution ?</p>
javascript jquery
[3, 5]
5,765,825
5,765,826
Jquery: Setting/removing two attributes at once
<p>I am upcoming learner with jquery. Does anyone know how to give set two attributes at once that fit into the below example?</p> <p><strong>For the moment I am only able to give it one attribute. My goal is to able to give two attributes to a select box 'disabled' and 'hidden'</strong></p> <pre><code>obj.nextAll('.update').html('&lt;option value=""&gt;----&lt;/option&gt;').attr('disabled', true); </code></pre> <p><strong>Same things goes for removing the attributes: 'disabled' and 'hidden'</strong></p> <pre><code>obj.next('.update').html(data.list).removeAttr('disabled'); </code></pre>
javascript jquery
[3, 5]
3,018,024
3,018,025
How can I call a non-static method in a child Activity of an ActivityGroup from the ActivityGroup?
<p>I think the easiest way to ask the question would be to demonstrate how my current workflow is set up first:</p> <ol> <li>There is a <code>TabHost</code> that has an <code>ActivityGroup</code> as one of its tabs</li> <li>That <code>ActivityGroup</code> as an <code>Activity</code> in it that calls an external service that I have no control over.</li> <li>The External Service has a callback function that kicks off <code>onActivityResult</code> in the <code>ActivityGroup</code> and <strong>NOT</strong> in the <code>Activity</code> that called the Service. This is because in order to have even have the <code>onActivityResult</code> fire, I had to call <code>getParent().startActivityForResult(</code></li> </ol> <p>The problem is that I want 'stuff' to happen in the <code>Activity</code> that called the External Service (e.g. an <code>Alert Dialog</code>, a web service call etc). </p> <p>So, how can a call a non-static method in the child Activity from the <code>ActivityGroup</code>? Is this even possible?</p>
java android
[1, 4]
1,974,938
1,974,939
use jquery to echo value from text box
<p>I am attempting to echo out the value after a text box has been filled in. </p> <pre><code>&lt;input name="cron" type="textbox" placeholder=" Please insert a valid command in cron time format" class="required" /&gt; </code></pre> <p>The value of this textbox will then need to go into my cron_parser function and will echo out with $next_time</p> <pre><code>$cron_parser = new cron_parser($cron); $next_time = $cron_parser-&gt;next_runtime(); </code></pre> <p>Essentially after the text box is filled in, I want the following result to be echo'd out on the screen and update if the text box is changed.</p> <pre><code>&lt;div class="alert success"&gt; &lt;span class="icon"&gt;&lt;/span&gt;&lt;strong&gt;Is this correct?&lt;/strong&gt; Your backup will run next at &lt;?php echo $next_time ?&gt; &lt;/div&gt; </code></pre>
php jquery
[2, 5]
4,718,249
4,718,250
Fixed header navigation and scrollTo() next/previous elements
<p>First off I use this code to make the navigation bar always stay fixed;</p> <p>After adding CSS position absolute:</p> <pre><code>var yOffset = $("#header").offset().top; $(window).scroll(function() { if ($(window).scrollTop() &gt; yOffset) { $("#header").css({ 'top': 0, 'position': 'fixed' }); } else { $("#header").css({ 'top': yOffset + 'px', 'position': 'absolute' }); } }); </code></pre> <p>But now my next/previous key events which used to scroll to next element is not catching the right element position.</p> <p>here is my code for browsing next/prev element.</p> <pre><code>// scroll to next post function scrollToNew () { scrollTop = $(window).scrollTop(); $('.post').each(function(i, h1){ h1top = $(h1).offset().top; if (scrollTop &lt; h1top) { $.scrollTo(h1); return false; } }); } // scroll to previous post function scrollToLast () { scrollTop = $(window).scrollTop(); var scrollToThis = null; $('.post').each(function(i, h1) { h1top = $(h1).offset().top; if (scrollTop &gt; h1top) { scrollToThis = h1; } else { return false; } }); if(scrollToThis != null) { $.scrollTo(scrollToThis); } } </code></pre> <p>I simply used to fire the scrollToNew when key pressed and it was working until I made the fixed navigation (#header) because it stays always on top so the heading of post which user scrolls to, becomes invisible. I do not know how to get around this issue.</p> <p>Any suggestions are greatly helpful really.</p>
javascript jquery
[3, 5]
1,016,252
1,016,253
passing value to jquery methode in jquery coundown plugin
<p>I'm using jquery countdown plugin and i've two questions . i have the following code</p> <pre><code>$('#countbox').countdown({ layout:'&lt;b&gt;{d&lt;}{dnn}:{d&gt;}'+ '{hnn}: {mnn} : {snn} &lt;/b&gt;', timeSeparator: ':', onExpiry: sold, onTick: highlight, serverSync: serverTime }); function serverTime(pid) { var time = null; $.ajax({ url: 'ajax_countdown', async: false, data: ({pid:pid}), dataType: 'text', success: function(text) { time = new Date(text); }, error: function(http, message, exc) { time = new Date(); }}); alert(time); return time; } </code></pre> <p>Question 1: using this i 'm calling function serverTime . here i want to pass the value pid to the method.how to do this ?</p> <hr> <p>Question 2:</p> <p>Second one is related to javascript date function </p> <pre><code>$d4 ="2011,01-1,11,23,31,32"; alert(new Date(&lt;?php echo $d4; ?&gt;)); </code></pre> <p>when i alert this i'm getting following result</p> <blockquote> <p>Tue Jan 11 2011 23:31:32 GMT+0530 (India Standard Time)</p> </blockquote> <p>But,the ajax call(mentioned above: question 1) also return the same result here when i alert bellow one i'm getting </p> <blockquote> <p>Invalid Date</p> <p>alert(time);</p> </blockquote>
javascript jquery
[3, 5]
2,739,154
2,739,155
How to open a file
<p>In my project I am trying to open a file. I am storing all the path of the file name along with extensions like .exe,.doc,.xml,etc.....in my database. I am fetching that path and trying to open it.In this I like to open it as a popup window to ask like OPEN,SAVE,CANCEL . Can any one help me to solve this problem. Here is the code:</p> <pre><code>private void OpenMyFile() { string path = GetPath() + ViewState["fileopen"]; FileInfo file = new FileInfo(ViewState["fileopen"].ToString()); SqlConnection con = new SqlConnection(@"server=servername;database=DBNAME;uid=ID;pwd=PWD;max pool size=250;Connect Timeout=0"); con.Open(); cmd = new SqlCommand("select * from filetypemaster where extension='" + file.Extension + "'", con); myReader = cmd.ExecuteReader(); if (myReader.Read()) { Response.ContentType =(String)myReader["CONTENT_TYPE"]; myReader.Close(); } else { myReader.Close(); Message("Cannot open selected file"); return; } Response.WriteFile(path); Response.End(); con.Close(); } </code></pre> <p>Thanks in advance</p>
c# asp.net
[0, 9]
3,327,752
3,327,753
Page scroller like SQL Designer
<p>How can i make a page scroller with jquery like SQL Designer panel here one image of it: <a href="http://screensnapr.com/v/jX0Pk1.png" rel="nofollow">http://screensnapr.com/v/jX0Pk1.png</a></p> <p>link: <a href="http://ondras.zarovi.cz/sql/demo/" rel="nofollow">http://ondras.zarovi.cz/sql/demo/</a> please see at right bottom that panel.</p> <p>Thanks for any help.</p>
javascript jquery
[3, 5]
1,141,175
1,141,176
Changing Android Device name in code
<p>I am trying to change the name of the Android Device that my program that is currently running on because the name of the device will contain information that is relevant when it communicates with other phones. The name of the phone will be constantly changed as phone scans for other phones and calculates information. Any ideas on how to change the name of the phone within the java code? I can't image it being more than a few lines of code, but I can't find anything. Thanks in advance.</p>
java android
[1, 4]
3,207,704
3,207,705
Java implementation that is similar to C#'s XmlDocument
<p>Is there a java implementation that is similar to C#'s System.Xml.XmlDocument? I am currently trying to replicate this C# code fragment in Java. </p> <pre><code>XmlDocument doc = new XmlDocument(); doc.Load(new XmlTextReader(new StringReader(message))); XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable); nsmgr.AddNamespace("x", nameSpace); XmlNodeList nodeList = doc.SelectNodes("//x:Object//@*", nsmgr); </code></pre>
c# java
[0, 1]
2,644,438
2,644,439
Return clickable URL from text URL in JavaScript
<p>I'm working on a cascading dropdown list. When the last item is selected, it pulls up info from a .cs list based on all of the previous selections. This is working well. However, I would like the displayed results to include a clickable link as well as the other info. Right now I'm using document.write to open a new window with the link on it. This is not ideal.</p> <pre><code> function formatHyper(hyper) { var NewWindow = window.open('', 'name', 'height=660,width=650,status=1'); var str = "Parts"; NewWindow.document.write(str.link(hyper)); } </code></pre> <p>Hyper is the text link. Being called from an external .cs file that looks like this:</p> <pre><code>public class PhonePrice { private static List&lt;Phone&gt; Phones = new List&lt;Phone&gt;{ new Phone{Make="Apple",Model="iPhone 4",Carrier="ATT",Colour="black",Price=00.00f,Hyper="http://www.google.com"}, </code></pre> <p>When I complete the last dropdown selection it will display info about my selection but it then opens a new window with just the link. If I remove the NewWindow variable, it will load just the link in the current page, thus making it to where I can't see any of the other returned data. </p> <p>I would like it to work like the currency does. But instead of adding a $ I want it to convert the text into a URL</p> <pre><code> function formatPrice(price) { return "$" + price.toFixed(2); } </code></pre> <p>Here is what it looks like when it opens the clickable link in a new window. I would like the clickable link to appear where it says undefined.</p> <p><strong>Apple iPhone 4<br> Carrier ATT<br> Colour: black<br> Hyper: undefined<br> Price: $00.00</strong></p> <p>Please help!!</p> <p><a href="http://www.2shared.com/file/fFgPZGQm/CDD.html" rel="nofollow">Here's a link to the full code</a></p>
c# javascript
[0, 3]
1,165,575
1,165,576
How can I save objects as XML files
<p>I'm working on my high-school matriculation asp.net project, and I wish to make a website of a bookstore.</p> <p>I want to create two classes,<code>Book</code> and <code>BookStore</code>, and save the data created in XML files and not in a database.</p> <p>How can I save objects as XML files, and how can I load them afterwards?</p> <p>Thank you very much.</p>
c# asp.net
[0, 9]
5,319,932
5,319,933
Change an image for a second
<pre><code> ImageView image = (ImageView) findViewById(R.id.imageview); image.setImageResource(drawable.image1); SystemClock.sleep(1000); image.setImageResource(drawable.image2); </code></pre> <p>I am trying to change the image for a second, my code above doesn't work but not sure why? Should I be using a thread? or does anyone have any better ideas?</p> <p>EDIT To clarify on the problem:</p> <p>The image being displayed as "drawable.image2" I want "drawable.image1" to be shown for one second then change to "drawable.image2".</p> <p>EDIT2:</p> <p>This code is used in the onClick. When a user clicks the image it needs to change for one second</p>
java android
[1, 4]
3,793,196
3,793,197
Converting jQuery function to be reused easily without repetition
<p>I have the following function that fades each line of an unordered-list in and out. Right now it works for #skills_hints but I want to use it for other #named_hints. Is there a way I can reuse this code over multiple unordered lists without copying and pasting the <strong>entire</strong> code and just changing the IDs?</p> <pre><code>$(document).ready(function(){ $('#skills_hints .hint'); setInterval(function(){ $('#skills_hints .hint').filter(':visible').fadeOut(800,function(){ if($(this).next('li.hint').size()){ $(this).next().fadeIn(800); } else{ $('#skills_hints .hint').eq(0).fadeIn(800); } }); },7000); }); </code></pre>
javascript jquery
[3, 5]
3,809,827
3,809,828
How may I obtaining value of label element using substring in label's for attribute using jQuery?
<p>I am trying to obtain the value of label elements using jQuery (or javascript). The only search term I have is a substring of the label element's for attribute. In the example code shown below, this would be 'Okuku'.</p> <pre><code>&lt;label class="required" for="Nigeria-Osun-Okuku"&gt;The Township of Okuku&lt;/label&gt; </code></pre> <p>The Script:</p> <pre><code>$("label[for='Nigeria-Osun-Okuku']").text(); </code></pre> <p>would return </p> <blockquote> <p>The Township of Okuku</p> </blockquote> <p>but I don't have the complete 'for' value: Nigeria-Osun-Okuku <strong>but the last substring of it: 'Okuku'</strong>. </p> <p>How can I script to search, match and <strong><em>return: The Township of Okuku</em></strong> ? Thanks</p>
javascript jquery
[3, 5]
5,328,427
5,328,428
How to get String[] String's to a seperate String?
<p>I have a list of URL's added to a String[] with this.</p> <pre><code>try { Elements thumbs = jsDoc.select("div.latest-media-images img.latestMediaThumb"); List&lt;String&gt; thumbLinks = new ArrayList&lt;String&gt;(); for(Element thumb : thumbs) { thumbLinks.add(thumb.attr("src")); } for(String thumb : thumbLinks) { System.out.println(thumbLinks.get(1)); } } </code></pre> <p>How can i add each String that is loaded into a separate String?</p> <p>EDIT:</p> <p>SO as the images are loaded into the thumbLinks list. I want to get each link to a seperate </p> <pre><code>String url1; String url2; String url3; </code></pre>
java android
[1, 4]
5,956,408
5,956,409
Retrieve html from textbox and display in popup
<p>I'm retrieving a string from a textbox which will contain html eg <code>&lt;html&gt;&lt;head&gt;&lt;body&gt;&lt;div&gt;&lt;/div&gt;&lt;/body&gt;&lt;/head&gt;&lt;/html&gt;</code>.</p> <p>Basically i have got the content from the textbox, but cant get the popup to display like a html page.</p> <p>In my jquery code i have </p> <pre><code> var html = document.getElementById('&lt;%=txtHtmlBody.ClientID%&gt;').value; $(html).dialog(); </code></pre> <p>At the moment the content looks like it is squashed into a small box, with a transparent background. How can i get this to display like a html page in a popup?, any help is appreciated Thanks in advance</p>
javascript jquery
[3, 5]
1,300,655
1,300,656
finding if the click exists in set of coordinates
<p>Suppose i have coordinates of a rectangle. Now i want to find out if the touch event or click event position exists within the rectangle, How can i do that?</p> <pre><code>A B C D E </code></pre> <p>E.g i have this rectangle <code>ABDE</code>. I clicked on C, now i have all the coordinates. How can i figure out that c exists within <code>ABDE</code></p> <p>I assume that <code>Martix</code> is created for this purpose but I can't find any particular examples on internet.</p> <p>Best Regards</p>
java android
[1, 4]
3,644,261
3,644,262
JS replace not working on string
<p>Trying to replace all instances of # in a string with a variable. It's not working but not retuning any error either.</p> <pre><code>answer_form = '&lt;textarea name="answer_#" rows="5"&gt;&lt;/textarea&gt;'+ '&lt;input type="file" name="img_#" /&gt;'; question_num = 5; answer_form.replace(/#/g, question_num); </code></pre> <p>The hashes remain.</p> <p>Not sure what I'm missing?</p>
javascript jquery
[3, 5]
4,644,946
4,644,947
How do I stop an effect in jQuery
<p>I have a page that uses </p> <pre><code>$(id).show("highlight", {}, 2000); </code></pre> <p>to highlight an element when I start a ajax request, that might fail so that I want to use something like</p> <pre><code>$(id).show("highlight", {color: "#FF0000"}, 2000); </code></pre> <p>in the error handler. The problem is that if the first highlight haven't finished, the second is placed in a queue and wont run until the first is ready. Hence the question: Can I somehow stop the first effect?</p>
javascript jquery
[3, 5]
4,113,774
4,113,775
C# int.TryParse("3",out tst) AND Convert.ToInt32("3") returning 0x00000003 instead of 3 what can it be?
<p>All my code works fine until i did some changes that i cant track right now. when i debugg my code i can see that the converting returning hex instead of number. I have no idea why its happening or what can cause this. any ideas please? Thanks.</p>
c# asp.net
[0, 9]
3,983,046
3,983,047
Email sending Java, Android
<p>I create the app with button "Sending". When I pressed this button, the app must show me a list of email-clients from mobile. How do I make that? Thank you for, anyway. </p>
java android
[1, 4]
2,984,628
2,984,629
Is there any better way to do this in jquery?
<p>I want to know that is there any better method to do :</p> <pre><code>var name = $('input').attr("name") != "undefined" ? $('input').attr("name") : ""; </code></pre> <p>Here i am reading the <code>name</code> attribute of <code>input</code>. My problem is when i read the <code>name</code> for newly created <code>text</code> element, then it was <code>undefined</code>. So for not showing <code>undefined</code> to the user i have to put this check.Now i have to ready so many properties and in all of then the same problem exist so that`s why i want to know that, Is there any better way to deal will this?</p>
javascript jquery
[3, 5]
4,290,940
4,290,941
String to Date/Time object in Android
<p>I have a string that contains the date/time returned from a web service like so:</p> <pre><code>String dtStart = "2010-10-15T09:27:37Z" </code></pre> <p>How do I get this into an object such as Time or Date? I initially want to output it in a different format, but will need to do other stuff with it later (i.e. maybe use in a different format).</p> <p>Cheers</p>
java android
[1, 4]
1,012,172
1,012,173
How to pass a dynamic ID to a function in JQuery
<p>Update:</p> <p>in my code-behind code i have public varaible and assing like this </p> <pre><code>public string Id { get { return Request.QueryString["id"].ToString(); } }` </code></pre> <p>and in .aspx page i am trying to access </p> <pre><code>$(this).attr("EmployeeId", Id); </code></pre> <p>getting the error The name </p> <pre><code>'Id' does not exist in the current context </code></pre> <p><strong>end update</strong></p> <p>i have two aspx pages:</p> <pre><code>1) employee.aspx 2) employee_detail.aspx </code></pre> <p>how to pass an dynamic id from one page to another page</p> <p>the below code is in the <code>employee.aspx</code> page</p> <pre><code>//more code here.. //but to relvant to my question is here... var submitButton = function() { //more code here... if(employeeId != ""){ //redirecting here... window.location.href = "employee_detail.aspx"; } } </code></pre> <p>so in <code>employee_detail.aspx</code> page i have a jquery function, currently i am hardcoding the id something like this:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { var id = 'A42345'; //hardcoded.... $(this).attr("EmployeeId", id); &lt;/script&gt; </code></pre> <p>so my question is, i am looking a way to pass an id from <code>employee.aspx</code> and receive in <code>employee_detail.aspx</code></p> <p>i thought of doing this but for security reason i dont want to expose the id in the url:</p> <pre><code>window.location.href = "mypage.aspx?id = " + id; </code></pre>
javascript jquery asp.net
[3, 5, 9]
3,735,095
3,735,096
Form submit to run javascript and then post to php script
<p>I am currently working on a php/html/javascript project. I have a form where when the user presses the submit button, it should run a javascript function and then afterwards post to a php page to process the data that was submitted in the form.</p> <p>I have the form run a javascript method as below</p> <pre><code>&lt;form class="form" id="addImageForm" name="addImageForm" action="javascript:validateAddImage();" method="post"&gt; </code></pre> <p>The method validates the form, calls another method and then it submits the form using <code>document.myForm.submit();</code> </p> <p>How do I get it to submit the form to another php page to process the data including upload selected files.</p> <p>Thanks for any help you can provide. </p>
php javascript
[2, 3]
2,194,492
2,194,493
change base function behaveiour
<p>Assume I have executed this js code:</p> <pre><code>var container=function() { //do something } container.a=function { //do something 2 } container.b='34' </code></pre> <p>Here, in order to change container.a function for example I need to do:</p> <pre><code>container.a=function() { //do something 3 } </code></pre> <p>How do I change the function container() ?</p>
javascript jquery
[3, 5]
2,613,012
2,613,013
Inserting null values into DB when nothing is selected in a DDL
<p>I am inserting values from a dropdownlist into a DB. If nothing is selected I want to enter a null but if nothing is selected z-SELECT- this option not inserted into the DB. So how to enter null values.</p>
c# asp.net
[0, 9]
3,353,984
3,353,985
how to resize a div with the browser window using javascript or jquery
<p>Is it possible to re-size a <code>div</code>'s height with the browser window using JavaScript or jQuery getting the windows object dimensions and creating a function?</p>
javascript jquery
[3, 5]
5,956,018
5,956,019
Android - declaring namespace of my own app
<p>Hey, I tried to declare my own namespace, and use attrs.xml for holding some of attributes i need in application, but it just wont see my namespace. in Manifest file I have</p> <blockquote> <p>manifest<br> xmlns:android="http://schemas.android.com/apk/res/android"<br> package="com.gierca"<br> android:versionCode="1"<br> android:versionName="1.0"</p> </blockquote> <p>and so on.. and in my layout.xml I declared namespace as</p> <blockquote> <p>LinearLayout<br> xmlns:myapp="http://schemas.android.com/apk/res/com.gierca"<br> myapp:attribute="some_string"</p> </blockquote> <p>autofill doesnt work with this namespace, and it just doesnt work either. What am I doing wrong? I tried googling this, but even when I find some examples, they seem to be doing same thing as I do, and Im clueless</p>
java android
[1, 4]
1,249,482
1,249,483
Pop-up Thumbnails of Linked Pages
<p>I would like to show thumbnails of external websites that I link to when the user mouses over the links, similar to how snap.com does this. How can I accomplish the same thing?</p>
asp.net javascript
[9, 3]
885,877
885,878
Selecting an item in a GridView and adding to the List
<p>I have written the piece of code below to get a <code>productID</code> from a gridView when the user clicks on the select link.</p> <p><code>Convert.ToInt32(GridView1.SelectedDataKey.Values["productID"])))</code></p> <p>However, if a user clicks on this more than one click the newer value replaces the previous. Is there a way to keep adding to the cart list when the user clicks on a new item? </p> <p>Hope that makes sense</p> <p>Thanks</p> <p>Edit:</p> <p>Here's my code for the Shopping Page:</p> <pre><code>public partial class _Default : System.Web.UI.Page { List&lt;BasketClass&gt; cart = new List&lt;BasketClass&gt;(); protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e) { cart.Add(new BasketClass(Convert.ToInt32(GridView1.SelectedDataKey.Values["BookID"]))); Session.Add("CartSess", cart); Response.Redirect("Basket.aspx"); } } </code></pre> <p>I dont know if the location of creating the list is important? Wasn't sure if it was placed in the click event if it would keep creating a new instance?</p> <p>Then for the Basket Page I have:</p> <pre><code>protected void Page_Init(object sender, EventArgs e) { List&lt;BasketClass&gt; cart = (List&lt;BasketClass&gt;)Session["CartSess"]; foreach (BasketClass BookID in cart) { GridView1.DataSource = cart; GridView1.DataBind(); AccessDataSource1.SelectCommand = "SELECT [BookID], [book_title] FROM [tblBook] "; } } </code></pre>
c# asp.net
[0, 9]
2,372,907
2,372,908
How to use jQuery.map() on array of objects to return array of arrays
<p>I would like to use jQuery to convert an array of objects to array of arrays using map.</p> <p>For example if I have this:</p> <pre><code>var ObjArr = [{ a:1,b:2 },{ a:2,b:3 },{ a:3,b:4 }]; var ArrArr = $.map(ObjArr, function(n,i){ return [ n.a, n.b ]; }); </code></pre> <p>So that the result would be:</p> <pre><code>ArrArr = [[1,2],[2,3],[3,4]] </code></pre>
javascript jquery
[3, 5]
575,176
575,177
Javascript error: Error: ta is not defined
<p>I am new to JavaScript and I am trying to add a character counter to a text field using this code: </p> <pre><code>$(function(){ $('.txtclass').keypress(function(){ ta = $(this); if(ta.val().length &gt;= 350){ ta.val( ta.val().substr(0, 350) ); } else { $("#counter span").text(350-ta.val().length); } }); }); setInterval('$("#counter span").text(350-ta.val().length);', 350); </code></pre> <p>I get that JavaScript error: <code>"Error: ta is not defined"</code> and points me to that specific line in my code.</p> <p>Any insight into whats happening and how to fix it would be really appreciated as I'd like to add more counters for other text-fields into the website elsewhere. </p> <p>Edit: here's the html for the counter</p> <pre><code> &lt;div id="counter"&gt;&lt;span&gt;350&lt;/span&gt; characters remaining.&lt;/div&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
1,761,036
1,761,037
Updating on-screen element several times in one function
<p>This has got to be easy, but has got me stumped.</p> <p>How do I change an element on screen several times in one function?</p> <p>I want to change a label to read something like "starting..." at the beginning of my function, then go away and do some stuff and then change the label to "finished" at the end.</p> <p>As an illustration why does the following code:</p> <pre><code> errorMessage.Text = "Three..."; System.Threading.Thread.Sleep(1000); errorMessage.Text = "Two..."; System.Threading.Thread.Sleep(1000); errorMessage.Text = "One..."; System.Threading.Thread.Sleep(1000); errorMessage.Text = "Go!"; System.Threading.Thread.Sleep(1000); </code></pre> <p>Just pause for 4 seconds and then change the label text to "Go!" rather than counting down?</p> <p>TIA</p> <p>Ben</p>
c# asp.net
[0, 9]
27,862
27,863
Counting classes on another page and displaying them
<p>To save me a lot of work editing a number in when adding a document to a site I decided to use javascript to count the number of elements with a class <code>doc</code> .</p> <p>I am two main problems:</p> <ul> <li><p>There is trouble displaying the variable. I initially thought this was because I hadn't added <code>function</code>, however when I tried adding this the variable was still not displayed.</p></li> <li><p>The elements with the class I want to count are on another page and I have no idea how to link to it. For this I have tried <code>var x = $('URL: /*pageURL*/ .doc').length;</code> which hasn't worked. </p></li> </ul> <p>Essentially I want the total elements with said class name and this to be displayed in a span element. </p> <p>Currently I have something similar to what's displayed below:</p> <pre><code> &lt;script&gt; var Items = $('.doc').length; document.getElementById("display").innerHTML=Items; &lt;/script&gt; &lt;span id="display"&gt;&lt;/span&gt; </code></pre> <p>Found an example of something similar <a href="http://en.wikipedia.org/wiki/Special%3aStatistics" rel="nofollow">here</a> where the total numbers of articles are displayed.</p> <p><strong>Edit:</strong> </p> <p>@ian This code will be added to the homepage, domain.net/home.html. I want to link to the page containing this documents, domain.net/documents.html. I've seen this done somewhere before and if I remember correctly they used <code>url:domainname.com/count</code> somewhere in their code. Hope this helps.</p>
javascript jquery
[3, 5]
4,043,734
4,043,735
Data submitted on second click only C# ASP.NET
<p>Hallo there I have an interesting problem on which I was hoping to gain some insight. I have a page with some textboxes an a radiobutton list and the information I submit to an access database in a web service. When I click the submit button there seems to be a post back but the data is not inserted into the database and only after the second click does it get inserted without any problems. If I wait a few minutes (strangely enough) then the info is submitted upon the first click. I am using session variables within which I store information and when this page is loaded the information stored in the session variables is displayed in the textboxes with Read-Only enabled. I then make a selection on the radion button list and add some additional information in another textbox before I click on submit which seems to "kick" away..I presume it is a postback... and then if I click for the second time only then the information is submitted. </p> <p>Could the info loaded into the textboxes of the page from the session variables perhaps be the problem and how would I go about in overcoming this? </p> <p>I do use if (IsPostBack) with the loading and the problem remains. If I do not add (!IsPostBack) the problem is worse and sometimes the info is only submitted after the third click. </p> <p>Kind regards Arian</p>
c# asp.net
[0, 9]
3,959,158
3,959,159
jQuery division visibility hidden is not working
<pre><code>$("#id_btnquizzestwo").click(function() { $temp = $("#rightsideeightone").is(":visible"); if($temp) { $("#rightsideeightone").css('display') = 'none'; } }) </code></pre> <p>The rightsideeightone division is not being hidden.</p> <p>What to do ?</p> <pre><code>$("#id_btnquizzestwo").click(function() { $temp = $("#rightsideeightone").is(":visible"); //alert($temp); if($temp) { $("#rightsideeightone").hide(); } $temp2 = $("#rightsideeighttwo").is(":hidden"); //alert($temp2); if($temp2) { $("#rightsideeighttwo").show(); } }) </code></pre> <p>I tried this, the rightsideeighttwo is not being visible. Initialy the rightsideeightone is visible and the rightsideeighttwo is hidden.</p> <pre><code>&lt;div id="rightsideeight" &gt; &lt;div id="id_pollsquizzes" &gt; &lt;?php echo '&lt;ul&gt;'; ?&gt; &lt;?php echo '&lt;li&gt;'; echo $this-&gt;Form-&gt;button('Polls',array('type'=&gt;'button','id'=&gt;'id_btnpollstwo')); echo '&lt;/li&gt;'; echo '&amp;nbsp&amp;nbsp'; echo '&lt;li&gt;'; echo $this-&gt;Form-&gt;button('Quizzes',array('type'=&gt;'button','id'=&gt;'id_btnquizzestwo')); echo '&lt;/li&gt;'; echo '&amp;nbsp&amp;nbsp'; ?&gt; &lt;/div&gt; &lt;div id="rightsideeightone" style="visibility: visible" &gt; ...................... &lt;/div&gt; &lt;div id="rightsideeighttwo" style="visibility: hidden" &gt; ...................... &lt;/div&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
3,232,037
3,232,038
How to port a J2ME application to Android platform?
<p>I have heard that there are soft wares for converting an existing J2ME app to Android? But I was doing a manual conversion till now. Am I doing a silly job/is it possible to do convert any J2ME application?</p>
java android
[1, 4]
4,530,402
4,530,403
Cannot allow duplicate enty in textboxes using jquery
<p>i have a text boxes in every row with same name like this</p> <pre><code> &lt;tr&gt; &lt;g:textField name ="point" value = "" class = "destination_points" id ="point_0" /&gt; &lt;input type ="hidden" value ="" name ="pointDistanceMapping.point.id" id ="point_id_0" class="point_id"/&gt; &lt;/tr&gt; &lt;tr&gt; &lt;g:textField name ="point" value = "" class = "destination_points" id ="point_1" /&gt; &lt;input type ="hidden" value ="" name ="pointDistanceMapping.point.id" id ="point_id_1" class="point_id"/&gt; &lt;/tr&gt; &lt;tr&gt; </code></pre> <p>i have to validate that these text boxes should not have same value so how can i do it using jquery...</p>
javascript jquery
[3, 5]
4,693,454
4,693,455
ASP.NET and jQuery - call from codebehind
<p>This is a problem i've tried so solve before but gived up. Basicly i'm using ModalPopupExtenders (from AJAX.NET) to display Panels with a few content (text, controls, etc). And i'm calling it from codebehind. And it works well.</p> <p>But now i want to replace the ModalPopup with some jQuery dialog box. The problem is calling it from codebehind. As far as i know, i have to register the jQuery libraries on RegisterStartup event, but i've tried it and call the jQuery from codebehind but with no sucess.</p> <p>Can someone help me? I really want to replace the ModalPopup, they gives me to much trouble.</p> <p>Thanks in advance.</p> <hr> <pre><code>protected void Page_Load(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "registerDialog", "$(function() { $('#dialog').dialog({autoOpen:false, show:'blind'}); });", true); } protected void Button1_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this, GetType(), "openDialog", "$('#dialog').dialog('open');", true); } </code></pre> <p>Is this the correct way? I've to register it first to stay hidden. Thanksю</p>
asp.net jquery
[9, 5]
1,402,695
1,402,696
Send information from activity via network
<p>I want to send the data I get in onLocationChanged() via tcp/ip. I can read the location and network works, too: I can connect and send data. The problem is: Network can't be in the Activity-thread, but onLocationChanged() has to. Now here is my question: How do I get the location information from the activity thread to the network thread?</p> <p>Thanks in advance.</p> <p>Edit: I have to send the data over and over again and don't want to reconnect every second.</p>
java android
[1, 4]
1,659,401
1,659,402
anticipating a click event within a while loop - jquery/javascrip
<p>I'm working on a little dice game app with javascript/jquery and the part where I run into trouble is in the following while loop. I want the user to click the button and then the body of the while loop should execute. However, with the following code, the contents of the while loop execute without waiting for the user to click each time. Is this the right way to approach what I'm trying to do?</p> <pre><code> while (dice.value != rollFirst &amp;&amp; dice.value != 7) { $("#roll").click(function() { $("#roll").unbind('click'); dice.roll(); }); </code></pre> <p>update: Based on the responses, maybe I wasn't totally clear in what I'm trying to do. For every iteration of the while loop, I want to user to click the roll button and only then do I want to continue execution of the contents of the while loop. In other words, I want the while loop to wait until the users clicks "roll" for each iteration.</p> <p>As it is right now, the logic of the program works but it doesn't wait for the user to click the roll button.</p>
javascript jquery
[3, 5]
3,820,373
3,820,374
Patter checking.check of incorrect number of operators and brackets
<p>In an expression , How to</p> <ol> <li><p>1.Check if operators and operands are correct or not.</p></li> <li><p>2.check if brackets match or not.</p></li> </ol> <p><strong>Example 1</strong>: <code>(a+b)-</code> has a one extra operator How do i confirm that the number of operators are incorrect.</p> <p><strong>Example 2</strong> :<code>((a+b)/(c-d)</code> has one extra opening bracket. how to check such irregularities. Any regular expression pattern to check these or some way to do this ? Please help .</p> <p>Thanks in advance.:)</p>
c# javascript asp.net
[0, 3, 9]
4,277,045
4,277,046
dynamically change alternate row colors
<p>I have 5 tr, these are row alternate color. Now how to change tr color dynamically when I delete some row.</p> <p>Assume below is table tr and td</p> <p>this is my row </p> <pre><code>tr class='odd' tr class='even' tr class='odd' tr class='even' tr class='odd' tr class='even' tr class='odd' tr class='odd' tr class='even' if I delete this tr, than tr class='odd' tr class='even' tr class='odd' tr class='even' tr class='odd' tr class='odd' tr class='even' class changed odd to even tr class='odd' class changed even to odd tr class='even' class changed odd to even tr class='odd' class changed even to odd tr class='even' tr class='odd' </code></pre>
javascript jquery
[3, 5]
3,874,555
3,874,556
Calling JQuery function from different context
<p>This might be a very basic question but I'm trying to understand this behavior</p> <p>This is my javascript code. I want to know why second call to foo does not work. Here is the <a href="http://jsfiddle.net/kwdxa/" rel="nofollow">JSFiddle link</a></p> <pre><code>$.fn.foo = function(somestring){ var $this = this; $this.html(somestring); } $(function(){ $('#container').foo("within function"); //this works }); $('#container').foo("outside"); //this does not </code></pre>
javascript jquery
[3, 5]
1,152,069
1,152,070
Having trouble building a calculator
<p>I am trying to build a simple calculator to learn javascript/jquery but seem to be getting quite confused on how to make it work. Basically at the moment I dont seem to be able to update my tally correctly, instead of the numbers/values being added together in a sum they are being concatenated instead, if anyone could give me some guidance on how I can get back on the right path with this and any other advice on how to make the code more efficient then that would be great. I don't want anyone to give me the correct script just yet.</p> <p><a href="http://jsfiddle.net/kyllle/edRk9/4/" rel="nofollow">http://jsfiddle.net/kyllle/edRk9/4/</a></p> <p>Thanks all in advance for your advice</p>
javascript jquery
[3, 5]
4,718,727
4,718,728
How to attach image in input fields using Php/javascript?
<p>I am having one form in that input fields are <strong>regno,name,date of birth</strong> etc.</p> <p>With this input fields i need to attach image along with this input fields how I can do using <code>PHP/JavaScript</code></p>
php javascript
[2, 3]
6,023,108
6,023,109
Transferring data from the form in the browser through own sheme
<p>I have a question about own sheme. I can go to Activity if I click url link in browser but I can't go Activity if i set url in browser or send form in own sheme url. </p> <p>Is it even possible to catch such action on its own sheme?</p>
java android
[1, 4]
5,971,235
5,971,236
C#, why string variable isn't set?
<p>I have this code</p> <pre><code>using partial class : system.web.ui.page { private string mystr = ""; protected void func1() { string internalstring = "abc"; mystr = String.Copy(internalstring); } private void func2() { func1(); echo(mystr); // mystr is "", why?? } } </code></pre> <p>What's wrong with this? Where am I getting wrong?</p>
c# asp.net
[0, 9]
2,902,184
2,902,185
Issue getting information from database into variable
<p>ok, so i have got a dropdownlist, which contains a number from a database(the amount of seats taken). If the rest of the dropdownboxes change(the flight arrival/departure), the dropdown box with the seats taken box changes to the correct piece of data associated with that flight I am trying to store the seats taken into a variable, however, the number which is stored is the number from the previous value that was in the dropdown box and not the updated value</p> <p>Is there a way i can get the new updated number into the variable?</p> <p>Sorry for not being clear :/</p> <pre><code> int flightsTaken; string departure, arrival; departure = Convert.ToString(DropDownListDepartures.Text); arrival = Convert.ToString(DropDownListArrivals.Text); //Sets up how many flights are availabe for each departure place if (departure == "London (Ltn)") flightsAvailable = 12; else if (departure == "Edinburgh") flightsAvailable = 3; else if (departure == "Manchester") flightsAvailable = 6; flightsTaken = Convert.ToInt32(DropDownList2.Text); //THIS GETS THE PREVIOUS NUMBER NOT THE CURRENT NUMBER flightsAvailable -= flightsTaken; </code></pre>
c# asp.net
[0, 9]
5,435,981
5,435,982
jQuery/JS : empty field after success?
<p>at my ajax call success i wish to empty the field.</p> <pre><code> success: function(msg){ $(wrapperId).prepend(msg); } } </code></pre> <p>I tried this:</p> <pre><code> success: function(msg){ $(wrapperId).prepend(msg); $('#message').html(""); } } </code></pre> <p>But it wont work</p>
javascript jquery
[3, 5]
2,302,654
2,302,655
Concise way to compare against multiple values
<p>Consider the following:</p> <pre><code>var a = 'jesus'; if(a == 'something' || a == 'nothing' || a=='anything' || a=='everything'){ alert('Who cares?'); } </code></pre> <p>Is there a way to make this shorter?</p> <p>Is there anything in Javascript like <code>if (a=='bbb'||'ccc')</code>?</p> <p>In addition, can jQuery help here?</p>
javascript jquery
[3, 5]
1,532,961
1,532,962
How to Get cell index in gridview
<p>I'm using a website(asp.net,C#) to view some details in gridview. In that gridview I have generated checkboxes dynamically. So it will be placed any cell inside of that gridview. I find that control in grdview by using FindControl(), but I cant get that cell index... now I want to get that excact cell index which placed that checkbox. How shall I get that cell index?</p> <p>Please anyone Tell me the solution of this problem.</p> <p>Thanks in advance.</p> <p>My code for getting that Control is:</p> <pre><code>if (HeaderCell.Text.Contains(strColumnName)) { CheckBox chk = GrdDynamicControls.Rows[index].FindControl(chkCheckBox1.ID) as CheckBox; chk.Checked = true; strCelValue = chk.Checked.ToString(); } </code></pre>
c# asp.net
[0, 9]
5,311,999
5,312,000
How do I make an ASP.Net GridView postback on an onBlur event?
<p>I have an ASP.Net GridView, with two columns ("ID" and "name"). The name column is editable via an &lt;asp:TextBox&gt;. What I want to do is have the grid trigger its update event when the user clicks away from an editable cell. </p> <p>I know I can attach an onBlur event handler to the TextBox to retrieve the value when the user clicks away. However, I don't know how to trigger the GridView's update event programmatically through JavaScript. Any suggestions?</p>
c# javascript asp.net
[0, 3, 9]
1,866,848
1,866,849
load() without jQuery?
<p>I am trying to get rid of using jQuery from my widget, having troubles finding how to replace load().</p> <p>How would i do this in native JavaScript?</p> <pre><code> $('#IframeABC').load(function() { var animator = new Animator('sWrapper'); animator.animate(); css('sWrap', 'display', 'block'); }); </code></pre>
javascript jquery
[3, 5]
1,323,773
1,323,774
Why is the fact that Microsoft decided to support jQuery such a big deal?
<p>I don't see what all this fuss is about Microsoft's decision to support JQuery within ASP.NET MVC.</p> <p>There were signs that open-minded people are starting to have some say in the matters of marketing for a while now. And even the way MS does business has started to change. But at it's core it's still acting in response to customers' requests.</p> <p>I for one don't know what to make of it, except that it brings back to Microsoft's sphere of influence a very visible product.</p>
jquery asp.net
[5, 9]
5,223,695
5,223,696
Social Popup Plugin
<p>I'm trying create something so that when the user gets to the end of the page they get a div popup.</p> <p>For some reason it's working in Internet Explorer but in Chrome it doesnt. I'm thinking because the top() element:</p> <pre><code>&lt;span id="myPara"&gt;&lt;/span&gt; &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(window).scroll(function() { if ($('#myPara').offset().top &lt; $(this).height() + $(this).scrollTop()) { $('#msgBox').show(); $('#msgBox').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350}); } else { $('#msgBox').hide(); } }); &lt;/script&gt; </code></pre> <p>can someone tell me how to fix it?</p>
javascript jquery
[3, 5]
347,977
347,978
Given a string of html code, how can I go through every tag and remove ones that is not in my whitelist (in JQuery)?
<pre><code>var whitelist = ['a','div','img', 'span']; </code></pre> <p>Given a block of HTML code, I want to go through <strong>every single tag</strong> using JQuery</p> <p>Then, if that tag is NOT in my whitelist, <strong>remove it and all its children.</strong></p> <p>The final string should now be sanitized.</p> <p>How do I do that?</p> <p>By the way, this is my current code to remove specific tags (but I decided I want to do whitelist instead)</p> <pre><code> var canvas = '&lt;div&gt;'+canvas_html+'&lt;/div&gt;'; var blacklist = ['script','object','param','embed','applet','app','iframe', 'form','input', 'link','meta','title','input','button','textarea' 'head','body','kbd']; blacklist.forEach(function(r){ $(canvas).find(r).remove(); }); canvas_html = $(canvas).get('div').html(); </code></pre>
javascript jquery
[3, 5]
2,388,606
2,388,607
How can I convert php string value to android string value?
<pre><code>public static String ConnDB() throws ParseException, IOException { // TODO Auto-generated method stub String webAddress = "http://10.0.0.1:8080/jspbook/AppStore/NewFile.php"; HttpGet httpGet = new HttpGet(webAddress); HttpClient httpclient = new DefaultHttpClient(); HttpResponse response = httpclient.execute(httpGet); String responseBody = EntityUtils.toString(response.getEntity()); Log.d("res", responseBody); return responseBody; } </code></pre> <p>Above is part of android code. I checked this code getting resopnse from php server without problem. <br> However, emulator not only received values from php, but also received all the php code which I dont <br> need. <br></p> <p> <br> $time = "test time";<br> $grade = "test grade";<br> $title = "test title";<br> $content = "test content";<br> <br> echo ( "$time " );<br> echo ( "$grade " );<br> echo ( "$title " );<br> echo ( "$content " );<br> echo("abc");<br> ?> <br></p> <p>I only need value of $time , $grade , $title, $content but my emulator gets all the php code. <br></p> <p>so.. my question is.. How can I convert php String $time to android java String time? </p>
php android
[2, 4]
3,157,635
3,157,636
Call php query with javascript
<p>my Code </p> <pre><code>&lt;script type="text/javascript" src="http://test.com/test.php"&gt;&lt;/script&gt; </code></pre> <p>the javascript is for a multidomain use , it must be like this it <strong>can't</strong> be changed </p> <p>i need to make the javascript call the php with the host url as query</p> <p>location.hostname</p> <pre><code>&lt;script type="text/javascript" src="http://test.com/test.php?*location.hostname*"&gt;&lt;/script&gt; </code></pre> <p>what will need to put in the javascript ??? i know what to put in the php</p>
php javascript
[2, 3]
3,803,424
3,803,425
Theme has superfish - how to add supersubs?
<p>I'm using a theme that is using Superfish for the navigation menu. The problem is, if the sub item is too long it will drop underneath, i want to keep the individual menu item's text on one line.</p> <p>Now i've found supersubs for the superfish menu but i don't know how to add it to the theme.</p> <p>This is in the functions.php file.</p> <pre><code>wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js'); </code></pre> <p>and this is in the header.php file.</p> <pre><code>&lt;script type="text/javascript"&gt; jQuery(function($){ $(document).ready(function(){ //Drop Down Menu $('ul.sf-menu').superfish({ delay: 1000, animation: {opacity:'show',height:'show'}, speed: 'normal', autoArrows: true, dropShadows: false }); }); }); &lt;/script&gt; </code></pre> <p>How can i add supersubs to the menu as well to solve the problem i'm having with the sub items.</p> <p>Thanks</p>
jquery javascript
[5, 3]
248,339
248,340
preload input type image
<p>How can I preload images when they are defined "within" an input type in the html layout like this:</p> <pre><code>&lt;input type="image" src="bla.png" id="myimage1" data-url="Myurl" /&gt; </code></pre> <p>I see so many samples with the img-tag but not the input of type image.</p>
javascript jquery
[3, 5]
919,088
919,089
How to access a closure variable from within a callback
<p>I am looping through an array of urls. Each one fetches some jsonp data from a different domain. The success handler needs to be able to access the data in the original loop, however when called from the callback it is always the last value and not the value that was set when the ajax function was called. How do I access or pass this value to the callback?</p> <pre><code>for(var site in data.sites){ var domain = data.sites[site].domain; $('#site-logout').append('&lt;div class="processing" id="' + domain.replace(".","-") + '"&gt;&lt;strong&gt;' + domain + '&lt;/strong&gt; is logging out.'); $.getJSON(url, function(data){ if(data.success == true) $("#" + domain.replace(".","-")).removeClass("processing").addClass("processed").html('&lt;strong&gt;' + domain + '&lt;/strong&gt; has logged out.'); else $("#" + site.domain.replace(".","-")).removeClass("processing").addClass("error").text('&lt;strong&gt;&lt;a href="http://' + domain + '"&gt;' + domain + '&lt;/a&gt;&lt;/strong&gt; has failed to log out. Follow the link to try manually.'); }); } </code></pre>
javascript jquery
[3, 5]
5,536,427
5,536,428
How to retrieve value in jquery
<p>In my js I have a var in which I have stored innerHTML. The var is having value something like</p> <pre><code> &lt;h2&gt;headline&lt;/h2&gt; &lt;div&gt;....&lt;/div&gt; ........... </code></pre> <p>Now I want to retrieve value of h2 tag..what I am doing is</p> <pre><code> $(myvar).find("h2").text() </code></pre> <p>but its not working...what should be the exact syntax? EDIT:</p> <pre><code> alert(myvar)=&lt;h2&gt;headline&lt;/h2&gt; &lt;div&gt;....&lt;/div&gt; </code></pre> <p>Thanks.</p>
javascript jquery
[3, 5]
2,449,014
2,449,015
How to locate a path in ASP.NET application
<p>How to locate a place on a machine(virtual path) in an ASP.NET APPLICATION,</p> <p>the problem is this, In windows or desktop application we have .exe in debug folder so can refer other files relatively to .exe like ..\resources mean one folder upper of .exe there is a resouce folder, if i want to do the same in web application how to do that</p>
c# asp.net
[0, 9]
3,779,158
3,779,159
Create a global javascript or jQuery variable visible in many pages
<p>I have a js variable with many functions, and I want to create in one of them a global variable visible in another php file that load the js file.</p> <p>How can I do that ? </p> <p>Thanks for help.</p> <p>Thaks for help : here's an edit : </p> <p>The variable has a dynamic value and is generated <code>on event.keyCode</code> I have tried in my js file: <code>window.selected_sku = null;</code> in the top of the js file</p> <p>and in the appropriate function :</p> <pre><code>window.selected_sku = v; </code></pre> <p>In my php within javascript code, I have : </p> <pre><code> if(window.selected_sku!=null){ alert(window.selected_sku); } </code></pre> <p>but I don't get any alert !!</p> <p>Help..</p>
javascript jquery
[3, 5]
766,157
766,158
Increase/ decrease value with dragging
<p>I'd like to have such a feauture in my app: when user drag finger on the screen up to down some parameter will be decreased, when drag down to up, parameter will be increased. I will use is to dynamically change length of drawed element. Could you give me some instrutions how to write such a thing?</p> <p>EDIT: To be more precisely. I think I should use MotionEvent.ACTION_MOVE. But can't figure out how to do something like: depending on move Y length I add or subtract proportional value. Could you help me?</p>
java android
[1, 4]
372,163
372,164
Count + / - for checkbox click and unclick
<p>When a user clicks the checkbox the counter #counter +1, thats fine, but when he unchecks it does not -1 for the same checkbox. I want to +1 when they click a particular checkbox and when unchecking -1.</p> <p>--JS--</p> <pre><code>$('.CheckBox').toggle(function(){ $('#Counter').html('( '+i+' Selected )'); i++; }, function() { $('#Counter').html('( '+i+' Selected )'); i--; }); </code></pre> <p>---PHP--- </p> <pre><code>do { ?&gt; &lt;div style="position:relative; width:100%; height:20px; background-color:#FF5300;" class="CheckBox" id="&lt;?php echo $row_EX['x1']; ?&gt;"&gt; &lt;input type="checkbox" name="&lt;?php echo $row_EX['x2']; ?&gt;" value="&lt;?php echo $row_EX['x3']; ?&gt;" style="cursor:pointer; "&gt; &lt;span style="position:relative; top:-2px; font-family:arial; color:#000; font-size:12px;"&gt;&lt;?php echo $row_EX['lx4']; ?&gt;&lt;/span&gt; &lt;/div&gt; &lt;div style="height:1px; width:1px;"&gt;&lt;/div&gt; &lt;?php } while ($row_EX = mysql_fetch_assoc($EY)); ?&gt; &lt;span style="position:relative; left:10px; top:6px; font-family:arial; font-size:16px;" id="counter"&gt;(0 Selected)&lt;/span&gt; </code></pre>
php javascript jquery
[2, 3, 5]