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
1,197,000
1,197,001
how to start with ASP.NET MVC 3 razor
<p>I going to start a new project in my company in which are involved the use of MVC 3, now this is the first time that we are using this framework, and i have a couple of questions,</p> <ol> <li>It's recommended to start with MVC3 and not from the MVC2?</li> <li>Any Tutorials in specific that you can recommend?</li> <li>This framework have full integration with jQuery? </li> </ol>
c# asp.net
[0, 9]
2,425,508
2,425,509
How to treat plus sign from user input as part of input string and not as concat operator?
<p>This is for a small internal tool to enable a few people to query the database. The query has a plus sign as below:</p> <pre><code>SELECT SUBSTRING(DateName(month,CreatedOn),0,4) + ' - ' + SUBSTRING(CAST(Year(CreatedOn) AS varchar(10)),3,3) as Month, Year(CreatedOn) as Year, </code></pre> <p>The query is passed to the server using a jquery ajax call </p> <pre><code> var d = "query=" + $("#txtQuery").val(); $.ajax({ type: 'GET', url: '/Reports/GetReport', data: d, </code></pre> <p>However, I get a server error and debugging I find that the query on the server is missing the plus sign. i.e.</p> <pre><code> SELECT SUBSTRING(DateName(month,CreatedOn),0,4) ' - ' SUBSTRING(CAST(Year(CreatedOn) AS varchar(10)),3,3) as Month </code></pre> <p>And from FireBug,</p> <pre><code>localhost:1489/Reports/GetReport?query=SELECT%20SUBSTRING(DateName(month,CreatedOn),0,4)%20+%20%27%20-%20%27%20+%20SUBSTRING(CAST(Year(CreatedOn)%20AS%20varchar(10)),3,3)%20as%20Month,%20Year(CreatedOn)%20as%20Year.. </code></pre> <p>How do I ensure that the plus is treated as a part of the input string and not as a concat operator which seems to be the case here. </p>
javascript jquery asp.net
[3, 5, 9]
2,171,307
2,171,308
Escaping line break (endline) from PHP variable for Javascript usage
<p>heres my code : </p> <pre><code>&lt;td onclick="openFile('&lt;?php echo htmlentities ($row['name'])?&gt;',' &lt;?php echo htmlentities ($row['content'])?&gt;')"&gt; &lt;a href="#nf" data-toggle="tab"&gt;&lt;?php echo $row['name']?&gt;&lt;/a&gt;&lt;/td&gt; </code></pre> <p>as there is an endline char in $row['content']:</p> <blockquote> <p>openFile('wow','wow wow</p> <p>wow ');</p> </blockquote> <p>and when browser cant find an ending qoutes in the same line it throws an </p> <p>error(SyntaxError: unterminated string literal [Break On This Error]). </p> <p>Any solution for this ?</p>
php javascript
[2, 3]
5,598,158
5,598,159
What's the best way to facilitate "Load More" pagination with jQuery?
<p>I'm displaying a list of search results on a page. At the very bottom I would like to place a "Load More" link which appends more results to existing ones on the page and changes the "Load more" link's parameters to next page, so that if user clicks it next page will be appended to the page. It would also be nice to have "Please wait" or some message appear while results are loading.</p> <p>What's the most common and practical way of doing this with jQuery?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,687,629
3,687,630
mouseenter / mouseleave animation chain halt
<p>I'm not sure how to title this one. But I have a mouseenter/mouseleave behavior that slides a menu up and down respectively. It works great unless the user moves the mouse in and out of the element really quickly several times. Then, all the animations are fired and the menu "goes bezerk" and continues to animate. </p> <p>What I want is to unbind the mouseenter event until the mouseleave event is complete. I've tried several different approaches including stop() and stopPropogation() but it has not worked.</p> <p>I got this code to work but it doesn't seem "right" to me.</p> <pre><code> function add_menu_listener(menu, affected){ $j(menu).mouseenter(function(e){ $j(menu).unbind('mouseenter'); $j(menu + " &gt; ul.links").slideDown(); $j(affected).attr('src', "/images/down_arrow_menu.png"); }).mouseleave(function(e){ $j(menu + " &gt; ul.links").slideUp( 500, function(){ add_menu_listener(menu, affected); }); $j(affected).attr('src', "/images/right_arrow_menu.png"); }); } </code></pre>
javascript jquery
[3, 5]
3,180,187
3,180,188
Using jquery how can I remove a DIV if it's contents are empty?
<p>I'm looking for a way to remove the following empty div using jquery.</p> <p>The following div is output sometimes without content inside it. For display reasons I need to remove it when it's empty.</p> <pre><code>&lt;div class="field-group-format group_call_to_action_aside div group-call-to-action-aside box yellow speed-fast effect-none"&gt;&lt;/div&gt; </code></pre> <p>Thoughts?</p> <p>I've been trying the following and variations of it, but have't had any luck. </p>
javascript jquery
[3, 5]
3,579,831
3,579,832
Jquery expand from external link
<p>I am trying to make it so that when a user clicks on a link from one page, it goes to another page that has a simple jquery collapsed text and expands (un-collapses) the text. My attempt is with the code below:</p> <pre><code>$(function() { var elem = $('#expand-4' + location.hash); $('#expand-4-text').slideToggle('fast', function() { // Animation complete. }); $('#expand-4').toggleClass('expand-4-expanded'); }); </code></pre> <p>It does not work though. Can someone tell me why?</p>
javascript jquery
[3, 5]
4,777,570
4,777,571
Select folder intent & Work out when intent complete?
<p>So I'm making a wallpaper and I want the user to select a folder. So I have a button in the preferences that launches an intent to open an image, but what I want is actually just a directory (I guess in the worst case i can strip the filename from the end). So that's my first problem: what's the best way to select a folder only?</p> <p>The second problem is how do I get notified of when the intent is complete?</p> <pre><code>public class FilePreference extends DialogPreference implements View.OnClickListener { public void onClick(View v) { // open up a gallery/file browser Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); getContext().startActivity(Intent.createChooser(intent, "Select Folder")); } </code></pre>
java android
[1, 4]
3,741,318
3,741,319
How to measure the rendering time of a View?
<p>I'm using a <code>ChartEngine</code> to create scatter plots. Each scatter plot is a <code>View</code>.<br> How would I measure the time required to render a <code>View</code>?</p>
java android
[1, 4]
5,854,402
5,854,403
binding an arraylist to a gridview
<p>Hallo there</p> <p>I am adding object(books) to an arraylist as I add them to a database that is situated in a web service. My idea is to display these books in a gridview(in the deffault.aspx) by obviously binding it to the arraylist. The problem I have is that the gridview is situated in deffault.aspx, and the procedure for adding the books to the arraylist is on a different page entirely and thus I can't seem to access the data source programaticaaly from the gridview. Is there a way of binding the arraylist data to the gridview, even if they are, like in this case situated on different pages?</p> <p>Kind regards</p>
c# asp.net
[0, 9]
2,699,264
2,699,265
How to get portion of the attribute value using jquery
<p>I have attribute value as:</p> <pre><code>&lt;div id = "2fComponents-2fPromotion-2f" class = "promotion"&gt; </code></pre> <p>Now I want to get only portion of it, say <code>Promotion</code> and its value <code>2f</code>, how can I get this using jquery ? Do we have built in function for it ?</p>
javascript jquery
[3, 5]
2,477,996
2,477,997
Jquery toggle won't work after cloning
<p>I have cloned a list item using .clone in Jquery:</p> <pre><code> $("#coll-selected-list li:contains(" + itemName + ")").clone().addClass("avgli").appendTo("#coll-grouped-list"); </code></pre> <p>However, when I wish to toggle the newly added list item, it won't work for some reason. Any ideas?:</p> <pre><code>$(document).ready(function () { $(".avgli").toggle(function () { if ($(this).parent().hasClass('agg-drop')) { $(this).css("background", "#fff"); } }, function () { if ($(this).parent().hasClass('agg-drop')) { $(this).css("background", "#676767"); } });); &lt;ul id="coll-grouped-list" class="agg-drop"&gt; &lt;li class="sortedli avgli" style=""&gt;Blah Blah&lt;/li&gt; &lt;li class="sortedli avgli" style=""&gt;Blah&lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,552,260
4,552,261
javascript url help in sending multiple values with url..
<pre><code>"sample1.php?q="+str </code></pre> <p>This code is for sending single parameter i need to send multiple variables </p>
php javascript
[2, 3]
4,820,497
4,820,498
What's the fastest and/or cleanest way to store text content in javascript/DOM?
<p>I typically see version 1 but some open source projects I work on use version 2 and I've used version 3 in the past. Does anyone have a more elegant solution, maybe one that's more scalable?</p> <p>Version 1:</p> <pre><code>var text1 = 'this is my script\'s content'; </code></pre> <p>Version 2:</p> <pre><code>&lt;script type="text/plain" id="text1"&gt;This is my content&lt;/script&gt; &lt;script&gt; var text1 = $('#text1').html(); &lt;/script&gt; </code></pre> <p>Version 3:</p> <pre><code>&lt;input type="hidden" id="text1" value="this is my content"&gt; &lt;script&gt; var text1 = $('#text1').val(); &lt;/script&gt; </code></pre> <p>Version 4:</p> <pre><code>&lt;span class="hidden" id="text1"&gt;this is my content&lt;/span&gt; </code></pre>
javascript jquery
[3, 5]
4,742,735
4,742,736
Need to view the thumbnail of the word Document
<p>If i browse the word file through file upload control in html, i want to view the thumbnail of the document(first page is enough) as an image in the right to my control..How to do it programmatically..please suggest..Thanks in advance...</p>
java javascript
[1, 3]
1,720,798
1,720,799
Use Jquery variable to identify a div class/Id
<p>I'm sure the answer to this is simple, I've just been able to figure it out.</p> <p>I have a simple click function which applies to any links in a list being clicked. When one is clicked, I want it to remove a class on a div, which is related to one of the links attributes. E.g:</p> <pre><code>// The link &lt;li&gt;&lt;a href="#" title="example1"&gt;example1&lt;/a&gt;&lt;/li&gt; // The div &lt;div id="example1" class="selected"&gt;&lt;/div&gt; </code></pre> <p>This is the kinda thing that I've tried, but it aint right:</p> <pre><code>$("ul.switcher a").click(function(e){ e.preventDefault(); $("#" + $(this().val).removeClass("selected"); }); </code></pre> <p>Any help would be much appreciated! If anyone could also tell me the JavaScript equivalent of doing this too that would be a nice bonus!</p>
javascript jquery
[3, 5]
4,141,791
4,141,792
Loading message and setTimeout
<p>I have the following script:</p> <pre><code>$(function() { $(".message").hide(); function simulate_ajax_call() { $.ajax({ url: "/echo/json/", success: function(){ alert("done"); $(".message").empty().html("done"); $(".message").delay(1000).fadeOut(500); } }); } $('.button').click(function() { $(".message").fadeIn(500); setTimeout("simulate_ajax_call()", 5000); }); }); </code></pre> <p>With the following HTML:</p> <pre><code>&lt;input type="button" value="button" class="button" /&gt; &lt;div class="message"&gt;loading...&lt;/div&gt; </code></pre> <p>For some reason the <code>setTimeout</code> part is not working. i.e. it does not seem to call the function after 5000ms.</p> <p><a href="http://jsfiddle.net/oshirowanen/kHEVa/" rel="nofollow">jsFiddle</a>.</p>
javascript jquery
[3, 5]
1,952,622
1,952,623
How to send PHP variables and retrieve them with Jquery (without echo)?
<p>I'm building a search function to retrieve XML data for a google map. </p> <p>In addition to that, I want to display how many results were actually found. </p> <p>I thought about doing an echo inside the actual document, however that might mess with my marker data. How would I take a PHP variable and retrieve it in Jquery after a success call?</p> <p>If my PHP looked like this:</p> <pre><code>$result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } $num_rows = mysql_num_rows($result); </code></pre> <p>And Jquery like this:</p> <pre><code> $.ajax({ type: "POST", url: "MapSearchxml.php", data: { dataFromDate: FromDate, //lalala dataHasPatio: HasPatio }, beforeSend: function (html) { // this happens before actual call $("#results").html('Please Wait'); $("#searchresults").show(); $(".phpFromDate").html(FromDate); }, success: function (data, status, jqXHR) { //Success? }, dataType: 'xml' }); </code></pre>
php jquery
[2, 5]
1,475,723
1,475,724
jQuery listview plugin
<p>Is there any ListView widget plugin for jQuery? With resizable columns, sorting helpers, odd-even rows styles etc. Something like ListView class from Ext library but for jQuery (NOT table/grid).</p> <p><strong>UPDATED</strong> Have switched to ExtJS so question is not topical anymore.</p>
javascript jquery
[3, 5]
2,388,786
2,388,787
i want to check the network state but it give me nullPointerException why?
<p>I am receiving a <code>NullPointerException</code> with the code below. Does anyone know what may be causing this?</p> <pre><code>public void clickMe(View v) //the view is button { ConnectivityManager conMgr = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo networkInfo = conMgr.getActiveNetworkInfo(); String b; if(networkInfo.isConnected()) b="on"; else b="off"; Toast.makeText(MainActivity.this, b , Toast.LENGTH_SHORT).show(); } </code></pre>
java android
[1, 4]
4,561,490
4,561,491
Re-using programatically created Textviews
<p>I've written code to perform a search and display the results below the search form in the XML file.</p> <p>However, by creating TextViews dynamically, it keeps adding more TextViews so the number of TextViews increases by 5 everytime I perform a search. How could I re-use the TextViews so I can update the text to be displayed rather than creating more TextViews?</p> <pre><code>for(int i=0; i&lt;5; i++) { TextView altName = new TextView(getApplicationContext()); altName.setText("blah"); altName.setLayoutParams(new TableRow.LayoutParams(1)); altName.setTextAppearance(getApplicationContext(), R.style.textSize); TableRow altNameTr = new TableRow(getApplicationContext()); altNameTr.addView(altName); table.addView(altNameTr); } </code></pre>
java android
[1, 4]
3,047,138
3,047,139
find ID of previous button
<p>I'm looking to find the id of the previous button. It is pretty far away - lots of table rows, tables, divs, etc. between the target and the button but I thought this would still work:</p> <pre><code>alert( $(this).prevAll("input[type=button]").attr('id') ); </code></pre> <p>Unfortunately this returns alerts 'undefined'. Help?</p>
javascript jquery
[3, 5]
4,275,869
4,275,870
How to add variable + databinding to ASP.NET link navigateurl?
<p>Let's say I have a repeater with the code:</p> <pre><code>&lt;ItemTemplate&gt; &lt;asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='&lt;%#DataBinder.Eval(Container.DataItem, "FileLeafRef")%&gt;'&gt; &lt;h2&gt;&lt;%# DataBinder.Eval(Container.DataItem, "Title")%&gt;&lt;/h2&gt; &lt;/asp:HyperLink&gt; &lt;/ItemTemplate&gt; </code></pre> <p>The FileLeadRef variable only contains the page name though (like test.aspx and not the full URL which I need). I can get the first part of the URL in a variable in page_load so I need to do something like:</p> <p><code>NavigateUrl='&lt;%myVariable + "/"%&gt;&lt;%#DataBinder.Eval(Container.DataItem, "FileLeafRef")%&gt;'</code> but it obviously doesn't work and a have tried a few varieties without success.</p> <p>Any suggestions?</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
2,435,842
2,435,843
Opening the jquery UI dialog inside the div
<p>I have a <code>div#test</code> , with which i bind a <code>dblclick event to opens a jquery ui dialog</code>, now i want to open </p> <p>that <code>dialog inside a floating div</code> ( means a div whose position is absolute and placed on the</p> <p>center of the screen) when the <code>dblclick event triggers</code> on <code>div#test</code> something like :</p> <pre><code> line #1 $("#test").trigger("dblclick"); =&gt; open the dialog line #2 $("floatingdiv").html("I want to open the dialog inside this div after executing the line #1); </code></pre> <p>Help me? Thanks.</p>
javascript jquery
[3, 5]
4,818,729
4,818,730
Android / Java - How do I call upon a function in a separate *.java file?
<p>I do an import of the full package name / java file, and if I do a <code>&lt;classname&gt;.&lt;method&gt;</code>, SOMETIMES I can get it to access - other times I get a lot of <code>can't use a static in a non static</code> bunch of talk.</p> <p>I'll admit I'm new to Java, so what do I need to do? Call a class instance first, then call my methods? I'm rather confused by this, as I want to put all of my 'functions' into a FunctionsList.java file, and all of my main Activity (UI) into a MyActivity.java file.</p> <p>For example:</p> <pre><code>&lt;MyActivity.java&gt; import com.example.FunctionsList; private class MyActivity extends Activity { FunctionsList.function(); } </code></pre> <p>9/10 times I get that static/non-static error.</p> <p>If I put all of my functions into MyActivity.java, I have zero problems! Anyone help me on what I presume is a basic Java newbie issue?</p>
java android
[1, 4]
4,688,099
4,688,100
Is it possible to name a jquery selector the value of a variable
<p>For example, if i had a variable in javascript</p> <pre><code> var nombre; onclick="nombre='someValue'" </code></pre> <p>and somewhere along in my code this javascript variable's value is changed like above, could I set the value of that variable to be the class name in the jquery selector so it would be like</p> <pre><code>$('.someValue').show() </code></pre>
javascript jquery
[3, 5]
2,144,692
2,144,693
JavaScript In UserControl Wont Run
<p>I am trying to run the following script from my usercontrol:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function RebindUpdatePanelControls(sender, args) { $("#divUpload2").hide(); $("#divUpload3").hide(); alert("Hi Neck"); $('#lnkMore').click(function () { if ($('#hfClicked').val() == "0") { $("#divUpload2").slideToggle(); $('#hfClicked').val("1"); } else if ($('#hfClicked').val() == "1") { $("#divUpload3").slideToggle(); $('#hfClicked').val("2"); } }); } &lt;/script&gt; &lt;script type="text/javascript"&gt; Sys.Application.add_load(RebindUpdatePanelControls); &lt;/script&gt; </code></pre> <p>I added it to the top of the usercontrol file but it will not run </p> <p>lnkMore looks like this:</p> <pre><code> &lt;input id="lnkMore" type="button" value="Add GCM File" /&gt; </code></pre> <p>Is there something else I am missing to do to get this running?</p> <p>How do I make the client side button use this code when it isclicked?</p>
javascript asp.net
[3, 9]
1,225,543
1,225,544
Jqtouch performs poorly when wrapped on jqt DIV
<p>I have a iphone site based on JQTouch. When the pages are not wrapped in the it performs flawlessly. When it is wrapped in the DIV animations are inconsistent, pages overlap and are totally broken on Android. </p> <p>I would just abandon the jqt div but that breaks the 'Spinning wheel' by cubiq.</p> <p>$Revision: 166 $ $Date: Tue Mar 29 01:24:46 EDT 2011 $</p>
javascript jquery iphone
[3, 5, 8]
3,471,900
3,471,901
jquery find method
<p>I have a function called using an anchor inside a form, and I need to get the values of the inputs inside the same form to perform certain actions. Problem is, the result is always <code>undefined</code>.</p> <p>Here's the code :</p> <pre><code>$('#create_alert').live('click', function(e) { var form = $(this).parent().get(0); var id = $(form).find('input[name="id"]').val(); alert(id); }); </code></pre> <p>.. and the context :</p> <pre><code>&lt;form name="create_alert"&gt; &lt;input type="hidden" name="id" value="1" /&gt; &lt;a href="#" type="text" id="create_alert" class="search-submit"&gt;CRIAR ALERTA&lt;/a&gt; &lt;/form&gt; </code></pre> <p>Thoughts?</p>
javascript jquery
[3, 5]
5,888,699
5,888,700
how to pass full page from php to jQuery. and send some data back
<p>Is there any way i can load a page in php, pass it to jQuery , extract data then send that data back to php script.</p> <p>see : <a href="http://stackoverflow.com/questions/16315691/how-to-find-number-of-ul-inside-each-div">How to find number of &lt;ul&gt; inside each div</a></p> <p>this is lab experiment work. file is on my prof's personal site.</p> <p>trying to do this using phpQuery but seem's not possible . so a possible approach is as i mentioned above.</p>
php jquery
[2, 5]
1,088,708
1,088,709
How to properly make a Ken Burns effect using JQuery
<p>I recently tried the Ken Burns effect with this little jQuery plugin: <a href="http://tobia.github.com/CrossSlide/" rel="nofollow">CrossSlide</a>.</p> <p>The problem with that plugin is that when the motion is too slow it looks really bad. This is due to the fact that the image can only move 1 pixel at the time...</p> <p>I tried to do my own slideshow and I have the exact same problem. I then thought that this is normal... since we can only move an image pixel by pixel. </p> <p>But I just found this slider: <a href="http://codecanyon.net/item/estro-jquery-ken-burns-swipe-effect-slider/full_screen_preview/235111" rel="nofollow">Estro</a> Estro looks perfect to me. I wonder why it looks so smooth and how can I make mine look that good.</p> <p>How can my Ken Burns effect be as good as Estro's one.</p>
javascript jquery
[3, 5]
573,411
573,412
Jquery getting information from php
<p>I need to get information from a php file and put the information in jquery and i also need to know if the information has changed</p>
php jquery
[2, 5]
230,286
230,287
Problems with My Simple JQuery Div Slider
<p>I am trying to create a simple JQuery Div Slider, but it doesn't seem to be hiding the initial div or functioning properly.</p> <p>Here is my HTML:</p> <pre><code>&lt;div id="feature"&gt; &lt;div class="feature_container"&gt; &lt;div&gt;&lt;p&gt;Slide 1 Content&lt;/p&gt;&lt;/div&gt; &lt;div&gt;&lt;p&gt;Slide 2 Content&lt;/p&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is the JQuery code:</p> <pre><code> &lt;script&gt; $(function(){ $('.feature_container div:gt(0)').hide(); setInterval(function() { $('.feature_container :first-child').fadeOut() .next('div').fadeIn() .end().appendTo('.feature_container');}, 3000); }) }); &lt;/script&gt; </code></pre> <p>Am I doing anything in the JQuery code here that's not allowed or incorrect?</p> <p>Thanks in advance for any help- it's much appreciated! I would use a plugin too, but I'm really trying to figure out all of this by doing it by hand...</p>
javascript jquery
[3, 5]
2,564,033
2,564,034
Help with countdown jquery script to accept unix timestamp as input
<p>I try to modify the keith-wood countdown timer to accept a <em>future unix timestamp</em> and hide the days.</p> <p>To <em>hide the days</em> you use <code>$('#noDays').countdown({until: liftoffTime, format: 'HMS'});</code> as the example at <a href="http://keith-wood.name/countdown.html" rel="nofollow">http://keith-wood.name/countdown.html</a> under the tab <em>Formats1</em> says.</p> <p>I didn't manage yet to make it work. How to modify the code to get a <em>unix timestamp</em> as input and <em>hide the days</em>? </p> <p><strong>Standard timer</strong></p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { var austDay = new Date(); austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26); $('#defaultCountdown').countdown({until: austDay}); $('#year').text(austDay.getFullYear()); }); &lt;/script&gt; </code></pre> <p><strong>My try to have as input a unix timestamp</strong> (does not work)</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { var austDay = new Date(); austDay = new Date(&lt;?php echo $unixtimestamp; ?&gt;*1000); $('#defaultCountdown').countdown({until: austDay}); $('#year').text(austDay.getFullYear()); }); &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
3,072,953
3,072,954
Shifting to Java
<p>I'm a C/C++ developer. </p> <p>I am just intrigued why some of my colleagues are shifting to java. They actually have a lot to say why Java is better than C++. This is actually more of a trivial question, but I know for sure it would be a source of enlightenment for many also for novices like me. </p> <p>Knowing only C++ and a little of java, how do you think could you convince a C++ developer to shift to java? If not, why stick to c++?</p>
java c++
[1, 6]
5,076,343
5,076,344
Not Equal To notation in Javascript to use in jQuery
<p>Is this the notation to use for Not Equal To in JS, in jquery code</p> <pre><code>!== OR != </code></pre> <p>None of them work</p> <p>Here is the code I am using</p> <pre><code>var val = $('#xxx').val(); if (val!='') { alert("jello"); } </code></pre> <p>Thanks Jean</p>
javascript jquery
[3, 5]
1,152,418
1,152,419
"javascript:void(0);" vs "return false" vs "preventDefault()"
<p><br> When I want some link to not do anything but only respond to javascript actions what's the best way to avoid the link scrolling to the top edge of the page ?<br> I know several ways of doing it, they all seem to work fine :</p> <pre><code>&lt;a href="javascript:void(0)"&gt;Hello&lt;/a&gt; </code></pre> <p>or </p> <pre><code>&lt;a id="hello" href="#"&gt;Hello&lt;/a&gt; &lt;script type="text/javascript&gt; $(document).ready(function() { $("#toto").click(function(){ //... return false; }); }); &lt;/script&gt; </code></pre> <p>and even : </p> <pre><code>&lt;a id="hello" href="#"&gt;Hello&lt;/a&gt; &lt;script type="text/javascript&gt; $(document).ready(function() { $("#toto").click(function(event){ event.preventDefault(); //... }); }); &lt;/script&gt; </code></pre> <p>Do you have any preference ? why ? in which conditions ? </p> <p>PS: of course the above examples assume you're using jquery but there's equivalents for mootools or prototype.</p>
javascript jquery
[3, 5]
3,514,857
3,514,858
Set number of rows based on not letting the page scroll (jquery)
<p>We have a page with multiple content areas, in one of which we build a table from a result set. The user requirement is that the page not scroll. If we fix the number of rows to now allow scrolling at our preferred screen resolution, it looks great at the preferred resolution, but at lower resolutions the page scrolls. If we fix the number of rows so that the page does not scroll at our lowest supported resolution, we end up with a lot of wasted space at our preferred resolution. We have done some things with the viewport size (get viewport size, subtract all fixed elements, divide the result by normal row height to calculate number of rows to display), but these do not take into account that some of the rows wrap to be two lines. When that happens, we push down and end up scrolling at lower resolutions. Is there any way to dynamically fill an element with rows until it is full but not go past the point where the element would be forced to scroll?</p>
javascript jquery
[3, 5]
2,749,431
2,749,432
i need to pass a variable to my function
<p>i'm sure this is simple for most of you, but i'm struggling to learn this concept. i just need a little help. i've commented enough to explain what's going on. thanks!</p> <pre><code>//tabNavItem is an anchor link $(tabNavItem).on("click", function(e){ var currSlide = $(this).attr("rel"); console.log(currSlide); // right here the value is equal to the rel of the link i click. this is correct! slideAnimation(); // i tried slideAnimation.call(currSlide) but got nothing and i tried slideAnimation(currSlide) and got 1 every time e.preventDefault(); }); function slideAnimation(){ allTabs.hide(); $(".active").removeClass("active"); $("#" + currSlide).show(); $("." + tabNavClass + " a[rel=" + currSlide + "]").addClass('active'); console.log(currSlide); //right now this equals 1, the rel of the first item. }; </code></pre>
javascript jquery
[3, 5]
2,952,998
2,952,999
How can I use Eval in asp.net to read fields from a database?
<p>Here is the situation:</p> <p>I have a webform that needs to read specific fields from a database that uses the eval function in the .aspx page. I know how to assign the values in the .aspx page, but in the code behind how do I "get" the values and bind them to the .aspx page? Can I just used a datareader? Dataset? What exactly am I going to be binding or reading to the dataset or reader? Do I need to create a method? </p> <p>I already have the stored procedure created to pull the data from the database. I was going to create a method with the stored procedure. I just dont which kind to create...dataset, datareader? And how do I code it in the code behind? </p>
c# asp.net
[0, 9]
3,690,141
3,690,142
Data Reader Returning null although it says it has an item there
<p>hello I am using a reader to get a XML from a stored procedure.. now the stored procedure returns null if it does not find anything .. in the case I am testing.. it should not return anything but my code is failing.. it says there is a row.. but then when it gets to the reader.GetString(0); it says <code>Data is Null. This method or property cannot be called on Null values.</code></p> <p>How can I check for null int hat line XML = XML + reader.GetString(0);? it is passing the while(reader.Read() &amp;&amp; reader.HasRows) check.. when I debug it says there is an item but then when it gets to the line mentioned above it throws the Data is null error. How can I fix this?</p> <p>Here is my code</p> <pre><code> SqlDataReader reader = myCommand.ExecuteReader(CommandBehavior.CloseConnection); string XML = ""; while (reader.Read() &amp;&amp; reader.HasRows) { XML = XML + reader.GetString(0); } XML = "&lt;ProductList&gt;" + XML + "&lt;/ProductList&gt;"; reader.Close(); myConnection.Close(); return XML; </code></pre>
c# asp.net
[0, 9]
3,674,568
3,674,569
Beginner ASP.net question handling url link
<p>I want to handle links like this:</p> <pre><code>http://example.com/test.aspx?userid=tras&amp;server=bum </code></pre> <p>I looked <a href="http://www.15seconds.com/Issue/020417.htm" rel="nofollow">here</a>, and they do this:</p> <pre><code>HttpApplication objApp = (HttpApplication) sender; &lt;--- ERROR LINE string userid = objApp.Request["userid"].ToString(); </code></pre> <p>But I get the error:</p> <pre><code>Unable to cast object of type 'ASP.test_aspx' to type 'System.Web.HttpApplication'. </code></pre> <p>I need simple input from html nothing fancy. Just to get couple of string items in way described above,</p>
c# asp.net
[0, 9]
5,888,920
5,888,921
Issue with scrollbars in a asp:listbox
<p>I have a list box with multiple values. I need a functionality to move items up/down using <code>Ctrl+uparrow/Ctrl+downarrow.</code> I am here by stuck with a issue when the selected item in the <code>listbox</code> is out of focus the <code>scrollbars</code> do not move correspondingly and the selected item is out of visibility.Any help is greatly appreciated.Thanks in advance.</p> <p>Demo: <a href="http://jsfiddle.net/Srilatha0406/9EQhR/1/" rel="nofollow"> <strong>Demo</strong> </a></p>
jquery asp.net
[5, 9]
2,357,114
2,357,115
Get translate3d values of a div?
<p>Say a div has this applied to it:</p> <pre><code>-webkit-transform: translate3d(0px, -200px, 0px) </code></pre> <p>How could I retrieve those values with jQuery?</p>
javascript jquery
[3, 5]
3,539,908
3,539,909
i want to know how to navigate from one XML page to another in Java AWT on button click
<p>i am making an andriod application in which i need to go from one page to another on a button click. i have tried several things but nothing worked out.</p>
java android
[1, 4]
3,097,012
3,097,013
How to get global time(not the pc time) using javascript or jquery?
<p>I was creating a countdown timer using javascript; I can use jQuery. I want the global time not the PC time.</p> <p>How could I get the global time using javascript or the jQuery?</p>
javascript jquery
[3, 5]
144,279
144,280
Cannot crop Bitmap
<p>I'm trying to crop and scale given bitmap,But only scaling works.<br> What am I doing wrong?</p> <pre><code>private Bitmap CropAndShrinkBitmap(Bitmap io_BitmapFromFile, int i_NewWidth, int i_NewHeight) { int cuttingOffset = 0; int currentWidth = i_BitmapFromFile.getWidth(); int currentHeight = i_BitmapFromFile.getHeight(); if(currentWidth &gt; currentHeight) { cuttingOffset = currentWidth - currentHeight; Bitmap.createBitmap(i_BitmapFromFile, cuttingOffset/2, 0, currentWidth - cuttingOffset, currentHeight); } else { cuttingOffset = i_NewHeight - currentWidth; Bitmap.createBitmap(i_BitmapFromFile, 0, cuttingOffset/2, currentWidth, currentHeight - cuttingOffset); } Bitmap fixedBitmap = Bitmap.createScaledBitmap(i_BitmapFromFile, i_NewWidth, i_NewHeight, false) ; return i_BitmapFromFile; } </code></pre> <p>The description say that: "createBitmap Returns an immutable bitmap ".<br> What is that mean? and is it the cause to my problem?</p>
java android
[1, 4]
4,794,283
4,794,284
detect numbers or letters with jquery/javascript?
<p>i want to use an if-statement to run a code only if the user types in a letter or a number.</p> <p>i could use </p> <pre><code> if(event.keyCode == 48 || event.keyCode == 49 || event.keyCode == 50..) { // run code } </code></pre> <p>but is there an easier way to do this? maybe some keycodes dont work in all web browsers?</p>
javascript jquery
[3, 5]
4,663,681
4,663,682
Detect Browser autocomplete settings from the javascript
<p>Is there any way, we can detect the browser settings of autocomplete from the clientside script? Different browsers have diff autocomplete settings.</p> <p>I want to add autocomplete="off" to the textfields based on the client browser settings of the autocomplete feature.</p>
javascript jquery
[3, 5]
546,957
546,958
Converting simple Javascript to jQuery
<p>I have this:</p> <pre><code>&lt;script type="text/javascript"&gt; window.onresize = fontResize; function fontResize() { document.body.style.fontSize = parseInt(document.documentElement.clientWidth/100) + 'px'; } &lt;/script&gt; </code></pre> <p>Could someone have a crack at converting this to jQuery please, i have DIV's with class "features" and i need the P text to fill them when they are resized, so i need to font-size to grow/shrink along with the DIV. That make sense?</p> <p>Thanks</p>
javascript jquery
[3, 5]
2,795,336
2,795,337
How to enable a linkbutton server control using javascript?
<p>I have a linkbutton server control in my page whose Enabled attribute is initially set to "false". When a text box's text changes I would like to enable the linkbutton. I tried the following but it does not work. Could you let me know if i am missing something.</p> <pre><code>function TextBox_TextChanged() { var control = $get("&lt;%= linkButtonSave.ClientID%&gt;"); if(control != null) control.enabled = true; } </code></pre> <p>Thanks</p>
asp.net javascript
[9, 3]
1,288,833
1,288,834
Installing Python Imaging Library on my iPhone's Python interpreter
<p>I've been learning python for some time now. Recently I needed to install in my Mac the Image module for Python, and after a while I achieve this running a mpkg installer specially for my OS, so far everything was ok and I could run my script. </p> <p>Now I'm in the needing of running my script in my jailbroken iPhone, which already has a python interpreter, and I need to install this Image module again but this time on my phone. </p> <p>Is there another way to do it? How can I do it manually?</p>
iphone python
[8, 7]
5,597,788
5,597,789
What is the equivalent to python equivalent to using Class.getResource()
<p>In java if I want to read a file that contains resource data for my algorithms how do I do it so the path is correctly referenced.</p> <p>Clarification I am trying to understand how in the Python world one packages data along with code in a module.</p> <p>For example I might be writing some code that looks at a string and tries to classify the language the text is written in. For this to work I need to have a file that contains data about language models.</p> <p>So when my code is called I would like to load a file (or files) that is packaged along with the module. I am not clear on how I should do that in Python.</p> <p>TIA.</p>
java python
[1, 7]
3,047,745
3,047,746
Write to database in sdcard platform 1.5 and 2.1 (PROBLEM)
<p>Anyone of you have any idea that is there any different on writting to database to sdcard in android 1.5 and 2.1? I faced a problem here. </p> <p>I have a android apad which firmware is 1.5. I have write a program to write to database at sdcard. However no database was created in this firmware 1.5.</p> <p>Then I proceed on to test on emulator. Using platform 1.5, <strong>no</strong> database created, but when using plathform 2.1, there <strong>is</strong> database created with the information inside.</p> <p>I have given the permisson to write to sdcard and database. by using the following permission:</p> <p><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES"/&gt;</code></p> <p>The method to create database to sdcard is:</p> <p><code> testInputDB = this.openOrCreateDatabase("/sdcard/database/testInputDB.db", MODE_PRIVATE, null);<br> /* Create a Table in the Database. */<br> testInputDB.execSQL("CREATE TABLE IF NOT EXISTS "<br> + TableName<br> + " (Field1 VARCHAR, Field2 VARCHAR);"); </code></p>
java android
[1, 4]
1,906,128
1,906,129
How to do a Masked label?
<p>I need to perform a mask on a label , How Can I do that ? </p> <p>I've tried to use RadMaskedTextbox but the problem is that if I disable that control the text is Gray And I need it to be red</p>
c# asp.net
[0, 9]
4,607,724
4,607,725
Link C# SqlCommand to the SelectCommand of SqlDataSource on aspx page
<p>Since I want to include a session variable in MySql <code>select</code> statement, I want to be able to write a <code>sql</code> string <code>select</code> statement in <code>.cs</code> page and reference it in the <code>SelectCommand</code> property in the <code>SqlDataSource</code> on the <code>.aspx</code> page. </p> <p>How do I achieve that?</p>
c# asp.net
[0, 9]
2,596,920
2,596,921
Jquery text animation
<p>I am looking everywhere for a free version(or similar plugin) of the following jquery text animator, but I can't find any. There are so many free snippets of great jquery plugins, why can't I find any for a text animator like this one? <a href="http://codecanyon.net/item/textfx-a-jquery-text-animation-tool/full_screen_preview/309565?ref=lvraa" rel="nofollow">http://codecanyon.net/item/textfx-a-jquery-text-animation-tool/full_screen_preview/309565?ref=lvraa</a></p> <p>I really did a lot of research, an this one is the closest to my need. I just want an unobtrusive text animator for text content on my web page that should draw the attention of the viewer.</p> <p>Thank You</p>
javascript jquery
[3, 5]
2,106,759
2,106,760
Setting user control to listen for updates in underlying class library
<p>OK, so I have a user control which uses values from an underlying business logic class. I need some way for the user control to listen to the class and fire when certain methods are called / values are updated on the BL class.</p> <p>At a high level, what would be the best way to do this? I know I'd need some form of event in the BL class with a listener in my user control but just wondering the best way to go about it if anyone has any suggestions??</p>
c# asp.net
[0, 9]
4,796,392
4,796,393
Looking for some sort of pattern
<p>I have a library project which contains an abstract class, let's say <code>ClassA</code>. In the project that uses that library project, I have <code>ClassB</code> that extends <code>ClassA</code>.</p> <p>Now here's my problem. In the library project I want to use an instance of the implemented <code>ClassB</code>, but I have no idea how to retrieve that instance. Is there any pattern or other ideas for this?</p> <p><a href="http://s3.amazonaws.com/twitpic/photos/full/326584019.png?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&amp;Expires=1308603198&amp;Signature=N4yDX66sr7fDCGDaHXmY/MXBcmY=" rel="nofollow">Here's</a> a simple diagram of the situation.</p> <p><strong>Edit</strong></p> <p>The reason I'm asking is that I'm creating multiple applications, which only have different methods in <code>ClassB</code>. Therefore I'm creating a library that all of these applications can use, only having to extend <code>ClassA</code>. These applications are separate projects, using the library.</p>
java android
[1, 4]
1,928,439
1,928,440
Fading colors with jquery?
<p>I have a regular color change using jquery, but I'd like to have it so it has a smooth color change. At the moment, the code changes the color of a link on hover and then removes it when the mouse is removes. I have seen one tutorial but it doesn't explain it and it does not look like my current code. This is what it looks like at the moment:</p> <pre><code>$(document).ready(function() { $("#link1,#link2,#link3").hover(function() { $(this).addClass("red"); },function(){ $(this).removeClass("red"); }); }); </code></pre> <p>Thanks in advance</p>
javascript jquery
[3, 5]
1,813,517
1,813,518
Bad C++ programmer behaviors in C#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2424807/most-common-or-vicious-mistakes-in-c-development-for-experienced-c-programmers">Most common or vicious mistakes in C# development for experienced C++ programmers</a> </p> </blockquote> <p>I'm a long time C++ programmer about to start working on C# projects.</p> <p>What are some conceptual changes to be aware of, and most importantly, what should I avoid doing in C# that I would normally do in C++? What bad habits do C++ programmers bring to C# that they should lose?</p> <p>I have a list of C# books I intend to read. I'd like to augment that with experiences from other programmers that have made this same transition because I'll probably tend to make the same errors they did; I'd like to prevent that before it happens.</p>
c# c++
[0, 6]
3,831,978
3,831,979
jQuery, new line and enter button
<p>I'm using following code for textarea:</p> <pre><code>$('#ajaxSendMessage').live('keyup', function(event) { if (event.keyCode == 13) { controller.sendMessage($(this).val(), $("#ajaxAnswerTo").val()); } }); </code></pre> <p>This code works, but <code>$("#ajaxAnswerTo").val()</code> have new line characte when I click enter... For example: I entered: helo world and then moved cursor to helo world, updated it to hello and clicked enter. The result code will be: hell\no world.</p> <p>How to remove this \n?</p>
javascript jquery
[3, 5]
1,286,656
1,286,657
Can't find folder or file created with Android App with windows file exlorer
<p>I'm creating a directory and a text file on the sdcard in one of my apps because I want to be able to move it to my computer for analysis. But I can't find the folder or the file I'm creating on my sdcard using the file browser on my computer. I CAN find and read the file using my phones file manager but not using the file browser in windows. So the file and folder are succesfully created and I can write to the file, I can also find and read the file using the file manager on my phone but I can't find either directory or file using my computer.</p> <p>I have a uses permission for the application to allow it to write to external storage.</p> <p>This is the code I use to create the file and directory.</p> <pre><code>String fileName = "testFil.txt"; String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/PulsApp"; File appDirectory = new File(path); appDirectory.mkdirs(); File file = new File(path, fileName); try { file.createNewFile(); } catch (IOException e) { } </code></pre> <p>Does anyone know what the problem is and how to fix it? I really need to be able to write files to my sdcard so I can transfer them to my computer.</p> <p>I am completely baffled by this problem since all the research I've done point to that everyone else is doing the same thing.</p>
java android
[1, 4]
4,479,831
4,479,832
How to use a while loop to build a stringarray and use it as a list
<p>I am writing an app for fellow students, and I am parsing information from a website. I paid a guy to write the parser but did a poor job and he wants more money to help anymore. So im trying to fix it myself.</p> <p>There is the extractor that grabs the xml info, how the gentlemen had it, was he called it in the main.java like this.</p> <pre><code> Content1 = extractor.BusRoutes.get(1); Content2 = extractor.BusRoutes.get(2); Content3 = extractor.BusRoutes.get(3); </code></pre> <p>But there is 30+ buses, and to me, that is not a solid idea. So I tried to do a while loop and an array in order to build the list and make it a list in android. </p> <pre><code> public class BusRoutes extends ListActivity { TransitXMLExtractor extractor; public String[] busroutearray() { extractor = new TransitXMLExtractor(); String[] busroutearray = new String[40]; int n = 0; while(n != (busroutearray.length - 1)){ busroutearray[n] = extractor.BusRoutes.get(n); n++; } return busroutearray; } /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, busroutearray())); getListView().setTextFilterEnabled(true); } </code></pre> <p>bus when i launch it, i always get a forced quit.</p> <p>edit, the n++ was there before, but got deleted while changing up the code, but with the n++ it still has same effect. </p>
java android
[1, 4]
4,534,492
4,534,493
Why is jQuery .live() not working with my .ajaxForm() invocation here?
<p>I have some code that looks like the following:</p> <pre><code>jQuery("[name='myform']").live('submit', function() { $(this).ajaxForm({ target: '#someform', beforeSerialize: function(form, options) { alert("BeforeSerialize happening."); jQuery('form[name=myform] input[type=submit]').attr('disabled', 'disabled').attr("value", "&lt;%= t('labels.please_wait') %&gt;"); return true; } else { return false; } } return false; }, success: function() { jQuery('#form_quotes_highlights_part').fadeIn('slow'); }, complete: function() { jQuery("#wizard").expose().close(); } }); }); </code></pre> <p>The live() binding seems to work just fine, however the ajaxForm is not working at all. If I do something like:</p> <pre><code> $(document).ready(function() { /* ajax form stuff here */ }); </code></pre> <p>It appears to work just fine. The only problem with that is, when the response comes back from the server, javascript handlers are not attaching themselves to the DOM properly, hence the use of live(). Either way, beforeSerialize is never invoked with the way I'm currently handling my live() handler, so instead of an ajaxForm, I'm having a full page submit.</p> <p>What's the best way to clean this up?</p>
javascript jquery
[3, 5]
3,607,199
3,607,200
jquery content slider sliding
<p>This is the html part of the sliders navigation:</p> <pre><code>&lt;div id="button"&gt; &lt;a class="button1 active" rel="1" href="#"&gt;&lt;/a&gt; &lt;a class="button2" rel="2" href="#"&gt;&lt;/a&gt; &lt;a class="button3" rel="3" href="#"&gt;&lt;/a&gt; &lt;/div&gt; </code></pre> <p>This is the complete jQuery code for the slider:</p> <pre><code>$(document).ready(function (){ $('#button a').click(function(){ var integer = $(this).attr('rel'); /*----- Width of div mystuff (here 160) ------ */ $('#myslide .cover').animate({left:-160*(parseInt(integer)-1)}) $('#button a').each(function(){ $(this).removeClass('active'); if($(this).hasClass('button'+integer)){ $(this).addClass('active') } }); }); }); </code></pre> <p>i am building a content slider for an assignment on college and I am having trouble following this code.</p> <p>You can find the complete code for this slider <a href="http://www.webdeveloperjuice.com/2010/01/12/lightest-jquery-content-slider-ever-made-380-bytes/" rel="nofollow">here</a>.</p> <p>Our 3 links have rel attributes with values 1,2 and 3. This line of jQuery calculates how much will the slider slide:</p> <pre><code>$('#myslide .cover').animate({left:-160*(parseInt(integer)-1)}) </code></pre> <p>So if the variable integer is 1 it will be <code>-160*(1-1)=0</code> - the slider doesn't move if its 2 the result will be -160 and it will move to the right for 160px. And if its 3 it will move to the right for 320px.</p> <p>How does this code moves the slide to the left? It works if you test the demo on the page, but I don't understand how? Can someone explain it to me please?</p>
javascript jquery
[3, 5]
1,386,082
1,386,083
Inheritance in Jquery Plugin
<p>I'm trying to create a jQuery plugin and having problems with selecting the DOM.</p> <p>for example, when I initialize the plugin (ex. $('#test').customplugin();</p> <pre><code>this.each(function() { // Var var $this = $(this); $this.hide(); var thisOpts = $( this + ' option'); </code></pre> <p>$this.hide(); works as expected, hiding the element #test.</p> <p>however, when I try to get for example the li of #test, nothing seems to work.</p> <p>Can someone help me understand what "this" exactly is, and why "thisOpts" won't target "#test option"?</p> <p>Thanks!</p>
javascript jquery
[3, 5]
682,043
682,044
jQuery scrolling DIV: stop scrolling when DIV reaches footer
<p>I have a <code>#sidebar</code> (which starts below my <code>#header</code> div) and a <code>#footer</code> (around 120px off the bottom of the page).</p> <p>I'm trying to make the sidebar scroll with the content of the page. The code below does this semi-successfully:</p> <pre><code>/* profile sidebar */ #sidebar&gt;div{ width: 300px; margin-top: 10px; } #sidebar.fixed&gt;div{position:fixed;top:0;} #sidebar.fixed_bottom&gt;div{position:fixed;bottom:172px;} jQuery(function ($) { $.fn.scrollBottom = function() { return $(document).height() - this.scrollTop() - this.height(); }; var el = $('#sidebar'), pos = el.position().top; $(window).scroll(function() { if ($(this).scrollTop() &gt;= pos) { if ( $(this).scrollBottom() &lt;= 172 ) { el.removeClass('fixed'); el.addClass('fixed_bottom'); } else { el.removeClass('fixed_bottom'); el.addClass('fixed'); } } else { el.removeClass('fixed'); } }); }); </code></pre> <p>The problem is, on smaller resolutions, this makes the sidebar "jump" once you reach a certain position on the page. It stops it from overlapping the footer (which is the problem if you remove the <code>fixed_bottom</code> class) but doesn't look good.</p> <p>What I'd like to do is this: user scrolls to the bottom of the page, the sidebar scrolls along with the content until it reaches say 20px above the top of my footer, at which point it stays there until the user scrolls back up.</p> <p>Thanks in advance,</p>
javascript jquery
[3, 5]
4,946,099
4,946,100
Chaining multiple asynchronous methods in javascript
<p>I am writing a javascript library to abstract ajax requests to my HTTP API. Each of my javascript functions is a wrapper for jquery's ajax call, which makes a callback to the user on completion.</p> <p>Eg.</p> <pre><code>mylib.doThing( "foo", { success:function(){alert("done");}); </code></pre> <p>In the case where I want to execute mylib.doFoo twice in series, I have something like:</p> <pre><code>mylib.doThing( "foo", { success:function(){ mylib.doThing( "bar", { success:function(){alert("done");}); }); </code></pre> <p>For anything more that two steps, this gets messy very quickly.</p> <p>Is it possible to provide a cleaner syntax, perhaps more like the following? And how would I need to implement <code>mylib.doThing()</code>?</p> <pre><code>mylib.doThing("foo").mylib.doThing("bar").alert("done"); </code></pre>
javascript jquery
[3, 5]
3,776,075
3,776,076
jquery.windows-engine - problem trying open a window from a another window
<p>When I try to open window from a another window it not found.</p> <p>jQuery-Windows-Engine-Plugin</p> <p>Thanks!</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;link type="text/css" rel="stylesheet" href="jquery.windows-engine.css" /&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery.windows-engine.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#menu").newWindow({ windowTitle:"menu", content: "&lt;ahref='#' id='example2' &gt;Example 2&lt;/a&gt; Here", width:160,height:230,posx:10,posy:120, }); $("#example2").newWindow({ windowTitle:"Example1", content: "example2", posx:200,posy:100, resizeable:false, maximizeButton:false, }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div&gt; &lt;ahref="#" id="menu" &gt;menu&lt;/a&gt;&lt;br/&gt; &lt;ahref="#" id="example2" &gt;Example 2&lt;/a&gt;&lt;br/&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
5,167,270
5,167,271
How to get date between start date and end date? (excluding date on weekend)
<p>Hi want to get a date list between start date and end date. For example start date is 27-08-2010 and end date is 31-08-2010. So the date list is 27-08-2010,30-08-2010 and 31-08-2010. 29-08-2010 and 30-08-2010 will be ignore because it is in the weekend. I attach the picture for more clearer explanation. How to achieve this using javascript or jquery? I only want to get the list of date, for the business day calculation already done.</p> <p><img src="http://i.stack.imgur.com/vpZrS.jpg" alt="alt text"></p>
javascript jquery
[3, 5]
3,834,887
3,834,888
jquery - get position problem in Firefox
<p>I have the following code which gets the left and top position of the element you are hovered over. It produces the right results in safari and IE but fails to get the position of the img that you hover over in Firefox - it returns 0, 0. Can anyone see why this might be??</p> <p>I think it might be something to do with setting it as the variable as it seems to work if I place it straight in the function. I need to set it as a variable though so it can return to its original state.</p> <pre><code>$.fn.hoverAnimationTwo = function () { return $(this).each(function () { var originalLeftTwo = parseInt($(this).css("left")); var originalTopTwo = parseInt($(this).css("top")); return $(this).hover(function () { $(this).animate({ width: "17px", height: "17px", left: originalLeftTwo - 5, top: originalTopTwo - 5 }, 100); },function () { $(this).animate({ width: "7px", height: "7px", left: originalLeftTwo, top: originalTopTwo }, 100); }); }); } $(".myImg").hoverAnimationTwo(); </code></pre> <p>The other thing which is very odd is that I can copy all of my code into jsfiddle and it seems to work.</p> <p>EDIT: OK... so it turns out this isn't a javascript issue as such. It is because elsewhere in the page I had given an element a class beginning with a numeric character which is entirely my bad and I should know better!</p>
javascript jquery
[3, 5]
3,870,784
3,870,785
Javascript - perform something in certain intervals in FOR LOOP
<p>I got a problem while developing javascript based idea..</p> <p>Here's the main code, </p> <pre><code> $.post("datainlines.php", function(data) { var lines = data.split("\n"); for (var i = 1; i &lt; lines.length; i++) { sitename= lines[i]; sitetype=lines[i++]; if(i/2 == '0'){ alert current values in sitename and sitetype variables} } } ); </code></pre> <p>This will get data in datainlines.php via POST, datainlines.php file data structure is like this - </p> <pre><code>Google search Stackoverflow Questions Yahoo search Facebook social network </code></pre> <p>How to get site name and type in groups, like </p> <pre><code>Google search </code></pre> <p>then</p> <pre><code>Stackoverflow questions </code></pre> <p>is there anyway to group out and alert per every two loops in for loop ?</p>
php javascript
[2, 3]
5,780,740
5,780,741
I need pass by reference please
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a> </p> </blockquote> <p>As I understand it, in Java there is no pass by reference, always pass by value. Does this mean that an object passed as an argument will be copied, everytime? Or is this some sort of pass by value but Java isn't so stupid that it copies the entire object?</p> <p>I'm working on a fairly dense OpenGL project on Android. And the object holding all the scene data is not exactly small in size. That object is passed down from one function to another. So basically, if Java has no pass by reference it will be many copies of a big object.</p>
java android
[1, 4]
2,005,231
2,005,232
New Intent wont start first time
<p>I have 3 intents A->B->C</p> <p>from C to get back to A you bring up the menu and click home. This finishes B and C and opens A which in the manifest is set as a singletask.</p> <p>This all works perfectly, but when I try to open B from A again I have to click twice on the button that starts B. Whereas when the app first opens I have to click only the once to open B</p> <p>Why could this be like this?</p> <p>I think I know why. I think B is not finishing when I go from C to A. This is the code running on C</p> <pre><code> Intent Intent = new Intent(this, com.home.test.Home.class); this.setResult(1, Intent); startActivity(Intent); this.finish(); </code></pre> <p>And it should trigger this on B if I am correct</p> <pre><code> public void onActivityResult(int requestCode, int resultCode, Intent data) { this.finish(); } </code></pre>
java android
[1, 4]
2,741,780
2,741,781
Filling asp controls using Client Side C#
<p>It's been a long time since I've used classic asp.net and asp: controls.</p> <p>I have this textbox;</p> <pre><code>&lt;asp:TextBox ID="txtTitle" runat="server" CssClass="fieldLge" Text='&lt;%= this.Title %&gt;'/&gt; </code></pre> <p>In my cs I have;</p> <pre><code> public string Title { get; set; } </code></pre> <p>The property is being set from a presenter.</p> <p>However when I see my field on screen I see "&lt;%= this.Title %>" as it's text and not the value of the property.</p> <p>I know this is a mind numbingly silly question to ask but I can't figure it out. Love MVC!</p>
c# asp.net
[0, 9]
1,260,181
1,260,182
Android program writes to emulator but not phone
<p>I am trying to write an Android program to accept input and then write the data to a file on the internal storage of my phone. When I execute my program on the emulator it makes a file just as I expect it to, but when I try and execute it on my phone the file doesn't seem to be created. I've looked around on this site and I can't seem to find a solution to my problem anywhere (a few similar ones, but nothing that worked for me) I was hoping you guys might be able to offer me advice on what I'm doing wrong.</p> <pre><code>FileOutputStream fos = null; String x = "Sample String"; try{ fos = openFileOutput("answers.txt", MODE_PRIVATE); fos.write(x.getBytes()); } catch (IOException e) { e.printStackTrace(); } try { fos.close(); } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>On the emulator, I can find the file in DDMS at "data/data/com.example.helloandroid/files/answers.txt". On the phone, if I try to open up the data folder in DDMS it shows it is an empty directory. I have already added in this line to my manifest:</p> <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>I cannot seem to think of anything else that I could be doing wrong. Thanks in advance for the help, it is appreciated.</p>
java android
[1, 4]
380,669
380,670
LostFocus on text box event in asp
<p>Hi I am currently developing a web app in ASP.net. I am creating a registration form where when the user enter a username they would like to use it performs a check on the database to see if the username already exists. I don't want this to be done in the text changed event because I don't want it to try and query the database each time a character is entered into the text box. When I want to do is when that text boxes loses focus, either by tapping to the next field or clicking on another field it then checks the database for the username. If the username already exits then a message like a tooltip is placed to the side of the field. </p> <p>How can I perform this action when the text box loses focus. </p>
c# asp.net
[0, 9]
5,173,744
5,173,745
Jquery menu for asp.net
<p>I need to find a jquery menu which opens each node only on mouse click. If it supports asp.net it will more helpful.</p> <p>Thanks in advance</p>
jquery asp.net
[5, 9]
5,156,101
5,156,102
Add content to JQuery node set
<p>I have a HTML string that I convert to a JQuery node set:</p> <pre><code>var html = "&lt;div id='foo'&gt;&lt;div id='bar'&gt;&lt;/div&gt;&lt;/div&gt;"; var nodes = $(html); </code></pre> <p>I want to add the content <code>&lt;div id="baz"&gt;&lt;/div&gt;</code> immediately after <code>&lt;div id='bar'&gt;&lt;/div&gt;</code>. I tried using:</p> <pre><code>nodes.find('#bar').prepend('&lt;div id="baz"&gt;&lt;/div&gt;'); </code></pre> <p>But this yields the result:</p> <pre><code>&lt;div id="foo"&gt; &lt;div id="bar"&gt; &lt;div id="baz"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div </code></pre> <p>But what I want is:</p> <pre><code>&lt;div id="foo"&gt; &lt;div id="bar"&gt;&lt;/div&gt; &lt;div id="baz"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
4,051,642
4,051,643
Hide div if timeout occurs?
<p>While developing an app in HTML and jQuery, I have a loading screen that covers the entire page, then fades out when the content has loaded, as shown below:</p> <pre><code>google.maps.event.addListenerOnce(map, 'tilesloaded', function(){ $(".loading").delay(2600).fadeOut({ useTranslate3d: true, }); }); </code></pre> <p>(If anyone's wondering why there's a delay on the fade, it's so that's there's a little bit of buffer time between the loading action and fading out)</p> <p>What I'm trying to accomplish is that when the div doesn't fade out after a certain number of seconds, say a minute (or recommend a better time), then the div fades out and an error message occurs, saying the resources failed to load.</p>
javascript jquery
[3, 5]
869,140
869,141
Shuffle an array of images
<p>I have an array of images that I want to display in a random order, 1 image at a time. I think a solution would be to shuffle the array when someone visits the page and then use an onclick event to call each image. When all of the images have been called, the array would either loop or, ideally, re-shuffle. How can I do this?</p>
php javascript
[2, 3]
3,270,533
3,270,534
Is this javascript syntactically correct or is there a better way?
<p>Basically if a variable isn't set then set it to another value.</p> <p>There must be a better way, this looks so messy.</p> <pre><code> if ($image_src === undefined) { $image_src = $apple_icon; } if ($image_src === undefined) { $image_src = $apple_icon2; } if ($image_src === undefined) { $image_src = $item_prop_image; } if ($image_src === undefined) { $image_src = $image_first; } </code></pre>
javascript jquery
[3, 5]
1,052,487
1,052,488
Trigger copy event in jQuery?
<p>Is it possible to trigger copy event from JavaScript/jQuery? I want to simulate copy event by clicking on the button and can't find the way to do that. I don't want to use ZeroClipboard and any other Flash.</p>
javascript jquery
[3, 5]
4,800,277
4,800,278
How to play animated gif in android jdk besides extract into static images?
<p>Is there a way to play animated gif directly in android jdk now?</p>
java android
[1, 4]
2,549,330
2,549,331
How to use Android to upload file to server with a key?
<p>I have a server written by Django, and now I have a demand to upload file to this server. I used to do it on iPhone using ASIHttpRequest, the method is pretty straightforward:</p> <p>[request setFile:self.latestFilePath forKey:@"IPHONEFILE"];</p> <p>However, after I switched to Android, I tried to look for similar method without any luck.</p> <p>I am aware of two methods to send data to server, one is BasicNameValuePair with key-value pair, which is not suitable for my program since the file is huge. Another method is InputStreamEntity, but I don't know how to add a key to it.</p> <p>Any hint or suggestion would be appreciated!</p>
java android
[1, 4]
1,087,697
1,087,698
How to delete the specific row from gridview.Using builtin delete command button of gridview
<p>hi i am adding data from textboxes to my gridview locally not from database. its like a salepage where a salesman is saling a product. now i want to delete a row from that gridview but i always got exception while deleting. kindly help me with that. here is my code where i m getting the data and storing that in gridview. thanks.</p> <pre><code>DataTable dt1 = new DataTable(); protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { gridVIEWData(); GridView1.DataSource = dt1; GridView1.DataBind(); } private void gridVIEWData() { dt1.Columns.Add("pName", typeof(string)); dt1.Columns.Add("pCategory", typeof(string)); dt1.Columns.Add("price", typeof(string)); dt1.Columns.Add("pQuantity", typeof(string)); dt1.Columns.Add("totalPrice", typeof(string)); Session["dtInSession"] = dt1; //Saving Datatable To Session } protected void Button3_Click(object sender, EventArgs e) { if (Session["dtInSession"] != null) dt1 = (DataTable)Session["dtInSession"]; //Getting datatable from session Int32 total = Convert.ToInt32(txt_quantity.Text) * Convert.ToInt32(txt_price.Text); DataRow dr = dt1.NewRow(); dr["pName"] = DropDownList2.SelectedItem; dr["pCategory"] = DropDownList1.SelectedItem; dr["price"] = txt_price.Text; dr["pQuantity"] = txt_quantity.Text; dr["totalPrice"] = total; dt1.Rows.Add(dr); Session["dtInSession"] = dt1; //Saving Datatable To Session GridView1.DataSource = dt1; GridView1.DataBind(); } protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // string value = GridView1.DataKeys[e.RowIndex].Values["price"].ToString(); //GridView1.DeleteRow(Convert.ToInt32(value)); //GridView1.DeleteRow(GridView1.SelectedIndex); // dt1.Rows.RemoveAt(GridView1.SelectedIndex); Int32 index = GridView1.SelectedIndex; GridView1.DeleteRow(index); } </code></pre>
c# asp.net
[0, 9]
4,244,843
4,244,844
Find what all amongst a bunch of integers exist in a sorted array
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1885557/simplest-code-for-array-intersection-in-javascript">Simplest code for array intersection in javascript</a> </p> </blockquote> <p>I have a sorted array of integers in javascript. I need to find out which all amongst a bunch of integers exists in that sorted array. What would be the fastest way to do that? </p> <p><em>I use jQuery, but it seems that it provides no built in support for binary search for sorted arrays but just <code>jQuery.inArray()</code>(not sure what algo it implements).</em> </p>
javascript jquery
[3, 5]
4,657,910
4,657,911
jQuery slide down toggle, impossible?
<p>I want to do a slide down with jQuery, but I can't find it anywhere. </p> <p>I do <strong>not</strong> want it to <a href="http://api.jquery.com/slideDown/" rel="nofollow">scale as it slides</a><br> I do want it to perform <a href="http://see.weareinto.com/3tyP" rel="nofollow">this action</a> ( click slide ), but vertically down, not horizontally right.</p> <p>UPDATE :</p> <p>So here's the final functional code!</p> <pre><code>$(this).toggle( "slide", { direction: 'up', duration: 'slow', easing: 'easeOutQuart' } ); </code></pre>
javascript jquery
[3, 5]
4,511,511
4,511,512
ASP.NET prevent bot/spam attack from a comment form
<p>I have a simple contact us / comment from in my website and this form will send email containing the comments, etc after it is submitted. I have used NoBot control from ajaxcontrol toolkit for several times but it seems that this control did not prevent the spam/bot attack 100%. </p> <p>The client insist that this form should not have any capcha code or something that users have to insert in the form. So what is the best way to handle the spam/bot attack for my current case. </p> <p>Thanks.</p>
c# asp.net
[0, 9]
5,671,124
5,671,125
Is there a native Javascript implementation of jQuery's document.ready()?
<pre><code> $(document).onload() </code></pre> <p>it's internally implemented by window.onload event</p> <p>then what about </p> <pre><code> $(document).ready() </code></pre> <p>what's the native javascript to implement it?</p>
javascript jquery
[3, 5]
3,501,334
3,501,335
Where to store a contact list on an Android phone?
<p>I want to create a new contact list just like blacklist to store few phone numbers in android. which storage medium we need to use ??</p>
java android
[1, 4]
598,654
598,655
Using Android source code
<p>I am developing one application for that I made some changes in CallCard.java class of Phone application. You can find this class here <code>&lt;http://www.netmite.com/android/mydroid/packages/apps/Phone/src/com/android/phone/CallCard.java&gt;</code>. In the above class there are some cases. i.e BUSY, NUMBER_UNREACHABLE and POWER_OFF etc. In the case of POWER_OFF I called a method of a below class.</p> <pre><code>public class MyClass extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); System.out.println("**inside myclass"); } public void powerOff(Context c){ System.out.println("**inside powerOff"); Intent call = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:+5555")); startActivity(call); } } </code></pre> <p>This is my own class and added into source directory Phone application. The code is like this:</p> <pre><code>case POWER_OFF: resID = R.string.callFailed_powerOff; MyClass myClass = new MyClass(); if(myClass != null){ System.out.println("**not null"); myClass.powerOff(getContext); } break; </code></pre> <p>The reason to do this is, I want to Call other number of same person when first-dialed number is switched_off(currentl hard-coded number). I think this is only one way to this.!! Finaly I started build the code but got some error. i.e 'Cannot find symbol'</p> <pre><code>Symbol: variable getContext Location: com.android.phone. myClass.powerOff(getContext); ^ </code></pre> <p>Is my way correct? and why this error. plz help me</p>
java android
[1, 4]
4,333,044
4,333,045
migrate jQuery old code to 1.9 version
<p>I have a jQuery code about ajaxform written in a old version (1.4 i think) it work fine but i want to rewrite it in newer version (1.9) without including jquery-migrate, what shold i change in this code, help me please</p> <pre><code>&lt;script&gt; // prepare the form when the DOM is ready $(document).ready(function() { var options = { target: '#targetDiv', beforeSubmit: showRequest, success: showResponse }; // bind form using 'ajaxForm' $('#countyForm').ajaxForm(options); }); // pre-submit callback function showRequest(formData, jqForm) { var extra = [ { name: 'ajax', value: '1' }]; $.merge( formData, extra) return true; } // post-submit callback function showResponse(responseText, statusText) { } $("#loading img").ajaxStart(function(){ $(this).show(); }).ajaxStop(function(){ $(this).hide(); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
709,026
709,027
Pass Info to form input when link is clicked
<p>I have some html that looks as so: </p> <pre><code>&lt;h3 class="basic left-top-border-radius"&gt;Basic&lt;br /&gt; 500&lt;span&gt;$25&lt;/span&gt;&lt;/h3&gt; &lt;a class="signup colorbox" href="#text-signup-form"&gt;More Info&lt;/a&gt; </code></pre> <p>When More Info is clicked a lightbox pops up with a simple info request form. Here is my problem. I would like when the link is clicked to have the text of the h3 header passed to a form input field that is hidden so I know which plan they clicked on for more info.</p> <p>The input looks like so: </p> <pre><code>&lt;input type="text" class="cat_textbox" id="CAT_Custom_440761" name="CAT_Custom_440761" maxlength="1024" /&gt; </code></pre> <p>How would I do this using jQuery? (I thought of using jQuery <code>.text()</code> method but I read that does not work with forms and I do not know how to pass the h3 text anyway. </p> <p><em><strong>NOTE</em></strong> There are multiple <code>h3</code> elements on the page. </p>
javascript jquery
[3, 5]
500,568
500,569
Jquery hasClass for multiple classes
<p>I am having,</p> <pre><code>&lt;tr valign="top"&gt; &lt;th class="chkCol fixed"&gt;..checkbox..&lt;/th&gt; &lt;th class="fixed"&gt;..head..&lt;/th&gt; &lt;/tr&gt; </code></pre> <p>Now in Jquery I am calling a function like,</p> <pre><code>if($(this).hasClass("fixed")){ .... } </code></pre> <p>If I call <code>$(this).hasClass("fixed")</code>, then I need to get only head not checkbox and that is working perfect in Jquery 1.4.2 but now I updated to jquery 1.6.1. Now I am getting checkbox inside if condition.</p> <p>Please Help,</p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
205,842
205,843
writing javascript in ftl file
<p>I have an ftl file which is sending a notification e-mail. I need to change the subject line of these mails. So, far I have managed to change the subject and pass a URL in it. But my requirement is to pass a specific parameter from the URL. Can I write a java scriplet or javascript function inside this file. </p> <p>Here is the snippet of code:</p> <pre><code>&lt;@s.document "${emailDigestBean.containerHtmlUrl}"&gt; &lt;#if u.isHtml()&gt; &lt;h1&gt;${emailDigestBean.localizedText}&lt;/h1&gt; &lt;#if emailDigestBean.briefDesc??&gt; &lt;p id="message"&gt;${emailDigestBean.briefDesc}&lt;/p&gt; &lt;p&gt;Added By Me:${emailDigestBean.containerHtmlUrl}&lt;/p&gt; &lt;/#if&gt; </code></pre> <p>${emailDigestBean.containerHtmlUrl}....contains the URL which I want to parse.</p> <p>Thanks in advance.</p>
java javascript
[1, 3]
4,569,902
4,569,903
Content added by jquery is cleared after pressing submit
<p><a href="http://jsfiddle.net/hvuSM/" rel="nofollow">This</a> is my code which I am currently working on. I have to display the value passed by the user. In here I am displaying only a string which I will modify afterwards. When I click the add button I get some strange code in my <code>alertbox</code>. This is the <a href="http://jsfiddle.net/hvuSM/" rel="nofollow">fiddle</a> which I have made while running fiddle I am getting shell form doesn't validate. May be my code have some problem. Here is the code which I get in my alertbox.</p> <p>In the console I am getting a warning: </p> <p><em>The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.</em></p> <p>Please help me sorting this out. Thanks</p> <p>Dibya</p> <p><strong>Follow up:</strong> I have missed to mention. After clicking <code>Ok</code> button the text disappears in the div. What causes this? How can I prevent?</p>
javascript jquery
[3, 5]
5,810,736
5,810,737
How do I execute a jQuery function on page load if and only if the page is accessed via a specific hyperlink?
<p>I have a simple link, like so:</p> <pre><code>&lt;a href="page2.html"&gt;Go to Page 2&lt;/a&gt; </code></pre> <p>I'd like that, when clicking this Button, it would go to the page and run a jQuery function, like so:</p> <pre><code>$("#object-selector div").hover( function () { $(this).animate({borderTopColor: '#fdcc06', borderRightColor: '#fdcc06', borderBottomColor: '#fdcc06', borderLeftColor: '#fdcc06'}, 200).children().animate({backgroundColor: '#fed944', color: '#351e00'}, 200); }, function () { $(this).animate({borderTopColor: '#FFF', borderRightColor: '#FFF', borderBottomColor: '#FFF', borderLeftColor: '#FFF'}, 200).children().animate({backgroundColor: '#af081f', color: '#FFF'}, 200); } ); </code></pre> <p>But that function shouldn't execute if the Page is navigated to <em>without</em> clicking the link. Is there a way to do it?</p>
javascript jquery
[3, 5]
698,028
698,029
Javascript add a PHP file
<pre> var editing = false; if (document.getElementById && document.createElement) { var butt = document.createElement('BUTTON'); var buttext = document.createTextNode('Ready!'); butt.appendChild(buttext); butt.onclick = saveEdit; } function catchIt(e) { if (editing) return; if (!document.getElementById || !document.createElement) return; if (!e) var obj = window.event.srcElement; else var obj = e.target; while (obj.nodeType != 1) { obj = obj.parentNode; } if (obj.tagName == 'TEXTAREA' || obj.tagName == 'A') return; while (obj.nodeName != 'P' && obj.nodeName != 'HTML') { obj = obj.parentNode; } if (obj.nodeName == 'HTML') return; var x = obj.innerHTML; var y = document.createElement('TEXTAREA'); var z = obj.parentNode; z.insertBefore(y,obj); z.insertBefore(butt,obj); z.removeChild(obj); y.value = x; y.focus(); editing = true; } function saveEdit() { var area = document.getElementsByTagName('TEXTAREA')[0]; var y = document.createElement('P'); var z = area.parentNode; y.innerHTML = area.value; z.insertBefore(y,area); z.removeChild(area); z.removeChild(document.getElementsByTagName('button')[0]); editing = false; } document.onclick = catchIt; </pre> <p>This code is a quick edit and I want to add a PHP script that will UPDATE my database base on the changes on the text.</p>
php javascript
[2, 3]