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 |
---|---|---|---|---|---|
3,858,766 | 3,858,767 |
Strange Behavior for Delay?
|
<p>In the code below the page will fade in, and then it will fade in the list items on the left, and then its suppose to fade in each thumbnail on the right. But because of me using .delay() it ends up skipping the loading of some or all of the thumbnails. Is there something else other than .delay() I can use to halt the execution of the thumbs fading in before they should begin to?</p>
<pre><code>//Showcase
$('#showcase').animate({'opacity' : 0}, 0);
fadeInDivs(['#showcase']);
function fadeInDivs(els) {
e = els.pop();
$(e). delay(750).animate({'opacity' : 1}, 1000, function(){
if (els.length) fadeInDivs(els);
});
};
$('#showcase').queue(function(){
//fade in each filter
$('#filters li').each(function(i, item) {
setTimeout(function() { $(item).animate({'opacity' : 1}, 1000); }, 50 * i);
});
//fade in each thumbnail
$('.thumb').delay(1000).each(function(i, item) {
setTimeout(function() { $(item).animate({'opacity' : 1}, 1000); }, 500 * i);
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,485,014 | 2,485,015 |
Something with callback
|
<p>Already for 15 minutes I can not understand</p>
<pre><code>if(send == true){
$.getScript('index.php?get_names_from_ajax=true', function(data){
$('#firstnames').remove();
$('#lastnames').remove();
$('#content').prepand('<div class="block" id="firstnames">'+firstnames+'</div>');
$('#firstnames').after('<div class="block" id="lastnames">'+lastnames+'</div>');
send = false;
});
alert(send);
}
</code></pre>
<p>getScript works fine, but callback gives no results. </p>
<p><strong>EDIT</strong></p>
<p>As i said, all callback is off, nothing removes or adds, just no moving, like there is no callback. </p>
|
javascript jquery
|
[3, 5]
|
2,545,447 | 2,545,448 |
What's the purpose of jQuery.fn
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4083351/what-does-jquery-fn-mean">What does jQuery.fn mean?</a> </p>
</blockquote>
<p>Part of the jQuery source code states:</p>
<pre><code>jQuery.fn = jQuery.prototype = {
</code></pre>
<p>Given this, wouldn't </p>
<pre><code>$.fn.adamPlugin = function(options) {
return this.each(function() { });
};
</code></pre>
<p>Be identical to</p>
<pre><code>$.prototype.adamPlugin = function(options) {
return this.each(function() { });
};
</code></pre>
<p>If so, what's the point of <code>$.fn</code>? Adding things to a prototype is fairly common in JavaScript, so I can't quite understand why the jQuery folks would try to abstract this away. </p>
|
javascript jquery
|
[3, 5]
|
1,493,213 | 1,493,214 |
How to remove .aspx from url
|
<p>How can i remove .aspx from my urls as I used UrlRewritingNet and its giving me page not found error when i host the site to the server but its alright in the IDE browser. </p>
|
c# asp.net
|
[0, 9]
|
3,576,292 | 3,576,293 |
Printing into a particular printer on c#
|
<p>I have a web application in ASP.NET and c#. Is it possible to print in a particular printer attached to server for all print button click..??
Ie, If one clicks print button on client machine, the print is taken on the printer attached with the server....</p>
<p>If anybody knows this pls help me..... thanks in advance </p>
|
c# asp.net
|
[0, 9]
|
5,234,804 | 5,234,805 |
Can someone explain to me the role of the Application class in android?
|
<p>I'm studying Java and Android development by myself from PDFs. I'm trying to figure out what the <code>Application</code> class is for, and when should it be used? </p>
<p>I couldn't understand it from reading through either the PDFs or the android developers website.</p>
<p>Anyone care to explain it to me?</p>
|
java android
|
[1, 4]
|
153,525 | 153,526 |
send a variable to another function?
|
<p>Is there any way to send a variable to another function? like for this example:</p>
<pre><code>function test2(){
$('body').append(lol);
}
function test1(){
var lol = "test";
test2();
}
</code></pre>
<p>Thank you for your input :)</p>
|
javascript jquery
|
[3, 5]
|
5,375,640 | 5,375,641 |
Using jQuery, how do I get the text value of an element?
|
<p>how do I retrieve the text between the href tag?</p>
<pre><code><a href="blah">GET THIS TEXT</a>
</code></pre>
<p>It is wrapped in this DOM:</p>
<pre><code><div class="c1">
<div class="c2"><a href="#">GET THIS TEXT</a>
</div>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,314,522 | 4,314,523 |
Is it good to write javascript functions inside functions and not use 'new' on the main function?
|
<p>I now know this works:</p>
<pre><code>function outerfunction(arg1, arg2, arg3) {
var others;
//Some code
innerFunction();
function innerFunction() {
//do some stuff
//I have access to the args and vars of the outerFunction also I can limit the scope of vars in the innerFunction..!
}
//Also
$.ajax({
success : secondInnerFunction;
});
function secondInnerFunction() {
// Has all the same benefits!
}
}
outerFunction();
</code></pre>
<p>So, I am not doing a 'new' on the outerFunction, but I am using it as an object! How correct is this, semantically?</p>
|
javascript jquery
|
[3, 5]
|
5,034,734 | 5,034,735 |
Issues exporting datagridview to excel
|
<p>I'm trying to do an export of a datagrid to excel. For some reason, known working methods aren't working. The export is done from a user control. My page (default.aspx) uses a master page and the page has a user control that actually has the datagrid I'm trying to export. </p>
<p>Here's my code on the ascx:</p>
<pre><code>Response.ClearContent();
Response.AddHeader("content-disposition", "attachment; filename=MyExcelFile.xls");
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
_gvwResults.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
</code></pre>
<p>On my default.aspx (page the holds the ascx) is this code:</p>
<pre><code>public override void VerifyRenderingInServerForm(Control control)
{
/* Confirms that an HtmlForm control is rendered for the specified ASP.NET
server control at run time. - required to export file */
}
</code></pre>
<p>Here's the error I receive:
Sys.Webforms.pagerequestmanagerparsererrorexception. The message received from the server could ot be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, httpmodules or server trace is enabled.</p>
<p>Any ideas? This code should work but it's almost as if the response object is not being cleared. Ideas?</p>
|
c# asp.net
|
[0, 9]
|
443,893 | 443,894 |
Suspend Default Event in jQuery
|
<p>I am trying to delay the default event or events in a jQuery script. The context is that I want to display a message to users when they perform certain actions (click primarily) for a few seconds before the default action fires.</p>
<p>Pseudo-code:
- User clicks link/button/element
- User gets a popup message stating 'You are leaving site'
- Message remains on screen for X milliseconds
- Default action (can be other than href link too) fires</p>
<p>So far, my attempts look like this:</p>
<pre><code>$(document).ready(function() {
var orgE = $("a").click();
$("a").click(function(event) {
var orgEvent = event;
event.preventDefault();
// Do stuff
doStuff(this);
setTimeout(function() {
// Hide message
hideMessage();
$(this).trigger(orgEvent);
}, 1000);
});
});
</code></pre>
<p>Of course, this doesn't work as expected, but may show what I'm trying to do.</p>
<p><strong>I am unable to use plugins as ths is a hosted environment with no online access.</strong></p>
<p>Any ideas?</p>
|
javascript jquery
|
[3, 5]
|
2,392,523 | 2,392,524 |
Best way to display dynamic list of objects in asp.net
|
<p>I'm building an asp.net page that is designed to display links for a user that views the page.</p>
<p>The links are to reports, which have security on them, and that will be delegated as part of this site.</p>
<p>An SQL table will hold a record for each report that exists, with its corresponding security requirements.. I haven't quite figured this part of the system out yet, but that's not an issue.</p>
<p>When a user visits the page, I only want display the records that particular user has access to. Which leads me to my question.. What is the best way to hide/show links, based on a user login (fuzzy security her for the moment), which can handle a new report being added dynamically.</p>
<p>By dynamically I mean if my site has a section to create a new report link, which everyone has access to, then the front page automatically displays this new link when a user visits the page.</p>
<p>Simple user case:
UserA has full rights, so they log on and see 4 links on the page.
UserB has limited rights, so they log on and see 1 link on the page.
UserX creates a new report which everyone can see.
UserB logs back on and now can see 2 links.</p>
<p>My very first idea was labels hiding and showing, but this is dumb, but thats the general concept of what i'm after.. </p>
<p>Hopefully this makes sense, and I look forward to your help.</p>
<p>Thanks!</p>
|
c# asp.net
|
[0, 9]
|
3,398,782 | 3,398,783 |
how can i get one value to another on user click?
|
<p>i have two text box
when i press a button text of textbox one can automatically display on textbox2.
i used V S 2010
I need this code in c#</p>
|
c# asp.net
|
[0, 9]
|
5,736,054 | 5,736,055 |
jQuery - Best way to populate a hidden field with list data?
|
<p>I have two unordered lists populated with users. The idea is to drag users from one list to add them to a group in the other list. Each user also has a dropdown to select a role in the group.</p>
<p>I'd like to add to/remove from a hidden field with the values of the "added" users and their role. I'm not really sure though how to do that.</p>
<p>I have a jsfiddle showing the general idea here: <a href="http://jsfiddle.net/KPdAX/" rel="nofollow">http://jsfiddle.net/KPdAX/</a></p>
|
javascript jquery
|
[3, 5]
|
3,914,409 | 3,914,410 |
how to check the valid Youtube url using jquery
|
<p>In Jquery i want to check the specific url from youtube alone and show success status and others i want to skip by stating it as not valid url</p>
<pre><code>var _videoUrl = "youtube.com/watch?v=FhnMNwiGg5M";
if (_videoUrl.contains("youtube.com"))
{
alert('Valid');
}
else
{
alert('Not Valid');
}
</code></pre>
<p>how to check with contains. or any other option to check the valid youtube url alone.</p>
|
javascript jquery
|
[3, 5]
|
4,681,125 | 4,681,126 |
What's more important: To write programs fast or to write fast programs?
|
<p>What's more important: To write programs fast or to write fast programs? According to: <a href="http://math.stackexchange.com/questions/17478/how-quickly-with-better-tool">http://math.stackexchange.com/questions/17478/how-quickly-with-better-tool</a> it is better to write fast programs, but I wanted to ask this Q here to get the general gist of what you're thinking on this subject.
Of course I'm taking as a given that all programs have to be correct etc. etc.</p>
|
java c# c++
|
[1, 0, 6]
|
1,264,979 | 1,264,980 |
Use jQuery to fade image out
|
<p>I am using the following script to fade an image out after 5 seconds: </p>
<pre><code>var $j = jQuery.noConflict();
$j(document).ready(function() {
var fade_out = function() {
$j("#fadeout").fadeOut().empty();
}
setTimeout(fade_out, 5000);
});
</code></pre>
<p>When the image goes away it just disappears. I want the image to slowly fade out over a second or so. How can I do this? </p>
|
javascript jquery
|
[3, 5]
|
2,321,352 | 2,321,353 |
how to display moving elapsed time in jQuery?
|
<p>let's say im returning a datetime string like this in JS:</p>
<p>"8/18/2010 9:35:27 AM"</p>
<p>I would like to have a function that displays an elapsed time based on the current date-time in this format:</p>
<p>"x days x mins and x secs"</p>
<p>is there a faster way to do this in jQuery? thanks!</p>
|
javascript jquery
|
[3, 5]
|
2,736,609 | 2,736,610 |
Centering a div within another div while scrolling
|
<p>I am trying to center the navigation within the main content div and have it stuck there while scrolling. The problem that I just can't wrap my head around is that it needs to be parallaxy because of the header and the footer. I have a staging environment <a href="http://stage.golishlaw.com/portfolio/" rel="nofollow">http://stage.golishlaw.com/portfolio/</a> </p>
<p>I cannot write down everything that I have tried but some of the most recent stuff is:</p>
<pre><code>var _mainHeight = (($(window).height()/2) - ($("#portfolio_nav").height()/2)) + (($("#main").offset().top - $(window).scrollTop()))
$("#portfolio_nav").css({
top: _mainHeight
});</code></pre>
<p>This one worked well on some monitor sizes but not others.</p>
<pre><code>var mainScrollTop = (($(window).scrollTop() - $("#main").offset().top));
mainScrollTop = mainScrollTop > 0 ? 0 : mainScrollTop;
var _mainHeight = ((($(window).height() )/2 - $("#portfolio_nav").height()/2) + $("#main").offset().top) + mainScrollTop
$("#portfolio_nav").css({
top: _mainHeight
});</code></pre>
<p>This one work pretty well to but the nav got stuck at a certain spot (I know why I just can't figure how to get it stuck in the center of the screen)</p>
<p>I've just really been pulling my hair out on this one and I've tried everything that I could think of.</p>
|
javascript jquery
|
[3, 5]
|
4,531,158 | 4,531,159 |
C++ and Java Byte Array
|
<p>Sorry for the newbie questions. I do not have any experience in c++. I have a method in C++ that generates hash value given an input. The output is stored as <code>char outCode[outlen]</code>. I have a java method that generates hash values given an input and the output is stored as <code>byte[] output</code>. I am sending the c++ value as a stream to java. How can I compare to check they have the same hash? Thanks,</p>
|
java c++
|
[1, 6]
|
902,575 | 902,576 |
PHP Problem : filesize() return 0 with file containing few data?
|
<p>I use PHP to call a Java command then forward its result into a file called result.txt. For ex, the file contains this:
"Result is : 5.0"
but the function filesize() returns 0 and when I check by 'ls -l' command it's also 0. Because I decide to print the result to the screen when file size != 0 so nothing is printed. How can I get the size in bit ? or another solution available?</p>
|
java php
|
[1, 2]
|
3,636,198 | 3,636,199 |
IndexOutOfBounds with array
|
<p>Each time I try to run this method</p>
<pre><code>private void resetOdds() {
mOdds[1] = 0.10;
mOdds[2] = 0.25;
mOdds[3] = 0.35;
mOdds[4] = 0.30;
}
</code></pre>
<p>I get an IndexOutOfBounds error. I don't know why, as I supply enough items in the array to change:</p>
<pre><code>private final double[] mOdds = { 0.10, 0.25, 0.30, 0.35 };
</code></pre>
<p>Does anyone know why I'm getting this error?</p>
|
java android
|
[1, 4]
|
3,378,605 | 3,378,606 |
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->auction->getBids() as $bid) {
if ($aux == null) {
$aux = $bid->getValue();
} else {
if ($bid->getValue() > $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 < 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]
|
2,528,447 | 2,528,448 |
Sort ListBox items using Javascript/Jquery
|
<p>I have a Listbox with some items on a page. Is there any simple way to sort the items using Jquery or native javascript?</p>
<p>Best Regards,</p>
|
javascript jquery
|
[3, 5]
|
2,027,392 | 2,027,393 |
jQuery $( function() {} ) and $(document).ready the same?
|
<p>To have a working datepicker on a field, I have to put this script inside my element</p>
<pre><code>$( function() {
$( "#date_datepicker" ).datepicker( { dateFormat: "yy-mm-dd" } );
});
</code></pre>
<p>Removing the <code>$( function() {</code> makes the datepicker not work.</p>
<p>So does it mean that the <code>$( function() {</code> is the same as <code>$(document).ready</code>?</p>
<p>I'm trying to optimize my javascript codes so knowing this might help.</p>
|
javascript jquery
|
[3, 5]
|
5,612,639 | 5,612,640 |
Observe Form Submit
|
<p>I use this to invoke a function when a form on the page is submitted:</p>
<pre><code>$$("form").invoke("observe", "submit", submitForm);
</code></pre>
<p>I'm having a problem getting this to work in IE when a text field has focus and the enter key is pressed. Firefox submits the form in this case but not IE.</p>
<p>The form has one submit button:</p>
<pre><code><input type="submit" value="Submit"/>
</code></pre>
<p>Clicking the submit button works fine in both browsers using this method.</p>
|
javascript jquery
|
[3, 5]
|
870,509 | 870,510 |
What causes this error? The TargetControlID of <CheckBoxControlName> is not valid. The value cannot be null or empty
|
<p>I have searched on the net for this error, but there doesn't appear to be alot on it.</p>
<pre><code>The TargetControlID of 'CheckBoxControlName' is not valid. The value cannot be null or empty.
</code></pre>
<p>Does anyone know of the main causes for this error?</p>
|
c# asp.net
|
[0, 9]
|
1,693,358 | 1,693,359 |
how can i execute my own code after default event happened?
|
<p>is there a function which we can execute some code after default event happened?
for example, i want to get the scrollTop value after default mouse wheel happened.
can jquery or javascript do this for me?</p>
|
javascript jquery
|
[3, 5]
|
4,017,632 | 4,017,633 |
jquery load page with switch case
|
<p>it's me again!!</p>
<p>Now.. i don't know what i'm doing wrong with this Switch Case... can help me?</p>
<p>When i click in some LINK, the alert dont apear...</p>
<p>this is my HTML:</p>
<pre><code> <div class="menu-site">
<ul class="topo-menu" id="topo-menu">
<li id="aabruzzo">a abruzzo</li>
<li id="catalogo">catálogo</li>
<li id="conceito">conceito inverno</li>
<li id="representantes">representantes</li>
<li id="clipping">clipping</li>
<li id="loja">loja</li>
<li id="contato" class="sem-right">contato</li>
</ul>
</div>
</code></pre>
<p>this is my javascript:</p>
<pre><code>jQuery(document).ready(function(){
var sections = $("#topo-menu li");
var loading = $("#loading");
var content = $("#content");
sections.click(function(){
switch(this.id){
case 'aabruzzo':
alert("teste");
break;
case "catalogo":
alert("teste");
break;
case "conceito":
alert("teste");
break;
case "representantes":
alert("teste"););
break;
case "clipping":
alert("teste");
break;
case "loja":
alert("teste");
break;
case "contato":
alert("teste");
break;
default:
hideLoading();
break;
}
});
</code></pre>
<p>i have this <a href="http://jsfiddle.net/D2Cqt/" rel="nofollow">fiddle</a></p>
|
javascript jquery
|
[3, 5]
|
4,434,829 | 4,434,830 |
Dynamic Loading of external javascript file
|
<p>How do I accomplish this? Every time I try to load an external javascript file from google maps, it crashes the webpage and it becomes blank.</p>
<p>I used the $JQuery.get(); function.</p>
<p>I am using JQuery to load the file into the head.</p>
|
javascript jquery
|
[3, 5]
|
1,978,519 | 1,978,520 |
jquery- info/docs about list of attributes applicable to different types of input elements in a form
|
<p>I am working with input elements in a form using jquery...I am trying to obtain the name of a form parameter in a web page, as well as its value (or multiple values in case its something like a drop down box)</p>
<p>I want to do some operations on these form elements... Is there some place you can point me to where a list of attributes available for (and applicable to) different types of form elements is provided? For eg, I need to work with drop down box, list box, radio button, check box, text box and text area. Specifically I require the name of each input element, its value(or set of values) and in case of list box, whether multiple selections can be made within that list box or not.</p>
<p>Update- The jquery 'val' expression retrieves the currently selected value in a radio button/list box etc... I want to obtain all the possible values for input elements that have multiple values as options...</p>
|
javascript jquery
|
[3, 5]
|
4,368,905 | 4,368,906 |
Calculate Total Value In Gridvew In ASP.net C#
|
<p>I am using a website which contains a gridview for view details of Product details... It contains columns like name,area,phnoe no,quantity,price,total.... now i want to calculate toatal value for that i hav to multiply the columns quantity and Price and also put that answer to total column in grid... How Shall i do this?</p>
<p>Any one tell me the solution of this!</p>
<p>Thanks in advance...</p>
|
c# asp.net
|
[0, 9]
|
3,483,021 | 3,483,022 |
How to bind the enter/return key to user-defined function
|
<p>I'm developing an application that runs on one page, and does not reload. I have a form with only an input type text, no submit button. I included the onchange event, after filling the textbox with data, I want to execute the function bound to the onchange event when I press enter, but the form is rather submitted and [it attempts to load a new page]. Please what do I do? Thanks</p>
|
javascript jquery
|
[3, 5]
|
1,307,286 | 1,307,287 |
Can we use dhtmlxscheduler in asp.net?
|
<p>I want to use dhtmlxscheduler in asp.net.</p>
<p>But i do not know how to bind event data with it.</p>
<p>Even i do not know it works in asp.net or not.</p>
<p>Can any one help me for this?</p>
<p>Please help me guys.</p>
<p>Thanks,</p>
<p>Rajbir</p>
|
jquery asp.net
|
[5, 9]
|
5,818,115 | 5,818,116 |
Consultation about date format in java for android
|
<p>i have this date: <code>Date d = new Date(2012, 8, 1)</code>;</p>
<p>but in the screen i see: <code>61304700000000</code></p>
<p>how to fix it that i can see: <code>01/08/2012</code></p>
<p>thanks</p>
|
java android
|
[1, 4]
|
3,137,243 | 3,137,244 |
asp:CheckBoxField in GridView - VS 2008
|
<p>I have a gridview control bound to an object data source. in addition to the columns that i want to display i want to display this</p>
<pre><code> <Columns>
<asp:CheckBoxField DataField="Locked" Visible="true" AccessibleHeaderText="On Hold" ReadOnly="false"/>
</Columns>
</code></pre>
<p>Couple of questions here:
1. If I do the above said, my page loads and certain rows have their records marked as checked and certain rows do not, as per data. However, the user is unable to click on any records to undo their check marks. It appears that this is in a disabled state.</p>
<ol>
<li><p>It seems there is no onclick event with this checkboxfield. I want to update my records instantly when the user checks or unchecks each record. yes bad design here but my hands are tied</p></li>
<li><p>If i were to go with <code><asp:checkbox></code> within an <code><itemtemplate></code> how do i bind that to my locked column within the object datasource or do i have to do that by overiding onne of the methods of the gridview control?</p></li>
</ol>
|
c# asp.net
|
[0, 9]
|
821,414 | 821,415 |
How Can i Access values from .aspx page to .aspx.cs page?
|
<p>I have code something like this.</p>
<pre><code>ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Submit", "Confirm()", true);
</code></pre>
<p>Confirm is the JavaScript function in .aspx page. I want to catch the "true" or "False" value returned based on the Click performed on the Confirm window to my code behind(aspx.cs) page.</p>
<p>Do we have a solution for this?</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
1,487,393 | 1,487,394 |
How do I clear the selection in an Android Submenu?
|
<p>I have a menu in my Android application and this menu has a <code>SubMenu</code>. The items are exclusively selectable.</p>
<p>How can I remove a selection made by the user (such that the submenu looks like it was at the beginning, with no item selected?</p>
<p>I was looking for a method that would do this, in a similar way as the <code>SubMenu</code>'s <code>setGroupEnabled</code> method, so I tried it by looping over the items of the submenu and call <code>setChecked(false)</code> on them. However, as it seems, deselecting an item in an exclusive list does not remove the selection, but shifts it to the next item. So after the loop, there was still any item selected.</p>
<p>What is the correct way of removing the selection (so that the user can select a new item)?
I appreciate your help.</p>
|
java android
|
[1, 4]
|
2,504,778 | 2,504,779 |
Using C++ DLL (pointer method) in C#
|
<p>I have a C++ DLL file, I need to use it's function from C#. C++ file have a method called "Status" in ServiceState. C++ code for that block is given below.</p>
<pre><code>STDMETHODIMP ServiceState::Status(/*[out]*/VARIANT *Primary,VARIANT *Secondary )
{
if(primary())
Primary->boolVal = TRUE;
else
Secondary->boolVal = FALSE;
return true;
}
</code></pre>
<p>I compiled the C++ project and got the <strong>Status.dll</strong> output.
I initialized in C# code as follow.</p>
<pre><code> [DllImport(@"c:\Status.dll")]
public static extern void ServiceState.Status(IntPtr Primary,IntPtr Secondary);
</code></pre>
<p>1) Whether the Initialization is correct?</p>
<p>2) As the method have pointers in C++, what C# data type have to be passed to that method & how? Please guide me. </p>
<p>Thanks</p>
|
c# c++
|
[0, 6]
|
2,568,009 | 2,568,010 |
How to make so that the function run only one time?
|
<p>Script number one performed for each of a given set of elements DOM, append to the first element of the DOM script number two. </p>
<p><strong>Script number one:</strong></p>
<pre><code>function ptmedia(){
$('.ptmcss').eq(0).html('<div class="ptmcss"></div>')
.append('<div class="append"><script type="text/javascript" src="script2.js"></script></div>');
$('.spbin').each(function(){
if($(this).children().attr('class').indexOf('ptmd')!==-1){
$(this).addClass('ptmedia');ptmedia();}
</code></pre>
<p>Script number two does cross domain query, the fulfillment of which performs the specified function <strong>(z)</strong>.
<strong>Script number two</strong>:</p>
<pre><code>$.getJSON('http://example.com?callback=?',function(z){alert(z.query+'Some text');}
</code></pre>
<p>Due to the fact that the script is the number one multiple times, the function <strong>(z)</strong> holds an equal number of times. How to make so that the function <strong>(z)</strong> run only one time?
Thank's for any help!</p>
|
javascript jquery
|
[3, 5]
|
3,737,212 | 3,737,213 |
Updating an image that is re-uploaded periodically
|
<p>I have a webcam script that sends a JPG via FTP to my webserver every 10 seconds (overwriting the original).</p>
<p>How can I get jQuery to refresh that image? I tried:</p>
<pre><code>window.onload = function() {
$('body').prepend('<img id="cam" src="ww.jpg" alt="" />');
setInterval(runAgain, 12500);
};
function runAgain() {
$.ajax({
url:'ww.jpg',
cache:false,
beforeSend:function() {
$('#cam').remove();
},
success:function() {
$('body').prepend('<img id="cam" src="ww.jpg" alt="" />');
}
});
}
</code></pre>
<p>Note: I don't want to refresh the page if I can help it.</p>
|
javascript jquery
|
[3, 5]
|
4,802,036 | 4,802,037 |
failed to get repeater checkboxlist text
|
<p>i am trying to get all the check value from user,but i failed to do so</p>
<p>refer the the //problem below, while checkboxlist item is selected, it should return to me what user has selected, but it cant detect what user has checked</p>
<p><strong>bind repeater item</strong></p>
<pre><code>if (Session["test"] != null)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmdLoadQuestion = new SqlCommand("getTestQuestion",conn);
conn.Open();
cmdLoadQuestion.Parameters.Add("@subject",SqlDbType.VarChar).Value=Session["test"].ToString();
cmdLoadQuestion.CommandType = CommandType.StoredProcedure;
SqlDataReader dtrLoadQuestion;
dtrLoadQuestion = cmdLoadQuestion.ExecuteReader();
Repeater1.DataSource = dtrLoadQuestion;
Repeater1.DataBind();
dtrLoadQuestion.Close();
conn.Close();
}
else
{
Response.Redirect("~/HomePage.aspx");
}
//check answer from db
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
conn.Open();
foreach (RepeaterItem items in Repeater1.Items)
{
SqlCommand cmdCheckAnswer = new SqlCommand("Select Answer From ExerciseTable where Question='" + ((Label)items.FindControl("Label3")).Text + "'", conn);
SqlDataReader dtrCheckAnswer;
dtrCheckAnswer = cmdCheckAnswer.ExecuteReader();
if (dtrCheckAnswer.Read())
{
CheckBoxList chkList = (CheckBoxList)items.FindControl("chkOption");
foreach (ListItem a in chkList.Items)
{
//Problem
if (a.Selected == true)
{
marks.InnerHtml += dtrCheckAnswer["Answer"].ToString() + " user Answer:" + a.Text + "<br/>";
}
else
{
marks.InnerHtml += "u check nth at all";
}
}
}
else
{
marks.InnerHtml = "error";
}
dtrCheckAnswer.Close();
}
conn.Close();
//end check answer
</code></pre>
|
c# asp.net
|
[0, 9]
|
1,043,553 | 1,043,554 |
How to handle problem with Network Connectivity in Java
|
<p>I have a simple java code which gets html text from the input url:</p>
<pre><code>try {
URL url = new URL("www.abc.com");
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(url.openStream()));
while ((line = rd.readLine()) != null) {
String code = code + line;
} catch (IOException e){}
</code></pre>
<p>I am using this code in an android project. Now the problem comes when there is no internet connectivity. The application just halts and later gives error.</p>
<p>Is there some way to break this after some fixed timeout, or even return some specific string after an exception is thrown. Can you please tell me how to do that??</p>
|
java android
|
[1, 4]
|
2,981,645 | 2,981,646 |
Why does this work in jsfiddle but not in my document
|
<p>I found a wonderful jsfiddle that someone has made and wanted to use part of it in my project:</p>
<p><a href="http://jsfiddle.net/manuel/29gtu/" rel="nofollow">http://jsfiddle.net/manuel/29gtu/</a></p>
<p>It works on the jsfiddle but not in my HTML document. Here is what in my document:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<script src="scripts/jquery-1.7.2.js"></script>
<script>
$("button").click(function() {
var id = $("#id").val();
var text = "icon-"+id;
// update the result array
var result = JSON.parse(localStorage.getItem("result"));
if(result == null)
result = [];
result.push({id: id, icon: text});
// save the new result array
localStorage.setItem("result", JSON.stringify(result));
// append the new li
$("#bxs").append($("<li></li>").attr("id", "item-"+id).html(text));
});
// on init fill the ul
var result = JSON.parse(localStorage.getItem("result"));
if(result != null) {
for(var i=0;i<result.length;i++) {
var item = result[i];
$("#bxs").append($("<li></li>").attr("id", "item-"+item.id).html(item.icon));
}
}
</script>
</head>
<body>
<ul id="bxs" class="tabs">
</ul>
<input type="text" id="id" /><button>save</button>
</body>
</html>
</code></pre>
<p>The code is copied and pasted from the fiddle. I think it has to do with me not having a plugin for local storage.
For that jsfiddle to work, do I need some external plugin that I am missing?</p>
|
javascript jquery
|
[3, 5]
|
2,381,645 | 2,381,646 |
error opening main.xml file
|
<p>I am staring to learn android, I have done everything as mentioned in the guide, and I tried the hello android example.</p>
<p>but I just can´t open the main.xml file to edit, it give me this error: Could not initialize class java.awt.Font. I am on linus kde. </p>
<p>I don´t what I should do, and please avoid any solutions that use 'sudo' as I am not authorized to do that as I am using the university PC. </p>
<p>thanks hope you help me </p>
|
java android
|
[1, 4]
|
821,257 | 821,258 |
How to create this 4type or 3type tab list?
|
<p>how can I create the 4type or 3type tab list that are in this page - <a href="http://demos.brianmcculloh.com/swagger/" rel="nofollow">http://demos.brianmcculloh.com/swagger/</a> located in right side? I have seen that on many sites. Basically is there any free plugins, that would allow me to create something like this easily, or Will I need to make it by myself with show/hide functions, and how hard is it to make something like that? If there's already free plugin, then I need plugin, which is free for commercial use (allowed to be sold in marketplaces with ready blog/portfolio templates).</p>
|
javascript jquery
|
[3, 5]
|
4,087,443 | 4,087,444 |
Hide a div using C# code
|
<p>I need to hide a div in page load based on some session value.
Can any one help me out please.</p>
<p>Thanks in advance</p>
|
c# asp.net
|
[0, 9]
|
4,181,605 | 4,181,606 |
Read server-side JavaScript from PHP
|
<p>I have a JS library file of variables (caption strings) used by <em>server-side</em> JavaScript. Can I read/interpret that from PHP?</p>
<p>The path to the data isn't the issue, but whether PHP can read/use the JS variables. Currently I've the same variable stored in both a JS file and PHP include with obvious scope for changes getting out of synch. I've tried reading the PHP from the <em>server-side</em> JS without joy but was wondering if - with suitable parsing - if PHP could extract/use the JS variables.</p>
<p>I repeat <em>all</em> data involved is <em>server-side</em> on the same server. Sorry if I've missed this being answered before but PHP/JS questions are (even if mis-titled) seemingly all about passing data between client and server side processes - which isn't my scenario.</p>
<p>Later - clarification:</p>
<p>The s/s JavaScript is part of a web interface to an image database where I can't alter the API. It doesn't support creating emails (for file requests) thus I am having to do that via PHP. Work scope/budget precludes re-writing a new d/b interface, rather we 'just' ned to be able to send an email. IOW, I realise you wouldn't choose to be trying to do this if starting from scratch! Also, I don't think I can do s/side AJAX to fetch variables or do PHP smtp mail as the JS environment seemingly isn't designed for that degree of s/s processing pre HTML page delivery.</p>
|
php javascript
|
[2, 3]
|
2,308,537 | 2,308,538 |
How to show an absolutely positioned sibling div on hover using jQuery?
|
<p>I have a grid of images with accompanying info in a sibling div that needs to show when the image is hovered over, then disappear when the cursor is off the image. I've looked at several similar questions here but none really have worked for what I need exactly.</p>
<p>It's for a site I've inherited that uses a different JS library that I'm switching to jQuery but I'm having a tough time figuring this out as I'm still learning jQuery.</p>
<p>I've set up the HTML & CSS here: <a href="http://jsfiddle.net/EQ2fG/" rel="nofollow">http://jsfiddle.net/EQ2fG/</a></p>
<p>There's a screenshot of what I need here: <a href="http://cl.ly/JZkK" rel="nofollow">http://cl.ly/JZkK</a></p>
<p>So on hover, the sibling div (.property_info) needs to display to the right of the image div (.property), but the ones for the last two in each row need to display to the left so it stays within the container/wrapper div. Keep in mind that the data will be dynamically generated.</p>
<p>I hope that makes sense. Any help would be really, really helpful.</p>
<p>Thank you!</p>
|
javascript jquery
|
[3, 5]
|
3,343,557 | 3,343,558 |
What data type does memory see when I use void?
|
<p>When I create a method of type int the compiler reserves X number of bits in memory. So how does the see a void type? How many bits/bytes does a void type take up? </p>
|
c# c++
|
[0, 6]
|
2,789,976 | 2,789,977 |
Trouble inserting javascript to current webpage using C#
|
<p>I am encountering a problem with not being able to inject javascript through a webbrowser contol without writing to a new html. Is there a way to inject a string of javascript to the currently browsed webpage? </p>
<pre><code>javascript:(function(){var s=document.createElement('script');s.setAttribute('src','file:///C:/abc.js');document.getElementsByTagName('head')[0].appendChild(s);})()
</code></pre>
<p>The current method I am using involves stringbuilder and webbrowser w/ windows.forms.document</p>
<pre><code>string js = @"<script type='text/javascript'>function test(){alert(test)}</script>";
WebBrowser wb = new WebBrowser();
wb.Url = new Uri("http://www.google.com");
wb.Document.Write(js);
wb.Document.InvokeScript("test");
</code></pre>
<p>What am I doing wrong? Is there a better working way of approaching this?</p>
|
c# javascript
|
[0, 3]
|
31,619 | 31,620 |
Set default value for jQuery slider and override when needed
|
<p><strong>Background:</strong> I currently have a <strong>working</strong> jQuery slider on my website inside my .js file</p>
<pre><code>$( "#slider-range-min" ).slider({
range: "min",
value: 100,
min: 1,
max: 100,
});
</code></pre>
<p>I need to be able to override the "Value" from 100 to some other value sometimes. So I tried this:</p>
<pre><code>$( "#slider-range-min" ).slider({
range: "min",
value: _Slider_Value,
min: 1,
max: 100,
});
</code></pre>
<p>and defined this on my html page</p>
<pre><code><script type="text/javascript">
var _Slider_Value = 50;
</script>
</code></pre>
<p>which also works! <strong>Except</strong> then on all the other pages I get a javascript error stating "_Slider_Value is not defined". I'd rather not have to copy & paste the value onto all my pages if I can avoid it... doesnt seem like a "good" way to do it?</p>
<p><strong>Question:</strong> is there a better way to do this - so I can have a default value for my slider, but occasionally override it when required?</p>
<p><strong>Edit:</strong> Another way of saying it: how do I make my slider default to "100" unless I tell it otherwise in my html page?</p>
|
javascript jquery
|
[3, 5]
|
4,144,970 | 4,144,971 |
jQuery-style function that can be accessed like an object
|
<p>I am creating an AJAX API for a web service and I want to be able to call jQuery-like accessors.
jQuery seems to be able to execute 'jQuery' as a function, but also use it to directly access the object that is the result of the function EG:</p>
<pre><code>jQuery();
jQuery.each({});
</code></pre>
<p>This is the trick that I can't seem to pull off:</p>
<pre><code>myAPI('foo'); //output: 'foo'
myAPI('foo').changeBar(); //output: 'foo' 1
myAPI.changeBar(); //Error: not a function
</code></pre>
<p>I have seen the answers to similar questions, which are helpful, but don't really answer my question.</p>
<p><a href="http://stackoverflow.com/questions/8734115/how-can-jquery-behave-like-an-object-and-a-function">#8734115</a> - Really interesting, but you can't access the methods that were set by f.prototype.</p>
<p><a href="http://stackoverflow.com/questions/2953314/javascript-function-like-objects-i-e-can-be-used-as-a-function-e-g-as">#2953314</a> - Uses Multiple operations to create object instead of a single function.</p>
<p>here is my code:</p>
<pre><code>(function(window) {
var h = function(foo) {
// The h object is actually just the init constructor 'enhanced'
return new h.fn.init(foo);
};
/**
* Methods defined at protoype.
*/
h.fn = h.prototype = {
constructor: h,
init: function(foo) {
console.log(foo);
return this;
},
splice : function () {},
length : 0,
bar : 0,
changeBar : function() {
this.bar++;
return this.bar;
}
};
h.fn.init.prototype = h.fn;
//Publish
window.myAPI =h;
}( window));
</code></pre>
<p>I'm sure I'm missing something simple :(</p>
|
javascript jquery
|
[3, 5]
|
3,522,608 | 3,522,609 |
Search gridview based on the value typing in textbox?
|
<p>I am using ASP.NET and C#.This is my code.</p>
<pre><code><asp:UpdatePanel ID="gridSearch" runat="server">
<ContentTemplate>
<asp:GridView ID="jobcardSearch" runat="server">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:LinkButton ID="LinkButton1" Text="First Name"
CommandName="sort" CommandArgument="FirstName"
runat="server"></asp:LinkButton>
<asp:TextBox ID="search" runat="server" Width="70px"></asp:TextBox>
</HeaderTemplate>
<ItemTemplate>
<%# Eval("FirstName")%>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</code></pre>
<p>So while typing on the textbox, I need to filter the grid then I need to perform this without postback.</p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
2,274,055 | 2,274,056 |
jquery to javascript - $.ajaxSetup()
|
<p>Since I am using ExtJs framework in my project I can't use jquery in my project. now I've a piece of code in jquery (given below), can someone help me to convert jquery into javascript? thanks</p>
<pre><code>setup: function (networkErrorCallback) {
this._networkErrorCallback = networkErrorCallback;
var self = this;
//$.support.cors = true;
$.ajaxSetup({
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "jsonp",
jsonp: "method",
timeout: 30000,
error: function (XMLHttpRequest, textStatus, errorThrown) { self._networkErrorCallback(); },
cache: false
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
721,464 | 721,465 |
Asp.Net "Instant" PM System
|
<p>I need to send "instant" messages (like forum PMs) between users with my asp.net application. As many others I use a webhotel to host my site. I have searched around for awhile and I can't find any solutions that would be a good fit with my system. I was thinking about writing a javascript that would call for each 30 seconds or so a .ashx handler to check the users message status (return true or false) if the correct credentials are supplied. However I dont know if this is a good solution, because of all the calls to the handler it might get picked up as spam or it might generate really bad performance? The thing is, I want to avoid the need to refresh the page just to see your latest messages.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
6,012,952 | 6,012,953 |
Good way to make a launcher screen for sub-apps within your app?
|
<p>I'm making an app for a company, and they want a main screen when you first enter the app with a couple sub-apps (right now they're separate activities) that you can go into (glossary, faq, calculator, etc).</p>
<p>Any ideas what the best way to do this is? I'm new to all this.</p>
<p>Thanks</p>
|
java android
|
[1, 4]
|
3,583,116 | 3,583,117 |
Assign javascript value to php variable
|
<p>I'm trying to check screen width and assign it to a php variable to do some if else statements. This is what I got. </p>
<pre><code><script>
var mobileFormWidthCheck = $(window).width();
var mobileFormReady;
if(mobileFormWidthCheck < 767){
mobileFormReady = 22;
}
else{
mobileFormReady = 55;
}
</script>
<?php
$widthChecked = "<script>document.write(mobileFormReady);</script>";
echo $widthChecked;
?>
</code></pre>
<p>This works perfectly. But when I try to echo something based on the <code>mobileFormReady</code> value, it doesnt echo. </p>
<p>This is what im trying to get to work.</p>
<pre><code>$widthChecked = "<script>document.write(mobileFormReady);</script>";
if($widthChecked == "22"){
echo 'this page is under 767 pixels';
}
else if($widthChecked == "55"){
echo 'this page is OVER 767 pixels';
}
else{
echo 'NOT WORKING YET';
}
</code></pre>
<p>I think its a string integer issue. But I cant seem to figure it out. Can you guys please help me? Thanks a lot.</p>
|
php javascript jquery
|
[2, 3, 5]
|
2,643,201 | 2,643,202 |
How to get AudioSessionId from Sip call on Android?
|
<p>I used sample Android code(SipDemo) to implement simple SIP client, but noticed strong echo while calling.</p>
<p>I found new(API 16) Android class AcousticEchoCanceler that can reduce echo effect but i don't know where can i get AudioSessionId.</p>
<pre><code> AcousticEchoCanceler aec = AcousticEchoCanceler.create(int audioSession);
</code></pre>
<p>Can anyone help me with this?
How to get AudioSessionId from Sip call?</p>
<p>Thanks</p>
|
java android
|
[1, 4]
|
3,271,251 | 3,271,252 |
How to replace date on a jQuery countdown script with a PHP variable?
|
<p>How can this script is modified to accept a php variable instead in the place of writing <code>date:"august 12, 2011 23:59"</code> ?</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$("#time").countdown({
date: "august 12, 2011 23:59",
onComplete: function( event ){
$(this).html("Completed");
},
leadingZero: true
});
});
</script>
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
358,023 | 358,024 |
only check one radio button using jquery in asp.net
|
<p>I have the following grid view.</p>
<pre><code><asp:GridView ID="GridView1" runat="server" AllowPaging="True" BackColor="White"
BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataSourceID="UserModule_allusers"
ForeColor="Black" GridLines="Horizontal" OnRowDataBound="grvGroups_RowDataBound"
Width="324px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:RadioButton ID="selectRow" GroupName="userSelect" runat="server" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</code></pre>
<p>Here I am using one radio button to select the row. To select the row I am using the following jquery script.</p>
<pre><code> $('#<%=GridView1.ClientID%>').find('input:radio[id*="selectRow"]').click(function () {
$('<%=GridView1.ClientID%>').find('input:radio[id*="selectRow"]').attr('checked',false);
$(this).attr('checked', true);
var isChecked = $(this).prop("checked");
var $selectedRow = $(this).parent("td").parent("tr");
var selectedIndex = $selectedRow[0].rowIndex;
if (isChecked)
$selectedRow.css({
"background-color": "DarkSlateBlue",
"color": "GhostWhite"
});
});
</code></pre>
<p>In this script i am trying to un-checking first for all the radio buttons in the grid and checking the present context radio button. All the radio buttons are unchecking but present radio button is not checked. Where i done the mistake.</p>
|
jquery asp.net
|
[5, 9]
|
2,644,647 | 2,644,648 |
Updating parent page from dynamically loaded user control
|
<p>Hosting page:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
LoadMyControl(Parameters); //Do it every page load to preserve it's state
}
protected void LoadMyControl(string parameters)
{
plchld.Controls.Clear();
Control userControl = LoadControl("TheUserControl.ascx");
userControl.ID = "userControl1";
plchld.Controls.Add(userControl);
}
</code></pre>
<p>Now inside this control, when a button is clicked I want to update ,let's say a Label on the hosting page.
What is the best way to do it? Custom event? </p>
|
c# asp.net
|
[0, 9]
|
2,951,535 | 2,951,536 |
Android memory management question
|
<p>I have bunch of queries regarding android memory management . I know each app is provided with jvm , but how about memory size , do they increase and decrease with respect to other apps on phone?</p>
<p>The main part how do jni memory allocation in each jvm taken care ? </p>
<p>When accessing one of the android default native methods , where does memory allocation take place?</p>
<p>Can low memory cause segmentation faults , when native methods are executed ?</p>
<p>Considering the scenario i am trying to test , where there is low memory for my app and native calls can cause issue.What are effective ways to test low memory scenarios on android </p>
<p>Thank you</p>
|
java android
|
[1, 4]
|
5,412,542 | 5,412,543 |
Live update textblock
|
<p>I am trying to figure out the best way to have a text field live update between two different users. I have done some googling and what I could find was the setInterval.</p>
<p>That works but is really straight forward and seems like the "wrong" way. I don't know why it seems like that but I feel like there would be a more efficient way than having a setInterval update every 100ms or so. </p>
<p>Is there a better way than using setInterval? What is the best to update between two users?
Thanks for the help or pointing me in the right direction.</p>
<p>Edit --</p>
<p>Here is how I invision it
<img src="http://img.zobgib.com/2011-03-23_2231.png" alt="Path of data"></p>
<p>The information can also travel from comp 2 -> 1 of course so it is collaborative.</p>
|
php javascript jquery
|
[2, 3, 5]
|
4,755,807 | 4,755,808 |
link click event not firing button click event on the first try (IE only). Works on second click.
|
<p>This is driving me mad. I've got a div on my page that opens up in colorbox. When the user clicks one of the links in the div, it fires an event to the code (below) which should in turn populate the hidden field and then click a server button to run some code behind.</p>
<p>Problem is, in IE(9) it won't click the server button on the first attempt (yes, it does go onto the client click event). Strangely it seems to work fine in Chrome and FF.</p>
<pre><code>$(document).on('click', '.link', function (e) {
e.preventDefault();
var thisID = $(this).attr('href').replace('#ca', '');
$("#hiddenField").val(thisID );
$("#button1").submit();
});
</code></pre>
<p>It might be worth mentioning that the links in the div that opens in colorbox is dynamically populated. But this should effect it as the click events on the links are working fine.</p>
<p>Any help would be appreciated.</p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
2,770,133 | 2,770,134 |
Javascript - Set date 30 days from now
|
<p>I need to set a date that would be 30 days from now taking into account months that are 28,29,30,31 days so it doesn't skip any days and shows exactly 30 days from now. How can I do that?</p>
|
javascript jquery
|
[3, 5]
|
141,861 | 141,862 |
Jquery if div doesn't exist
|
<p>I'm using 1 js for 2 different pages. 1 page doesn't have a div which the other does. So when I submit the values, I get a <code>$(</code> js error</p>
<p>for</p>
<pre><code>$('.description'+save_id+'').html(description_val).show(); //update category description
</code></pre>
<p>I suspect that I get the error because there is nothing to show(). Is there a short code I can use to detect if the div.description exists otherwise don't do the function?</p>
|
javascript jquery
|
[3, 5]
|
3,845,396 | 3,845,397 |
how to use datePicker() plugin in jquery
|
<p>In reference to the site "</p>
<ul>
<li><a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerClickInput.html" rel="nofollow">http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerClickInput.html</a></li>
</ul>
<p>", i used the datePicker() plugin of jquery. But its not working for me!!
I've updated my codings in</p>
<ul>
<li><a href="http://jsfiddle.net/9L7kE/7/" rel="nofollow">http://jsfiddle.net/9L7kE/7/</a></li>
</ul>
<p>. Kindly help!!!. Thanks in advance</p>
|
javascript jquery
|
[3, 5]
|
819,976 | 819,977 |
Why cant java be used over C++ for all programming purposes
|
<p>It is said that Java overcomes all disadvantages of C++</p>
<blockquote>
<p><strong>Disadvantages of C++:</strong></p>
<ul>
<li>Does not provide very strong type-checking. c++ code is easily
prone to errors related to data types,
their conversions, for example, while
passing arguments to functions.</li>
<li>Does not provide efficient means for garbage collection, as already
mentioned.</li>
<li>No built in support for threads.</li>
<li>Gets complex when u want to develop a graphics rich application in c++</li>
<li>portability of code on various platforms, etc</li>
</ul>
</blockquote>
<p>Then why is there a need for C++ language ?? Why cant we just use Java for all programming purposes??</p>
|
java c++
|
[1, 6]
|
1,378,168 | 1,378,169 |
C++ code meaning and conversion in Java
|
<p>I have in C++</p>
<pre><code>char *s, mask;
// Some code
If(*s == 0){ //Some more code}
If(*s & mask){ //Some code}
</code></pre>
<p>In Java can I write this like</p>
<pre><code>byte s,mask;
//Some code
If(s == (byte)0x0){ //Some more code}
If((s & mask) != (byte)0x0){ //Some Code}
</code></pre>
<p>Is the java code correct? </p>
|
java c++
|
[1, 6]
|
5,924,411 | 5,924,412 |
jquery not working when i'm not putting it inside a jQuery(document).ready
|
<pre><code>jQuery(document).ready(function(){
jQuery(".test").click(function() {
alert(1);
});
});
</code></pre>
<p>When I try not to put :</p>
<pre><code>jQuery(".test").click(function() {
alert(1);
});
</code></pre>
<p>inside a <code>jQuery(document).ready()</code> it won't work.</p>
<p>What do you think is the cause of that one? I already loaded the custom script that has that function.</p>
<pre><code><script type="text/javascript" src="/scripts/js/jquery.js"></script>
<script type="text/javascript" src="/scripts/js/customScript.js"></script>
</code></pre>
<p>Any answer would be appreciated and rewarded.</p>
<p>Thanks!</p>
|
php javascript jquery
|
[2, 3, 5]
|
5,952,643 | 5,952,644 |
ASP.NET implementing a search box like stackoverflow search box
|
<p>I use VS2010,C# to develop an ASP.NET web app, I'm going to implement a search box like the one used in Stackoverflow (or other sites), initially there is a phrase (for instance "search") in the search text box, when user click in text box, its text is emptied and user can type his phrase, but if he leaves the text box (lost focus) empty, again the phrase "search" is displayed, how can I implement this nice effect?</p>
<p>thanks</p>
|
javascript asp.net
|
[3, 9]
|
1,292,073 | 1,292,074 |
jquery: not selector problem?
|
<p>The following snippet applies a #breadcrumb hash to each link once it's clicked. That works fine.</p>
<pre><code>$('#main a').live('click',function() {
$(this).attr('href', $(this).attr('href') + "#breadcrumbs");
});
</code></pre>
<p>Now I want to make sure that happens just if a link does not already have a #hash in it. Otherwise what happens is I click a link and the outcome looks like this: <code>http://page.com/whatever#hash#breadcrumbs</code> I simply want to prevent that.</p>
<p>However the following code does not work. If I add the :not selector none of the links adds the #breadcrumb hash (with or without already existing #hash)</p>
<pre><code>$('#main a:not([href*="#"]').live('click',function() {
$(this).attr('href', $(this).attr('href') + "#breadcrumbs");
});
</code></pre>
<p>Any idea what I'm doing wrong here?</p>
|
javascript jquery
|
[3, 5]
|
497,847 | 497,848 |
asp.Net Checkbox has NO value?
|
<p>SOLVED: How can I get VALUE from a checkbox in a datalist? Checkboxes have no VALUE.</p>
<pre><code><asp:DataList
ID='dlTest'
runat='server'
RepeatColumns='2'>
<ItemTemplate>
<asp:HiddenField ID='cbTestID' runat='server' value='<%# Eval("id") %>' />
<asp:CheckBox ID='cbTest' runat='server' /> <%# Eval("name") %><br />
</ItemTemplate>
// CODE BEHIND
foreach (DataListItem cb in dlTest.Items) {
CheckBox chk = (CheckBox)cb.FindControl("cbTest");
HiddenField hf = (HiddenField)cb.FindControl("cbTestID");
if(chk.Checked)
{
Response.Write(hf.Value);
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,626,849 | 3,626,850 |
jQuery determining if element exists on page
|
<p>How can I determine if an element exists on a page... for instance... </p>
<pre><code>$('select[name="modifier_option"]')
</code></pre>
<p>If that select box exists on the screen I need to validate it's value on the page to ensure it's value is > 0, but if it doesn't exist I don't need to worry about it.</p>
|
javascript jquery
|
[3, 5]
|
877,197 | 877,198 |
how to kill a phonefacade in between in android through python?
|
<p>I am using "phoneDialNumber ApI" it makes a call of near around 45 seconds to other mobile , how i can kill it in between? </p>
|
android python
|
[4, 7]
|
2,303,390 | 2,303,391 |
HttpSessionState as parameter
|
<p>What is the highest class in the hierarchy I can use to pass HttpSessionState as a parameter and add values to it?</p>
<p>For instance to a method like</p>
<pre><code>public void MyMethod(IDictionary<string, object> input)
{
input.Add("something", something);
}
</code></pre>
<p>I see that implements ICollection and IEnumerable, but that only allows me to read values, not add them.</p>
|
c# asp.net
|
[0, 9]
|
421,320 | 421,321 |
jQuery: Move element position
|
<p>In each div, there are two buttons: higher and lower. When 'higher' is clicked, if this div is not at the top position, then it is moved higher than original. When 'lower' is clicked, then the element will be moved lower than original. </p>
<p>The question is: How to the elements can be moved up and down of with respect to another element?</p>
<pre><code><div>
<div id="a1">a1<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
<div id="a2">a2<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
<div id="a3">a3<input name='higher' type='button' value='higher'/><input name='lower' type='button' value='lower'/></div>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
70,681 | 70,682 |
Returning a value and then assigning it - possible race condition?
|
<p>If I had code like so - lets simplify it.</p>
<pre><code>someObj.newVal = returnSomVal();
function returnSomVal(){
return grabproperVal();
}
function grabproperVal(){
var someVal;
//some js figuring to get proper value for somVal;
return someVal
someObj.newVal = setSomeCookie(someObj.newVal,'cookiename');
}
</code></pre>
<p>Could there exist a race condition in which this happens:</p>
<pre><code>someObj.newVal = setSomeCookie(someObj.newVal,'cookiename');
</code></pre>
<p>before this assignment happens:</p>
<pre><code>someObj.newVal = returnSomVal();
</code></pre>
<p>I am "sometimes" missing out on the var and I don't know if it is my testing methodology or perhaps there "is" a race condition happening. Just trying to narrow things down.</p>
|
javascript jquery
|
[3, 5]
|
617,159 | 617,160 |
read ArrayList with index
|
<p>I've a class wich returns an array list, but when i'm reading it i want to write the values in a page.</p>
<p><strong>i've this class:</strong></p>
<pre><code> public ArrayList users(string table)
{
ArrayList list = new ArrayList();
foreach (DataRow item in com.Execute("select * from " + table + ";").Rows)
{
list.Add(item["id"].ToString());
list.Add(item["mail"].ToString());
list.Add(item["data"].ToString());
}
return list;
}
</code></pre>
<p><strong>Page_Load</strong></p>
<pre><code>loadUsersNewsletter lun = new loadUsersNewsletter();
String[] myArr = (String[])lun.users("newsletter").ToArray(typeof(string));
foreach (Object o in myArr)
{
load.Controls.Add(new LiteralControl("<tr><td>" + o + "</td><td>" + o + "</td></tr>"));
...
}
</code></pre>
<p>how can i read the values by index, or another way, in order to don't repeat values.
If there is another solution for this please tell me.</p>
|
c# asp.net
|
[0, 9]
|
4,348,195 | 4,348,196 |
Is it possible to loop through a textbox's contents? If not, what's the best strategy to read line-by-line?
|
<p>I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex).</p>
<p>I'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream content to a multi-line textbox in my ASP.NET webpage.</p>
<p>Is it possible for me to loop through the content of the textbox and then say "If textbox1.text.contains (or save the textbox text as a string variable), a certain string then increment a count". The problem with the textbox is the string loses formatting, so it's in one long line with no line breaking. Can that be changed?</p>
<p>I'd like to do this rather than write the content to a file because writing to a file means I would have to handle all sorts of external issues. Of course, if this is the only way, then so be it. If I do have to write to a file, then what's the best strategy to loop through each and every line (I'm a little overwhelmed and thus confused as there's many logical and language methods to use), looking for a condition? So if I want to look for the string "Hello", in the following text:</p>
<p>My name is xyz
I am xyz years of age
Hello blah blah blah
Bye</p>
<p>When I reach hello I want to increment an integer variable.</p>
<p>Thanks,</p>
|
c# asp.net
|
[0, 9]
|
1,290,106 | 1,290,107 |
Post a link on twitter wall?
|
<p>I am trying to post a link on my twitter wall just like update status or post a tweet on wall.</p>
<p>I am currently using <strong>twitter4j-core-2.1.11.jar</strong> library to post tweet on twitter but I also want to post a link with tweet text.</p>
<p>How can i do it please help!</p>
|
java android
|
[1, 4]
|
2,309,517 | 2,309,518 |
Cloning a field with text in it clones text as well?
|
<p>I have a piece of code that clones three fields, but when it clones the three fields, it also clones the text entered inside of it, is there a way to clear the content inside of the field when it is cloned?</p>
<pre><code>$(document).ready(function() {
$('#btnAdd').click(function() {
var num = $('.clonedSection').length;
var newNum = new Number(num + 1);
var newSection = $('#clonedSection' + num).clone().attr('id', 'clonedSection' + newNum);
newSection.children(':first').children(':first').attr('id', 'name' + newNum).attr('name', 'name' + newNum);
newSection.children(':nth-child(2)').children(':first').attr('id', 'age' + newNum).attr('name', 'age' + newNum);
newSection.children(':nth-child(3)').children(':first').attr('id', 'school' + newNum).attr('name', 'school' + newNum);
$('.clonedSection').last().append(newSection);
$('.clonedSection').last().val(ping);
$('#btnDel').attr('disabled','');
if (newNum == 2)
$('#btnAdd').attr('disabled','disabled');
});
$('#btnDel').click(function() {
var num = $('.clonedSection').length; // how many "duplicatable" input fields we currently have
$('#clonedSection' + num).remove(); // remove the last element
// enable the "add" button
$('#btnAdd').attr('disabled','');
// if only one element remains, disable the "remove" button
if (num-1 == 1)
$('#btnDel').attr('disabled','disabled');
});
$('#btnDel').attr('disabled','disabled');
});
</code></pre>
<p>Thanx in advance!</p>
|
javascript jquery
|
[3, 5]
|
4,033,900 | 4,033,901 |
Removing the last two instances of a character
|
<p>I'm building a string based on selected checkboxes. I wrote a statement that will add pluralization if there are multiple strings selected, but I cannot figure out how to remove the last two commas that are put into the 'policyHidden' field by the array.</p>
<pre><code>$(document).ready(function(){
$('input:checkbox').change(function() {
var keys = [];
var policies = $('input:checkbox:checked').map(function () {
return $(this).siblings('span').text(); }).get();
$.each(policies, function(key, value) { keys.push(value) });
output = keys.join(", ");
FormSetFieldValue('policyHidden', output);
if (keys.length > 1) {
keys.splice(keys.length - 1, 0, "and");
}
FormSetFieldValue('policyHidden', output);
});
});
</code></pre>
<p>example output is</p>
<pre><code>value1, value2, and, value3
</code></pre>
<p>I just want to remove the last two commas. should I do a regex?</p>
<p><em>FYI, FormSetFieldValue is a function from another script; first variable calls the variable wanting to be changed, second one is the set value. Shouldn't have any consequence on the problem at hand.</em></p>
|
javascript jquery
|
[3, 5]
|
2,619,812 | 2,619,813 |
How to manually collect jQuery sequence?
|
<p>I have two jQuery objects:</p>
<pre><code>var one = $("#one");
var two = $("#two");
</code></pre>
<p>And I'm looking for a way to compile another jQuery object like:</p>
<pre><code>var oneAndTwo = $(one, two); // pseudo-function
</code></pre>
<p>So I could work with it like as I get them with <code>$("#one, #two")</code>.</p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
5,176,417 | 5,176,418 |
Link a search interface in android to a php search page
|
<p>hi im wondring if i can do something like this , i have mobile website that have two pages . one for search and the second for results . my goal is to make an android app which have a search interface exactly like the php search page . and when the options selected the results page will show up as a webview .sorry for my english
and heres a picture to clear things up .Thanks
<a href="http://i.imgur.com/jGnin.jpg" rel="nofollow">http://i.imgur.com/jGnin.jpg</a>
i just need a tip to replace the php search page with an android search interface .i also dont need any help in the webview part .</p>
|
php android
|
[2, 4]
|
5,158,169 | 5,158,170 |
How to add opacity to a div?
|
<p>I am trying to add opacity to a div.</p>
<p>Here is my Jquery:</p>
<pre><code>$('.redDiv').fadeIn(0, 0.5);
</code></pre>
<p>My HTML:</p>
<pre><code><div class="redDiv" style="background:red;width:20px;height:20px;"> </div>
<div class="divBlue;" style="background:blue;width:20px;height:20px;"> </div>
<div class="divBlack;" style="background:black;width:20px;height:20px;"> </div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,481,073 | 3,481,074 |
Mouse position relative to div
|
<p>I am using jquery ui for drag and drop. I am trying to get mouse position relative to div, here is my code:</p>
<pre><code>$( "#db_tables " ).droppable({
activeClass: "ui-state-default",
hoverClass: "ui-state-hover",
drop: function( event, ui ) {
var x = ui.position.left - ui.offset.left; // tired event.pageX - this.offsetLeft;
var y = ui.position.top - ui.offset.top; // tired event.pageY - this.offsetTop;
$( '<div style="margin-top:' + y + 'px; margin-left:' + x + 'px; "></div>' ).html( ui.draggable.html() ).appendTo( this );
}
});
</code></pre>
<p>But the position of dropped div is not correct, Can anybody please tell me what is wrong with code?</p>
|
javascript jquery
|
[3, 5]
|
2,475,243 | 2,475,244 |
Why is it possible to query jQuery('div') like an array?
|
<p>I got another question regarding jQuery's architecture. <code>$('div')</code> constructs a new <code>jQuery</code> object:</p>
<pre><code>$('div') instanceof jQuery; // true
</code></pre>
<p>I'd like to know why it is possible to query it like an array, allthough it isn't an array?</p>
<pre><code>$('div')[0]; // returns the first div in the document as a DOM node.
$.isArray($('div')); // false
</code></pre>
<p>I just love this syntax, it looks so clean! I also noticed this returns the DOM nodes as an array:</p>
<pre><code>console.log($('div'));
</code></pre>
<p>Can somebody explain me how to implement this behaviour to my own objects? </p>
<hr>
<p>My own approach was to make an array with some methods like this:</p>
<pre><code>var a = ['a', 'b', 'c'];
a.method = function(){ return 'test'; };
a; // ['a', 'b', 'c']
a[0]; // 'a'
a.method(); // 'test'
</code></pre>
<p>However this doesn't seem to be the way jQuery does it as this is actually an array:</p>
<pre><code>$.isArray(a); // true
</code></pre>
<p>I'd like to know how jQuery does this to learn and to see if it's a better solution than mine.</p>
|
javascript jquery
|
[3, 5]
|
3,923,716 | 3,923,717 |
How to use jQuery slideDown() to display _almost_ all contents?
|
<p>I have a div within a div. On page load, they should both be hidden, then when I trigger the <code>slideDown()</code> function on the outer div, I want the inner div to remain hidden. How can I achieve this?</p>
<pre><code><script>
$(function(){
$('.body').hide();
$('.display').click(function(){
$(this).closest('.wrapper').find('.body').slideDown();
});
});
</script>
<div class="wrapper">
<a class="display" href="#">Display Outer</a>
<div class="body">
Now displaying outer div
<div class="wrapper">
<a class="display" href="#">Display Inner</a>
<div class="body">
Now displaying inner div
</div>
</div>
</div>
</div>
</code></pre>
<p>Here is an example of it not working: <a href="http://jsfiddle.net/b7Tpt/" rel="nofollow">http://jsfiddle.net/b7Tpt/</a></p>
|
javascript jquery
|
[3, 5]
|
3,521,655 | 3,521,656 |
Only show parts of image under a div using jquery
|
<p>I'm displaying a background picture with some semi-opaque div over it, so that it appears somewhat darker than it actually is. On top if it, I have a number of smaller, draggable divs. </p>
<p>I'd like the image to be completely visible, or revealed under these divs. These smaller divs should be like looking through windows to the below image.</p>
<p>One way to do it, is to set the background of each "window div" be a version of the larger image, and adjust the position to compensate for the div location. This works okay, but is kind of slow/jerky and very clunky.</p>
<p>Is there a better way?
Thanks!</p>
|
javascript jquery
|
[3, 5]
|
4,229,364 | 4,229,365 |
Using find() excluding some elements?
|
<p>I need to use find() to find all inputs in a form and change its value to ''. But I also need to exclude 2 inputs, the name of these inputs are: 'data', and 'date'</p>
<p>I tried this (with no success)</p>
<p><strong>$('#contactForm').find("input[ @name != 'data' ][ @name != 'date' ]").val('');</strong></p>
|
javascript jquery
|
[3, 5]
|
4,614,032 | 4,614,033 |
using javascript with server controls
|
<p>I am trying to use javascript with server controls.</p>
<p>Aim<br>
To make my panel visible on mouseover event of text box(asp control)</p>
<p>Problem areas<br>
new to javascript and asp.net.<br>
getting javascript errors at run time<br>
went thru all possible solutions from different forums but not able to customize them accordingly.</p>
<p>The code runs on this ASP.NET Control</p>
<pre><code><asp:TextBox ID="TextBox1" runat="server"
ontextchanged="TextBox1_TextChanged"
onmouseover="enablepanel()"
Width="76px"
Text="--SELECT--">
</asp:TextBox>
</code></pre>
<p>Tried these scripts</p>
<pre><code>function enablepanel(sender, target) {
document.getElementById(target).removeAttribute("disabled");
}
function enablepanel() {
var id = $get("<%=Panel1.ClientID %>");
if (id != null) id.disabled = false;
$get("#<%= ButtonSave.ClientID%>").removeAttr("disabled");
var controls = document.getElementById("<%=Panel1.ClientID%>");
controls.disabled = false;
}
function enablepanel() {
document.getElementById(div1).disabled = "false";
}
</code></pre>
<p>Its not working.</p>
<p>Request<br>
if possible try to make it simple as we call functions in html when we use javascript otherwise just go with the solution.</p>
|
javascript asp.net
|
[3, 9]
|
33,342 | 33,343 |
Page does not load when ScriptManager is not included on MasterPage, but does when ScriptManager is commented out
|
<p>I have been editing an existing ASP.NET website, and removing old code that is no longer necessary. </p>
<p>On the MasterPage there was a ScriptManager control that I removed. The page would then stop loading any content, and I would just get an empty body tag. However, if I leave the ScriptManager control in, but surround it with <!-- --> to comment it out, the page then loads. </p>
<p>If I uncomment the ScriptManager, I get an error in my Firebug console that reads "Sys.ArgumentException: Sys.ArgumentException: An element with id 'form1' could not be found.
Parameter name: elementOrElementId." The page still loads properly.</p>
<p>I checked to see if there was an UpdatePanel or anything else that I was aware of that might be using the ScriptManager and I can't find anything.</p>
<p>Can anyone tell me why this behavior is occurring?</p>
|
c# asp.net
|
[0, 9]
|
2,374,503 | 2,374,504 |
jQuery API-compatible micro framework (other than Zepto)?
|
<p>I would swear on my cat's grave that I just read about such a thing in the last couple weeks, but I can't for the life of me find it now. I am looking for a minimal framework covering basic DOM selecting (e.g., including Sizzle, so it works with IE6 -- so Zepto doesn't qualify), manipulation & event binding, but omitting just about everything else. </p>
<p>I need to add some very simple stuff to a VERY old web site and I want to use jQuery compatible syntax in case one day it needs more, but don't want to add 90K to the page size for this. I was hoping to spend approximately 30 minutes on this project, so I don't really want to cobble this together myself. Assuming I'm not imagining things, anyone know what I might be thinking of?</p>
|
javascript jquery
|
[3, 5]
|
5,415,574 | 5,415,575 |
How do I add JavaScript code on a webpage?
|
<p>Could someone please tell me how to get this code working on a webpage? Particularly what should go in the header?</p>
<p><a href="http://jsfiddle.net/mekwall/TJcP4/1/" rel="nofollow">http://jsfiddle.net/mekwall/TJcP4/1/</a></p>
<p>Sorry if this is a basic question...steep learning curve!</p>
<p>Thanks</p>
|
javascript jquery
|
[3, 5]
|
376,181 | 376,182 |
How to access documentation in javascript
|
<p>Is it possible to access the documentation in the javascript at runtime as we do in python like </p>
<pre><code>object__doc__
</code></pre>
<p>I am just looking for an easy way to discover about inbuilt functions rather then googling for them all the time.
Also is there something equivalent to python's <code>dir(object)</code> , again I am looking for it because i don't know how to discover about what properties / functions an object exposes.</p>
|
javascript python
|
[3, 7]
|
5,503,656 | 5,503,657 |
Alternative Jquery mouse event
|
<p>Alright so the code below works fine if I click outside the #nav div. I was asking if it is possible to just move the mouse away from the #nav div to make it disappear. I don't want to 'click' to hide the div.</p>
<pre><code>$(document).mouseup(function (e)
{
var container = $("#nav");
if (container.has(e.target).length === 0)
{
container.hide();
}
});
</code></pre>
<p>Any help will be appreciated :)</p>
|
javascript jquery
|
[3, 5]
|
3,527,592 | 3,527,593 |
javascript and asp.net
|
<p>I am going to be doing a lot more front end work on one of our asp.net projects and I suspect there will be a lot more JavaScript involved. I have seen and used a lot of tutorials/info on the fundamentals of the JavaScript language but could someone point me towards some resources on JavaScript specifically for using it with asp.net? If specific tutorials/pages don't really exist then maybe some of the methods,tools,libraries etc. you would use and are worth reading about?</p>
|
javascript asp.net
|
[3, 9]
|
5,216,472 | 5,216,473 |
Javascript, local copying of a variable's value... struggling to achieve it
|
<p>I have what i thought was a simple javascript / jquery function (fade out of one div, fade into another... loop until it reaches a maximum and then start back from the begining. The problem i have though is that to fadein the next div i need to increment the global counter. Doing this increments double increments it because i'm assuming the local variable i've created maintains the same reference to the global variable. </p>
<p>The code sample below should explain a little easier. Can anyone spot what i'm doing wrong?</p>
<pre><code>var current_index = 1;
$(document).ready(function() {
$(function() {
setInterval("selectNextStep()", 3000);
});
});
function selectNextStep() {
$("#step_"+current_index).fadeOut('slow', function() {
var next = current_index;
next = next + 1;
$("#step_"+next).fadeIn('slow', function() {
if (current_index == 4) current_index = 1;
else current_index ++;
});
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.