Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,442,984
5,442,985
Stop js slideshow caching amount of clicks
<p>Does anyone know how to stop this slideshow from 'caching' the amount of clicks through the slides? If I click the arrows 10 times then 10 slides will slide through is there a way to stop this? Or alternatively if you click the opposite arrow for it to cancel the 'cached' clicks from the other?</p> <p><a href="http://www.switchonthecode.com/tutorials/jquery-creating-a-slideshow" rel="nofollow">http://www.switchonthecode.com/tutorials/jquery-creating-a-slideshow</a></p> <p>Thanks!</p>
javascript jquery
[3, 5]
4,776,974
4,776,975
On() and off() - Jquery
<p>Trying to understand Jquery's On() and off() a little better. Not understanding why this is not working. I want to activate and inactivate id TurnON and TurnOff Js.</p> <p><strong>Javascript</strong></p> <pre><code>$(document).ready(function(){ $(document).on("click.turnon","#TurnOn",function() { $(document).off('click.turnon'); alert("Turn Off is now turned off"); }); $(document).on("click.turnoff","#TurnOff",function() { $(document).on('click.turnon'); alert("Turn Off is now turned back on"); }); }); </code></pre> <p><strong>HTML</strong></p> <pre><code>&lt;div id="TurnOn"&gt;Turn Off&lt;/div&gt; &lt;div id="TurnOff"&gt;Turn On&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
791,056
791,057
Database Factory pattern with multiple databases
<p>I'm creating a database factory pattern for an application that should be able to work with SqlServer and Oracle. I've used a similar approach suggested in the following article: </p> <p><a href="http://www.primaryobjects.com/CMS/Article81.aspx" rel="nofollow">http://www.primaryobjects.com/CMS/Article81.aspx</a></p> <p>Now, the problem is that my application communicates with multiple databases on the same server. For ex: I'm running few queries against database DB1 and few queries against DB2, both on SqlServer. Using the above article, I could create an instance of one database. How can I use the same approach to work with multiple databases. Can somebody help me with this? Thanks.</p>
c# asp.net
[0, 9]
3,452,594
3,452,595
Android setting font in text view
<p>Hi I am trying to change the font style of a <code>TextView</code>. I know how to change it, I have done this before I am using the following code.</p> <pre><code>public class Main_Activity extends ListActivity { Typeface myNewFace = Typeface.createFromAsset(getAssets(), "fonts/bediz__.ttf"); private CustomListAdapter adap; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); adap = new CustomListAdapter(this); setListAdapter(adap); } public static class CustomListAdapter extends BaseAdapter implements Filterable { public View getView(final int position, View convertView, ViewGroup parent) { textView.setText(prayers[position]); holder.textLine.setTypeface(myNewFace); } } </code></pre> <p>Some of the code I skipped because there is no need, by the way when I access <code>myNewFace</code> in <code>getView()</code> it ask me to make it <code>static</code>, when I make it <code>static</code> like this</p> <pre><code>static Typeface myNewFace = Typeface.createFromAsset(getAssets(),"fonts/bediz__.ttf"); </code></pre> <p>It gives me the following error</p> <pre><code>Cannot make a static reference to the non-static method getAssets() from the type ContextWrapper </code></pre> <p>I dont know what to do, I have done this work several times before but now I dont know why it is not working.</p>
java android
[1, 4]
5,472,843
5,472,844
Passing a textbox value to javascript on key up function
<p>Here i have passed the text control to the java script function but i just want to pass the value of the text box to the java script function instead on onkeyup. </p> <pre><code>function Changed(textControl) { var _txtEmpName = document.getElementById('&lt;%=txtEmpName.ClientID%&gt;'); var _EnteredString = _txtEmpName.value; &lt;asp:TextBox ID="txtEmpName" runat="server" onkeyup="javascript: Changed( this );"&gt;&lt;/asp:TextBox&gt; </code></pre>
javascript asp.net
[3, 9]
2,015,169
2,015,170
Toast can't be used in new runnable?
<p>as the title,i was used toast in runnable but there is an error my code:</p> <pre><code>public Runnable backgroud=new Runnable(){ public void run() { // TODO Auto-generated method stub try { while(!Thread.interrupted()) { String msg="this is a test"; Toast.makeText(this, msg, Toast.LENGTH_SHORT).show(); Thread.sleep(1000); } } catch(InterruptedException c) { c.printStackTrace(); } } }; </code></pre>
java android
[1, 4]
412,992
412,993
Passing the hyper-linked element to the hyper-linked page and receiving the element at the hyper-linked page
<p><a href="http://localhost/mypage.php" rel="nofollow">24</a></p> <p>what should i do when i just click on hyper-linked element it just pass the elemet to the hyper-linked page as in above example 24 should pass to <a href="http://localhost/mypage.php" rel="nofollow">http://localhost/mypage.php</a> and how can i receive this 24 in mypage.php </p>
php javascript
[2, 3]
2,472,700
2,472,701
rework table into paragraphs
<p>In my store there many items have different options like size or color. The eCommerce platform allows for these but codes them using tables. I cannot access the source files of the platform so there's nothing I can do on the backend to format these the way I would like. Currently they are formatted like:</p> <pre><code>&lt;div class="attributes"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;Size:&lt;/td&gt; &lt;td&gt;&amp;nbsp;&lt;/td&gt; &lt;td&gt;&lt;select&gt;&lt;option&gt;Select&lt;/option&gt;&lt;/select&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/div&gt; </code></pre> <p>Each option is in its own row so if there were the option to pick the color, there would just be another row in the table with three <code>&lt;td&gt;</code>'s that had the options for the color. Now what I want is instead of these to be listed vertically, I want them listed horizontally. What would be the best way to accomplish this? I should mention JavaScript is my only choice as the platform doesn't allow any asp or php files to be uploaded to the server. I'm hoping there is a relatively easy way to do this. I've tried grabbing the contents of each <code>&lt;td&gt;</code> and storing it and then removing the <code>&lt;table&gt;</code> from the DOM and inserting the contents into <code>&lt;p&gt;</code> tags but that got to be more trouble than it was worth. Any suggestions would be greatly appreciated.</p>
javascript jquery
[3, 5]
3,595,259
3,595,260
add class to all links that link to a certain domain with js (jquery)
<p>If I have a bunch of links like this:</p> <pre><code>&lt;a href="foo.com"&gt;blah&lt;/a&gt; and this &lt;a href="example.com"&gt;one&lt;/a&gt; and here is another &lt;a href="foo.com"&gt;&lt;/a&gt;. </code></pre> <p>How would I add a class to all the links that link to foo.com?</p>
javascript jquery
[3, 5]
5,542,164
5,542,165
Create a class with jQuery/javascript
<p>In a page I create an instance of a <code>class (MyClass)</code>, this class has 2 methods. But I'd like to do 2 things :</p> <ol> <li>In <strong>(1)</strong>, set the value <code>this.message</code></li> <li>In <strong>(2)</strong>, call the information method or another method of the class</li> </ol> <p>Thank,</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { var myClass = new MyClass("MyParam"); $('#Target').click(function (event) { myClass.save("Test"); }); }); &lt;/script&gt; function MyClass(myParam) { this.myParam = myParam; this.isError = false; this.message = ""; } // Define the class methods. MyClass.prototype = { save: function (action) { **(2)** }, information: function (action) { **(1)** } }; </code></pre> <p><strong>Update1</strong></p> <p>When I execute the code below the <code>data</code> value in <code>information</code> is show as <code>undifined</code></p> <pre><code>MyClass.prototype = { click: function (action) { var myData; $.post(....., $("form").serialize(), function (data) { myData = data; }); this.isError = this.information(myData); }, information: function (data) { alert(data); return true; } }; </code></pre>
javascript jquery
[3, 5]
3,982,076
3,982,077
Load jQuery with Javascript and use jQuery
<p>I am appending the jQuery library to the dom using:</p> <pre><code> var script = document.createElement('script'); script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js'; script.type = 'text/javascript'; document.getElementsByTagName('head')[0].appendChild(script); </code></pre> <p>However when I run:</p> <pre><code>jQuery(document).ready(function(){... </code></pre> <p>The console reports the error:</p> <pre><code>Uncaught ReferenceError: jQuery is not defined </code></pre> <p>How do I load jQuery dynamically as well as use it once it is in the dom?</p>
javascript jquery
[3, 5]
2,272,079
2,272,080
About simulating Jquery selector method
<p>while typting <code>$("div")</code> there's an array like <code>[&lt;div&gt;1&lt;/div&gt;&lt;div&gt;2&lt;/div&gt;&lt;div&gt;3&lt;/div&gt;]</code> which<br> gets a bunch of method from <code>jQuery.fn</code>,I'm interested in simulating it,but I can't make it "smooth"<br> I refered zepto.js:</p> <pre> zepto.Z = function(dom, selector) { dom = dom || [] dom.__proto__ = arguments.callee.prototype dom.selector = selector || '' return dom } </pre> <p>But since it's not cross-browser,I wrote some snippets as following: </p> <pre><code>var query=function(selector){ return new query.init(selector); }; query.init=function(selector){ var found=document.querySelectorAll(selector); this.length=found.length; for(var i=0,len=this.length;i&lt;len;i++){ this[i]=found[i]; } return this; }; query.init.prototype={ method1:function(){}, method2:function(){} } </code></pre> <p>while typing <code>query("#id")</code>,alough it can manipulate functionally,but it doesn't seem well enough<br> <img src="http://i.stack.imgur.com/c7VaP.png" alt="enter image description here"><br> as you can see,how to write a query function that looks like jQuery?Thanks</p>
javascript jquery
[3, 5]
3,814,714
3,814,715
What good is JSLint if jQuery fails the validation
<p>So I have been exploring different methods to clean up and test my JavaScript. I figured just like any other language one way to get better is to read good code. jQuery is very popular so it must have a certain degree of good coding. </p> <p>So why when I run jQuery through JSLint's validation it gives me this message:</p> <blockquote> <p>Error:</p> <p>Problem at line 18 character 5: Expected an identifier and instead saw 'undefined' (a reserved word).</p> <p>undefined,</p> <p>Problem at line 24 character 27: Missing semicolon.</p> <p>jQuery = window.jQuery = window.$ = function( selector, context ) {</p> <p>Problem at line 24 character 28: Expected an identifier and instead saw '='.</p> <p>jQuery = window.jQuery = window.$ = function( selector, context ) {</p> <p>Problem at line 24 character 28: <strong><em>Stopping, unable to continue. (0% scanned)</em></strong>.</p> </blockquote> <p>This was done using <a href="http://jslint.com/">JSLint</a> and <a href="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js">jquery-1.3.1.js</a></p>
javascript jquery
[3, 5]
6,025,617
6,025,618
Bind a repeater to an object
<p>In my page_load I have called an object and am trying to bind it to a repeater, like so:</p> <pre><code>TestProgram myProgram = new TestProgram("5"); program_list.DataSource = myProgram; program_list.DataBind(); </code></pre> <p>and my repeater looks like</p> <pre><code>&lt;asp:Repeater id="program_list" runat="server"&gt; &lt;ItemTemplate&gt; &lt;%# Eval("status").ToString().Trim() %&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; </code></pre> <p>Any idea why it isn't working?</p>
c# asp.net
[0, 9]
3,736,537
3,736,538
remove classes added by Jquery
<p>I am working on an accordion and Jquery is adding classes, I want to stop jquery to add some classes. how can I do that? Below is the code but Jquery keeps on adding .ui-state-default to some visited elements.</p> <pre><code>if($check.hasClass('.ui-state-default')){ $(this)('.columns &gt; span').removeClass('ui-state-default'); $(this)('.columns &gt; span').addClass('ui-state-active'); }else { $(this)('.columns &gt; span').removeClass('ui-state-active'); $(this)('.columns &gt; span').addClass('ui-state-default'); } </code></pre>
javascript jquery
[3, 5]
1,885,799
1,885,800
Better performance for selecting options by value with jQuery?
<p>I am trying to work out some performance problems with some JavaScript I've been working on for a few days. One of the pieces of the functions is below:</p> <pre><code>var removeAddress = function(pk) { var startTime = new Date(); jQuery('.add_driver select.primary_address:has(option[value=' + pk + ']:selected)').each(function(c, o) { console.log("Shouldn't get here yet..."); showInputs(o); }); console.log('removeAddress1: ', (new Date() - startTime) / 1000); jQuery('.add_driver select.primary_address option[value=' + pk + ']').remove(); console.log('removeAddress2: ', (new Date() - startTime) / 1000); }; </code></pre> <p>This code is quite peppy in Firefox:</p> <pre><code>removeAddress1: 0.004 removeAddress2: 0.023 </code></pre> <p>But in IE8 it is another story:</p> <pre><code>LOG: removeAddress1: 0.203 LOG: removeAddress2: 0.547 </code></pre> <p>The form in question is a 20-person in put form with first name, last name, and 5 address fields. I've also put in a drop down for selecting other addresses already existing in the form (<code>.primary_address</code>). This code is removing an address from the primary address select boxes. </p> <p>I'm trying to nail down why this is taking so long, and the only thing which stands out is the <code>option[value=????]</code> section. This was the most practical way to find the elements in question, so I ran with it. Is there something about these two selectors which is causing IE to lose its lunch?</p>
javascript jquery
[3, 5]
2,692,061
2,692,062
Call JavaScript Function from Code Behind #2
<p>I have one web control (called <code>A</code>) and one web page (Called <code>Default</code>). </p> <p>Is there a way to call a JavaScript function from <code>Default</code> that belongs to <code>A</code> instead of using <code>OnClientClick</code>? </p> <p>I am using the following in <code>Page_Load</code> of <code>Default.aspx.cs</code> (This is where my JavaScript function is coming from): </p> <pre><code>a = (A)LoadControl("~/A.ascx"); a.ID = "AgControl"; panel.Controls.Add(a); </code></pre> <p>In Default.aspx I have the following: </p> <pre><code>&lt;asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_OnClick" OnClientClick="JavaScript()" /&gt; </code></pre> <p>DefaultPage.aspx.cs:</p> <pre><code>protected void Button1_OnClick(object sender, EventArgs e) { String a = getValueofA(); If (a == "1") { //OnClientClick code goes here } else If (a == "2") { //No OnClientClick code goes here } } </code></pre> <p>My goal is to remove <code>OnClientClick="JavaScript()</code> and code it only in the first part of the "if statement". </p>
c# asp.net
[0, 9]
5,419,245
5,419,246
Select first word in a container
<p>maybe this is easy or I overlooked it</p> <p>but if i have:</p> <pre><code>&lt;div class='test'&gt;Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.&lt;/div&gt; </code></pre> <p>how can i select the first word of it? [in this example 'Fusce']</p>
javascript jquery
[3, 5]
5,805,874
5,805,875
How to call multiple js functions on document.ready without putting them jQuery(document).ready(function(){});
<p>Is there a way to 'bind' multiple functions to jQuery's document.ready function without actually calling them in that method. Basically I don't know which functions I might be calling in document.ready until the page is generated.</p>
javascript jquery
[3, 5]
858,170
858,171
validate textbox if empty and if number entered
<pre><code>private void btnsave_Click(object sender, EventArgs e) { if (txtfname.Text == "" ) { MessageBox.Show("Please enter your First Name"); txtfname.Focus(); } } </code></pre> <p>I want to validate a textbox such that a person cannot leave it blank nor can they add numbers. Do I have to write an "else if" statement or is there any operator that I can use to put it all in the same if statement.</p>
c# java
[0, 1]
3,886,074
3,886,075
Getting id from UL when clicking on the button
<p>How to get <code>OptionGroupID</code> and <code>optionName</code> from <code>ul</code> when you click on the Add button?</p> <p>For example:</p> <pre><code>&lt;ul id="formAddOption_4" class="formStyle"&gt; &lt;li&gt; &lt;input id="OptionGroupID" type="hidden" value="4"&gt; &lt;div style="font-size:10px;"&gt; Option Name: &lt;/div&gt; &lt;input id="optionName" type="text"&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="button" class="buttonAddOption" value="Add Option"&gt; &lt;/li&gt; &lt;/ul&gt; &lt;ul id="formAddOption_5" class="formStyle"&gt; &lt;li&gt; &lt;input id="OptionGroupID" type="hidden" value="5"&gt; &lt;div style="font-size:10px;"&gt; Option Name: &lt;/div&gt; &lt;input id="optionName" type="text"&gt; &lt;/li&gt; &lt;li&gt; &lt;input type="button" class="buttonAddOption" value="Add Option"&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I have tried this but it dont work:</p> <pre><code>$(".buttonAddOption").click(function() { var OptionForm = $(this).closest("ul"); //Get Group ID alert( OptionForm.$("#OptionGroupID").val() ); }); </code></pre>
javascript jquery
[3, 5]
5,077,963
5,077,964
Using a common dialog box, but calling different functions from diffrent activities in android
<p>In my app i have to use same dialog box on all the activities but then on to the click of button on dialog box i need to perform different operations for different activities, i have kept a common code for dialog but then how to call different functions, here is my code:</p> <pre><code>final Dialog dialog = new Dialog(mContext,R.style.Theme_Levels); dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); dialog.setContentView(R.layout.custom_alert); TextView title = (TextView)dialog.findViewById(R.id.title); title.setText("Network Error"); TextView msg = (TextView)dialog.findViewById(R.id.msg_txt); msg.setText("The system is down, please check after some time "); ImageView cancel = (ImageView)dialog.findViewById(R.id.cancel); cancel.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { dialog.dismiss(); } }); TextView continue_btn = (TextView)dialog.findViewById(R.id.continue_btn); continue_btn.setBackgroundResource(R.drawable.feedback_button_purple); continue_btn.setText("Retry"); continue_btn.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { //TODO perform different operation depending upon from where this function has been called dialog.dismiss(); } }); dialog.show(); </code></pre>
java android
[1, 4]
4,196,334
4,196,335
Difference between loadUrl and loadData with javascript
<p>I try to load in an Android webview a html page with an ajax post request.</p> <p>When I load the webview with loadUrl, the javascript works fine, but when I try to load with loadData (I need it) I get an error : "<code>NETWORK_ERR: XMLHttpRequest Exception 101</code>". This error sounds like a access control origin problem.</p> <p>The parseJsoup function replace some string in the html page with good strings. I check the data that I pass to loadData and the script part is not alterate.</p> <p>My oncreate function :</p> <pre><code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String html = parseJsoup("index.html"); setContentView(R.layout.main); myBrowser = (WebView)findViewById(R.id.mybrowser); myBrowser.getSettings().setJavaScriptEnabled(true); myBrowser.setWebViewClient(new MyWebViewClient()); //myBrowser.loadUrl("file:///android_asset/index.html"); myBrowser.loadDataWithBaseURL("", html, "text/html", "utf-8", null); } </code></pre> <p>And my javascript code :</p> <pre><code>$.ajaxSetup({ contentType: "application/json; charset=utf-8", datatype: "json", async: false, }); $.ajax({ type: "POST", url: "my url", data: 'my data', success: function(data){ // Do some action here with the data variable that contains the resulting message document.write("OK "+JSON.stringify(data)); console.log(data); }, error: function(data){ document.write("KO "+JSON.stringify(data)); console.log(data); } }); </code></pre> <p>Thanks</p>
javascript android
[3, 4]
674,916
674,917
How insert to javascript to document using jquery?
<p>I have a "badly written" simple banner:</p> <pre><code>... &lt;script&gt; document.write('banner text') &lt;/script&gt; ... </code></pre> <p>How to correct insert this banner to document using javascript ?</p> <p>This code:</p> <pre><code>&lt;div id="id"&gt;&lt;/div&gt; $('#id').html('\x3Cscript&gt;document.write("banner text");\x3C/script&gt;') </code></pre> <p>replace all text in document ...</p>
javascript jquery
[3, 5]
4,082,811
4,082,812
Best practice for testing return value of indexOf
<p>What do you normally write when you're testing for the return value of indexOf?</p> <pre><code>if str.indexOf("a") &lt; 0 </code></pre> <p>vs</p> <pre><code>if str.indexOf("a") == -1 </code></pre> <p>Would one method be preferred over the other?</p> <p>I'm actually posing this question for any function in any language that returns -1 on error.</p> <p>I normally prefer the &lt; 0 approach, because if the function is extended to return -2 on some other case, the code would still work.</p> <p>However, I notice that the == -1 approach is more commonly used. Is there a reason why?</p>
java javascript
[1, 3]
5,385,556
5,385,557
Using jQuery .change() to change values in a <p> element
<p>I have a select element with a few options for currencies, and then a <code>&lt;p&gt;</code> element at the bottom that currently prints the current exchange rate for USD to another currency. What I'm trying to do, is upon <code>.change()</code> of the select element value, I want to insert the value of the select element into a PHP script, and then re-<code>.load()</code> the <code>&lt;p&gt;</code> element.</p> <p>How can I pass a value from jQuery .val() to a PHP script?</p>
php jquery
[2, 5]
2,226,181
2,226,182
Javascript callback and pattern matching help
<p>I am trying to make a simple searcher/highlighter and I am running into difficulties with inconsistent results/nothing happening when I test it out. </p> <p>I think the biggest gap is my understanding of how the callback functions should work and what the selectors are able to match.</p> <p>Ideally when one clicks on the tag, everything should fade out and only the dives with the matching tags in them should reappear. If nothing matches then the nothing found div should appear and the reset should fade veryhtign out and make all the divs (sans nomatch div) reappear unhighlighted.</p> <p>Anyone provide some clarification on where I can improve?</p> <p>Edit: See the link in the comments to see my code.</p> <p>More clarification on problems: Click on a tag (old, photography, guide) and then click on reset. All three parts should reappear but only two do.</p> <p>Randomly The no results found will show up.</p> <p>If you select a tag, then search for a different one, the fade ins and outs will be asynchronous.</p>
javascript jquery
[3, 5]
2,788,304
2,788,305
$(document).width() returns different results depending on when it's called
<p>when calling <code>$(document).width();</code> inside <code>$(window).load(function(){})</code> or <code>$(document).ready(function(){})</code> I get a different result to when I'm calling it from inside <code>$(window).resize(function(){})</code> <br /> the value is about 100px off so it's not because I am resizing the window, any ideas why this is happening? <br /> EDIT:<br /> Browser: Firefox 8.0.1</p>
javascript jquery
[3, 5]
3,840,233
3,840,234
JavaScript code not working IE8
<p>I am trying to make work links which we click to change the language of website using JavaScript. Here is the HTML code:</p> <pre><code>'&lt;form action="" method="post" name="currlang"&gt;'. '&lt;input type="hidden" name="languageval" value="'.$session-&gt;value("language").'"/&gt;'. '&lt;a onclick="langa(this, \'en\');" class="langs'.($session-&gt;value("language")=='en'?" active":"").'" id="en"&gt;&lt;/a&gt;'. '&lt;a onclick="langa(this, \'it\');" class="langs'.($session-&gt;value("language")=='it'?" active":"").'" id="it"&gt;&lt;/a&gt;'. '&lt;a onclick="langa(this, \'pl\');" class="langs'.($session-&gt;value("language")=='pl'?" active":"").'" id="pl"&gt;&lt;/a&gt;'. '&lt;/form&gt;'. </code></pre> <p>and here the javascript:</p> <pre><code>function langa(obj, valu) { document.getElementsByName("languageval")[1].value=valu; document.getElementsByName('currlang')[1].submit(); } </code></pre> <p>The script works fine on new browsers (Firefoxe, Opera, Chrome, IE9) but when testing it on IE8 it gives an error "'document.getElementsByName(...).1' is null or not an object". After some research I found out that getElementsByName() is not supported by IE8 and above and maybe the solution would be to use jQuery and this is where I need help. How can I make this work with jQuery or without it?</p> <p>Thank you so much for your help.</p>
javascript jquery
[3, 5]
3,308,051
3,308,052
Add current slide body class on slide change
<p>I'm using slidesjs to create a slideshow on my site, this is working fine but I want to add a incremented class to the body tag e.g. slide-1 at load and then when the slide changes slide-2 etc until the slide fully rotates and it goes back to slide-1</p> <p>My current code is;</p> <pre><code>&lt;script&gt; $(function(){ $('#feature-slideshow').slides({ preload: true, preloadImage: '&lt;?php bloginfo('template_url'); ?&gt;/images/loading.gif', generateNextPrev: false, effect: 'fade', play: 5000, hoverPause: true, animationStart: function() { $("body").addClass("slide"); } }); }); &lt;/script&gt; </code></pre> <p>I have two problems;</p> <p>1) the I want the initial class set before the slideshow has loaded so that the style which is a background is applied when the page is loaded rather than the slideshow</p> <p>2) How to increment the slide-x class when the slideshow is transitioned/changed.</p> <p>Any help would be greatly appreciated</p>
javascript jquery
[3, 5]
4,656,359
4,656,360
how we can get url using jquery or javascript?
<p>i have url like </p> <p><code>http://www.abc.com/xyz/aaa/bbb/login.php?id=23</code> </p> <p>i want to take upto </p> <p><code>http://www.abc.com/xyz/aaa/bbb</code></p> <p>How we can do this with javascript / jquery?</p>
javascript jquery
[3, 5]
2,415,172
2,415,173
Search content and creating custom selector filters
<p>I want ckack in table if there are row similar (in column "title 1" and "title 3") get this second row ("tr") <code>background-color: red;</code>.</p> <p><img src="http://i.stack.imgur.com/qKJay.jpg" alt="enter image description here"></p> <p>In the this table both rows in column "title 1" and "title 3" have similar content so second row(if it was more of two rows similar all rows except first row get css.) get css <code>background-color: red;</code>, How is it by jQuery?</p>
javascript jquery
[3, 5]
5,351,865
5,351,866
How to store the value?
<p>I want to make the application like below.</p> <p>First there is a page with four radio buttons. The user clicks on any of the radio buttons but doesn't save and he goes to another page. Then if he comes back to same page with the radio buttons it shows the selected radio button before he goes to another page.</p> <p>How can I do it by using jQuery and PHP?</p>
php jquery
[2, 5]
3,718,117
3,718,118
ClassCastException on calling a function from other activity
<p>I have two activites called <code>Activity_A</code> and <code>Activity_B</code>. I have a Method or Function in Activity_A like:</p> <pre><code>public void printNumber (int i) { for(int j = 0; j &lt;= i; j++) { Log.w("TAG", "Print number is: " + j); } } </code></pre> <p>Now I want to call this Method from my another activity called Activity_B.</p> <p>I am trying to call this Method using following lines:</p> <pre><code>((Activity_A) this.getApplicationContext()).printNumber(); </code></pre> <p>I write this line in onCreate of Activity_B and this will crash my application and logcat shows this error:</p> <pre><code>java.lang.ClassCastException: android.app.Application cannot be cast to com.example.app.Activity_A </code></pre> <p>How can I do this?</p> <p><strong>Edit:</strong> I found <a href="http://stackoverflow.com/q/5086446/1250370">this</a> question and acording to "Rich" extends <code>Activity_A</code> to <code>Activity_B</code>. But the problem is <code>Activity_B</code> is a list activity and I have already extends this with <code>ListActivity</code>.</p> <p>and other answer create an instance of <code>Activity_A</code> and then call method. If I do this a all the variable's become empty or null of <code>Activity_A</code>. And I don't want to make a static method.</p> <p>Is there any other way to do this without create a static reference or another instance?</p>
java android
[1, 4]
853,948
853,949
javascript - change the alpha of an image
<p>How can I change the alpha of an image in javascript? Also, what browsers support this?</p>
javascript jquery
[3, 5]
1,563,166
1,563,167
convert a arraylist to string
<p>How can I convert a arraylist to a string?</p>
c# asp.net
[0, 9]
1,791,613
1,791,614
Compare the elements of two arrays by Id and remove the elements from the one array that are not presented in the other
<p>I have two arrays of objects like this:</p> <pre><code>var arr1 = [{Id: 1, Name: "Test1"}, {Id: 2, Name: "Test2"}, {Id: 3, Name: "Test3"}, {Id: 4, Name: "Test4"}] var arr2 = [{Id: 1, Name: "Test1"}, {Id: 3, Name: "Test3"}] </code></pre> <p>I need to compare the elements of the two arrays by <code>Id</code> and remove the elements from <code>arr1</code> that are not presented in <code>arr2</code> ( does not have element with that <code>Id</code>). How can I do this ? </p>
javascript jquery
[3, 5]
257,101
257,102
Forcing sound output through speaker in Android
<p>Is there a way in Android to force output through the phone speaker, even if a headphone is plugged into the jack? I know there has to be a way because when you are talking on the phone, you can put someone on speaker phone, even if there is headphones plugged into the jack. </p>
java android
[1, 4]
4,708,526
4,708,527
How can I implement a push technology using php?
<p>I have a kind of application that must query a db at periodic intervals..I want to use push technology such that when the database is updated, the server sends data to the client..How is it possible to implement that ? </p>
php jquery
[2, 5]
926,914
926,915
How to get interest in programming especially in java and android
<p>I am new in this community. I just completed my Btech in Computer science, I have interest towards programming especially java. I started studying java but i am little bit slow in logic and understanding the concepts. I have some good books of java but when doing the program i am losing my confidence because of the logic issues. I have some doubts</p> <ol> <li>How can i improve my logical and coding skills</li> <li>HOw to get real interest in programming.</li> <li>Is there any shortcut for studying programming</li> </ol> <p>Please provide some suggestions as i knew this forum has lots of good programmers. Please share ur thoughts and how you people improving ur logics. </p> <p>Any help is appreciated</p>
java android
[1, 4]
5,495,407
5,495,408
Can anyone explain this bizarre behavior in jQuery next?
<p>It works:</p> <pre><code>&lt;div class="xpav"&gt; Create &lt;/div&gt; &lt;div class="apr" style="display: none;"&gt; sometext &lt;/div&gt; &lt;script&gt; $('.xpav').click(function() { $(this).next(".apr").slideDown("fast"); }) &lt;/script&gt; </code></pre> <p>It doesn't:</p> <pre><code>&lt;div class="xpav"&gt; Create &lt;/div&gt; &lt;br /&gt; &lt;div class="apr" style="display: none;"&gt; sometext &lt;/div&gt; &lt;script&gt; $('.xpav').click(function() { $(this).next(".apr").slideDown("fast"); }) &lt;/script&gt; </code></pre> <p>Why <br /> breaks it?</p>
javascript jquery
[3, 5]
3,201,560
3,201,561
How I can change the content of my site's page after a couple of minutes?
<p>So, I need to change the data representation after a couple of minutes since user did something (e.g. uploaded an image)</p> <p>What I need is to change some div in page after some time? How I can do it? What to use like a tool? PHP or JavaScript?</p> <p>Thanks, But how does imgur do it after image upload?</p>
php javascript
[2, 3]
4,025,110
4,025,111
image button doesn't work correctly in datalist
<p>i have an image button in datalist to open a new page to send mail, but when i click on it for the first time , it doesn't work , it works when click for the second time , i use update panel inside datalist . here's the code </p> <pre><code>&lt;asp:UpdatePanel ID="up1" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:ImageButton ID="ImgBtnMail" runat="server" ImageUrl="../../../../Icons/Send-Email.jpg" Width="22" Height="18" CommandName="DoMail" CommandArgument='&lt;%#DataBinder.Eval(((System.Web.UI.WebControls.DataListItem)(Container)).DataItem, "AdID")%&gt;' /&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>and the code behind :</p> <pre><code> protected void DLAds_ItemCommand(object source, DataListCommandEventArgs e) { if(e.CommandName=="DoMail") { string TargetPage = "window.open('SendMail.aspx?',null,'height=150, width=150,left=500 ,top=300 ,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');"; ImageButton MailBtn = (ImageButton)e.Item.FindControl("ImgBtnMail"); MailBtn.Attributes.Add("onclick", TargetPage); } } </code></pre>
c# asp.net
[0, 9]
1,220,475
1,220,476
Javascript disable button event completely
<p>Hi I would like to know if its possible to do something similar to the example shown below.</p> <pre><code>// Script A $('.submitButton').click(function() { if (not valid) { $(this).attr("disabled", "disabled"); } }); // Script B $('.submitButton').click(function() { // Do something else here }); </code></pre> <p>I would like to know whether you can actually stop the click event in <strong><em>Script B</em></strong> if not valid in <strong><em>Script A</em></strong>. The reason for the two events being separate is due to the fact that <strong><em>Script A</em></strong> will be used as a sort of a plugin module which will be inserted at the header of the page.</p>
javascript jquery
[3, 5]
903,092
903,093
Worrying about concurrency issues - should I only allow 1 user at the time?
<p>I’m working on an administration tool for a project that does a small amount of reading and writing to different files and some database queries and updates. Now I believe it’s improbable that we would ever have an issue with this since we’re not that many people using this project. But if I can, I want to minimize or eliminate the risk of it ever happening while not disturbing the normal users. I'm using Windows Authentication and Roles. </p> <p>One of my ideas is to create a lock and only allowing 1 user to administer at the time. By using the Session.SessionID and saving it in the Application state as an exclusive lock. E g if a user would want to administer he would first go to a landingpage and there where would be this check (oh, this isn't atomic I take it?):</p> <pre><code>if (Application["lockedBy"] == null) { Application["lockedBy"] = Session.SessionID; Application["lockedName"] = User.Identity.Name; Response.Redirect("Admin.aspx"); } </code></pre> <p>And the admin page there would be a button to release the lock and redirect to another page. Or if the user forgets using the Session_End() in the global.asax file and having an autorefresh. But how would this stop someone from pressing the browsers backbutton and bypassing this?</p> <p>Or should I try to make sure the configuration files haven’t been changed before writing to them? But how would I save the state for this page. Should I like save the files modification time in Session state and if they diff just abort the save action? </p> <p>So the question is: how should I protect my application from concurrency issues while not disturbing the normal users?</p>
c# asp.net
[0, 9]
5,443,289
5,443,290
Can I access and then replace image based on src value?, using jQuery or otherwise
<p>I have a hell CMS to work with and am wondering if i can do the following with jQuery (or just straight up JS)</p> <p>images are being displayed with no ID's or classes and I'd like to replace images based on their src value </p> <p>pseudo code would be something like...</p> <p>find img where src = /img/00789-reg-1.jpg'; and replace src value with ='img/much-better-img.jpg';</p> <p>thanks -</p>
javascript jquery
[3, 5]
1,901,931
1,901,932
How to access electronic device using android?
<p>i need some ideas for accessing door lock device that mean i want control fingerprint door lock device from my android phone so give me some ideas please.</p>
java android
[1, 4]
2,656,875
2,656,876
Calling a JavaScript function onclick event of button when the function is define in a separate PHP file
<p>How do you call a JavaScript function from one PHP file that is defined in another PHP file?</p>
php javascript
[2, 3]
1,165,627
1,165,628
Android FakeCall
<p>How to make fake call functionality in android.Is there any Api provided by Android.Or we need to write any services.Give me some start up.New to Android.</p>
java android
[1, 4]
4,607,172
4,607,173
Jquery focusout on div
<p>I have two divs, one called "mainDesign" and a box called "div1".</p> <p>When "div1" is clicked, focusin is called and the border-color changes.</p> <p>"div1" can only focusout if "mainDesign" is clicked.</p> <p>The script works but "mainDesign" needs to be clicked twice in order for it to work, after it has focused out, the script works perfectly.</p> <p>Any ideas? Code: <a href="http://jsfiddle.net/v3DWf/14/" rel="nofollow">http://jsfiddle.net/v3DWf/14/</a></p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,911,965
4,911,966
Which has better performance? Place holder or new page?
<p>I have a Select option as follows</p> <pre><code>&lt;option value="#" selected=""&gt;Forms&lt;/option&gt; &lt;option value="https://Mysite/erc/Form1.aspx" target="_blank"&gt;Form1&lt;/option&gt; &lt;option value="https://Mysite/erc/Form2.aspx" target="_blank"&gt;Form2&lt;/option&gt;" </code></pre> <p>Now I want add one more option as form 3. But form2 and form 3 are almost identical with some changes.</p> <p>My question is, shall i add one more form as "Form3.aspx" or add a placeholder label to the content on the page(form2.aspx) that will be replaced by appropriate text based on query string parameter? Which has better performance? </p>
c# asp.net
[0, 9]
1,042,308
1,042,309
from C++ to C#
<p>What are good c++ to C# articles/tutorial or books? I am reading <a href="http://msdn.microsoft.com/en-us/magazine/cc301520.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/magazine/cc301520.aspx</a> and will read <a href="http://andymcm.com/csharpfaq.htm" rel="nofollow">http://andymcm.com/csharpfaq.htm</a> and <a href="http://www.ondotnet.com/pub/a/dotnet/2002/02/11/csharp_traps.html" rel="nofollow">http://www.ondotnet.com/pub/a/dotnet/2002/02/11/csharp_traps.html</a> afterwards. Have any of you read any good books for ppl who have a strong understanding of programming &amp;&amp; || C++ on the C# language (and libraries)?</p>
c# c++
[0, 6]
614,924
614,925
How to check if a asp text box is empty or not
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3502354/textbox-empty-check-using-javascript">textbox empty check using javascript</a> </p> </blockquote> <p>I have a asp.net button and a asp.net textbox, when I click on button, I want to check if textbox is empty or not but not sure how I can do that,</p> <pre><code>&lt;div&gt; &lt;asp:TextBox ID="txtEU" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;/div&gt; &lt;div&gt; &lt;asp:ImageButton ID="button" runat="server" OnClientClick="MyFunction(); return false;" ImageUrl="/myfolder/abc.png" /&gt; &lt;/div&gt; </code></pre> <p>in my JavaScript I am doing,</p> <pre><code> &lt;script type="text/javascript"&gt; function doWork() { if($input[] </code></pre> <p><strong>not sure how to check if its empty or not, if its empty then I am doing something if not then it should call a code behind method for that button.</strong></p>
c# javascript asp.net
[0, 3, 9]
1,077,598
1,077,599
Progress dialog + dialog box
<p>I have a webview that has progress dialog showing: </p> <pre><code>public void onLoadResource (WebView view, String url) { if (progressDialog == null) { progressDialog = new ProgressDialog(activity); progressDialog.setMessage("Loading... "); progressDialog.show(); } } </code></pre> <p>The page i'm loading has a button controlled by javascript that has a dialog box: </p> <pre><code>function confirmation() { var answer = confirm("Are You sure?") if (answer) { alert("No information saved!") window.history.go(-2); } else { alert("You may hit save to submit information") } } </code></pre> <p>The issue is when i hit this button, nothing ever happens. If I remove the progress dialog. The button functions very well. I added </p> <pre><code>webview.getSettings().setJavaScriptEnabled(true); </code></pre> <p>But there's no luck at all. Have anyone encountered this? How do I solve it?</p>
javascript android
[3, 4]
1,318,175
1,318,176
Does Javascript/jQuery have an in-built method or plugin to check the values/names of all form data?
<p>When using PHP and I want to find out the data being posted, I simply dump the array <code>$_POST</code> which will provide me with the <code>name=</code> attribute of all html form elements that have been submitted <code>input, select, textarea</code> etc, and their <code>value=</code> attributes in an easy to read manner.</p> <p>I'm wondering if Javascript or the jQuery library has a method/plugin that does the same thing for all html form elements on the page? This would be very useful for testing out client-side validation etc.</p> <p>Any answers would be greatly appreciated, as this would help me save a lot of time debugging!</p>
php javascript jquery
[2, 3, 5]
3,697,239
3,697,240
checking whether data is null
<p>Is it best practice to check whether a value is null coming from a database even though there are constraints on the column which disallow nulls.</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
3,859,766
3,859,767
5 star rating with jquery gives an Unexpected string
<pre><code>$('.star').mouseover(function (){ var star = $(this).index()1; $(this).parent().css("background-position","0 -" (32 * star) "px"); }); $('.star-rating').mouseout(function (){ var originalresult = $(this).attr('id').split('result')[1]; $(this).css("background-position","0 -" (32 * originalresult) "px"); }); </code></pre> <p>Don't get this, rewriting is giving me stars in my eyes, but the problem stands... Don't know anymore what I'm doing wrong?</p>
javascript jquery
[3, 5]
4,605,901
4,605,902
How can I easily manipulate the state of page elements using PHP?
<p>In ASP.NET </p> <ul> <li><p>I can show a hidden panel that contains many controls by using simple command such as:</p> <pre><code>Panel.Visible = CheckBox1.Checked; </code></pre></li> <li><p>I can disable a Button easily:</p> <pre><code>&lt;asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Submit" Enabled="false" /&gt; </code></pre></li> </ul> <p>But now I'm looking at using PHP. Does it offer a similarly simple technique for hiding / disabling page elements?</p>
php asp.net
[2, 9]
5,193,366
5,193,367
how to call a jquery / java script variable acuretly
<p>i have <code>#cross_1 , #cross_2 , #cross_3 , #cross_4</code> and every <code>#cross_id</code> have each <code>#id_green</code></p> <p>not showing any result nor any error... </p> <pre><code>var setId = 2; var defaultTime = 3000; $(document).ready(function () { setLight(setId,defaultTime); }); function setLight(setId,defaultTime) { //deactivateAll(); activeGreen(setId,defaultTime); } function deactivateAll() { $('#cross_1 #id_red').addClass('red'); $('#cross_2 #id_red').addClass('red'); $('#cross_3 #id_red').addClass('red'); $('#cross_4 #id_red').addClass('red'); } function activeGreen(setId,defaultTime) { alert('#cross_'+setId+ '#id_green'); $('#cross_'+setId+ '#id_green').addClass('green'); } function activeYellow() { //$('#cross_'+setId+ ',#id_yellow').addClass('yellow'); } </code></pre>
javascript jquery
[3, 5]
2,574,696
2,574,697
Java Script validation
<p>Am validating a form for empty check.</p> <p>All fields works fine.</p> <p>I have a dropdown when i select some value from dropdown some fields will be disabled. onchanging the dropdown value someother fields will be disabled. </p> <p>Now am struck in validating the fields which are getting disabled and enabled.</p> <pre><code>if((document.form1.varAuctionTime.disabled = false) &amp;&amp; (document.form1.varAuctionTime.value == "")) </code></pre> <p>I used above code but it is enabling the fields.</p> <p>can anybody help me out.</p>
php javascript
[2, 3]
1,384,724
1,384,725
easy way to get the top level domain?
<p>i want to get the domain extention (at least i hope it is called this way) from the site name the user is currently on.</p> <p>so from www.bbc.co.uk it's co.uk and www.google.com = .com <a href="http://stackoverflow.com/questions/ask">http://stackoverflow.com/questions/ask</a> = .com</p> <p>etc.</p> <p>especially the ones with the double name (like co.uk) gives me headaches....</p> <p>EDIT as i understand from the comments, co.uk is not a top level domain? that makes life easier! EDIT new name (top level domain) in the title</p>
c# asp.net
[0, 9]
854,072
854,073
php array to 2d Javascript array
<p>I'm working on passing 2 fields of SQL through php to javascript. I have read many tutorials on how to create a multidimensional javascript array. Where I get confused is how to code from php to javascript. I have seen a couple of tutorials on how to get the php data to javascript, but none on how to do this with 2 dimensions. </p> <p>My first hangup is that if I'm creating a multidimensional array I need to count the number of records in my sql data before I declare the java array right? </p> <p>update:</p> <p>I got the data to JSON format as suggested below. Is there a way for me to get all of the contents printed to the web page so that I can see them and then narrow down what is displayed? </p> <p>update III:</p> <p>code:</p> <pre><code>mysql_connect("localhost", "bikemap", "pedalhard") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $data = mysql_query("SELECT * FROM gpsdata"); $new_row = array(); $new_column = array(); while($info = mysql_fetch_array($data)){ foreach( $info as $row_num =&gt; $row) { $thisItem = $row; $new_row[] = $thisItem; } array_push($new_column = $new_row); } $json = json_encode($new_column); echo $json; ?&gt; </code></pre> <p>Working code:</p> <pre><code> $data = mysql_query("SELECT * FROM gpsdata"); $aData = array(); while($row = mysql_fetch_assoc($data)) $aData[$row['idgpsdata']] = array($row['userID'],$row['date'],$row['lat'], $row['longi'], $row['alt']); $json = json_encode($aData); echo $json; </code></pre>
php javascript
[2, 3]
2,456,950
2,456,951
PHP Session,Loggin Var, and Javascript
<p>I am trying to figure out how to do this some the php file only loads once on loggin.</p> <p>How could I do this?</p> <p>Example: (that I came up with but not sure what to use). Let say A=1 when the site loads up. I log in and (if Global User is logged in and A=1 call or include welcome.php). </p> <p>When the file is loaded the A=1 turns into variable of A=2 so that when I load the pages the welcome.php in this case will not load again.</p> <p>On my logout page I need to set this value of A to be cleared of this session so A can be called to be 1 again after logout.</p> <p>So, basically the file will only load once even if the pages are refreshed until user log out. One more thing this is all done in smarty php using .tpl files.</p>
php javascript
[2, 3]
2,445,991
2,445,992
Scrolling background image in ViewPager?
<p>I am looking if there are any ways to implement background image scrolling with ViewPager. What I want to achieve is shown on following <a href="http://www.youtube.com/watch?feature=player_detailpage&amp;v=2UnydjgfonA#t=35s" rel="nofollow">video</a>.</p> <p>I've researched <a href="http://stackoverflow.com/questions/4775650/android-moving-background-image-while-navigating-through-views">this</a>, but it works kinda buggy (it also uses own ViewPager implementation).</p> <p>Thank everyone in advance!</p>
java android
[1, 4]
1,331,172
1,331,173
How to pass class name as parameter to a function in android?
<p>In my android application, I have two classes, say X and Y.I have another class Z and inside that class I have a static function 'print'.This function should be called from both classes, X and Y and I want to pass class name of X and Y as parameters to the function 'print' when I call print function from both classes.What I have tried is,</p> <pre><code>public class X { public static String os="Android"; String classname="X"; Z.print(classname); } public class Y { public static String os="IOS"; String classname="Y"; Z.print(classname); } public class Z { public static void print(String classname) { System.out.println(classname.os); } } </code></pre> <p>But eclipse throws an error "os cannot be resolved or is not a field".I know the method I have used for passing class name is wrong.Can anyone guide me to solve this problem?...Thanks in advance.... </p>
java android
[1, 4]
228,480
228,481
How can I convert this method from C++ to C#?
<p>Could someone explain how I'd write this to C#?</p> <pre><code>//byte[] buffer is priavte in the class //it's for writing Packets (gameserver) void writeString(int location, std::string value, int length) { if (value.length() &lt; length) { memcpy(&amp;buffer[location], value.c_str(), value.length()); memset(&amp;buffer[location+value.length()], 0, length-value.length()); } else memcpy(&amp;buffer[location], value.c_str(), length); } </code></pre>
c# c++
[0, 6]
1,983,996
1,983,997
jQuery's dialog plugin
<p>What's the point of storing the ui-dialog-title object in the uiDialogTitle variable, if the variable is never used anywhere in code?</p> <pre><code> uiDialogTitle = $('&lt;span&gt;&lt;/span&gt;') .addClass('ui-dialog-title') .attr('id', titleId) .html(title) .prependTo(uiDialogTitlebar); </code></pre>
javascript jquery
[3, 5]
2,865,049
2,865,050
How to get an ID from DetailView Control and Pass it as QuerySting
<p>How can I get the ID in a DetailView control and pass it as a query string in the URL? Here is how the URL look like now in the email: "http://localhost:49609/ABC/Home/NewPage.aspx" I would like to get it like this once the email is sent out: "http://localhost:49609/ABC/Home/NewPage.aspx?ID=298" Pls. note the ID should come from the DetailView and it is in edit mode. I have spent so many hours on this and was keep getting all kind of error so anyhelp will be appreciated. Thanks. Here is what i have so far...</p> <pre><code> //Create instance of main mail message class. System.Net.Mail.MailMessage mailMessage = new System.Net.Mail.MailMessage(); mailMessage.From = new System.Net.Mail.MailAddress(System.Configuration.ConfigurationManager.AppSettings["fromEmailAddress"]); mailMessage.To.Add(new System.Net.Mail.MailAddress("[email protected]")); mailMessage.Priority = System.Net.Mail.MailPriority.High; mailMessage.IsBodyHtml = false; string myURI = HttpContext.Current.Request.Url.AbsoluteUri.ToString(); string mySubURI = myURI.Replace("OldPage.aspx", "NewPage.aspx"); mailMessage.Body = "Hello, here is the email." + Environment.NewLine + "Please click the link below to see more details.Thanks " + " " + Environment.NewLine + mySubURI; mailMessage.Subject = "My Subject..."; System.Net.Mail.SmtpClient smtpClient = new System.Net.Mail.SmtpClient(); try { smtpClient.Send(mailMessage); } catch (System.Net.Mail.SmtpException smtpExc) { //Log error information on which email failed. } catch (Exception ex) { //Log general errors } } </code></pre>
c# asp.net
[0, 9]
4,607,175
4,607,176
Change Text using jQuery
<p>I have a script that is pulling in news from Yahoo on a certain subject. It renders the title of the news feed like this: </p> <pre><code>&lt;div class="header-title"&gt;subject - Yahoo! News Search Results&lt;/div&gt; </code></pre> <p>I would like to change this to read differently. Since this is inserted via JS I thought I could change this with jQuery. </p> <p>I attempted this: </p> <pre><code>$('.header-title').text('Subject News'); </code></pre> <p>that did not work, I then attempted this: </p> <pre><code>$('.header-title').empty(); $('.header-title').text('Subject News'); </code></pre> <p>that also did not work. </p> <p>Both of the above methods look as if they had no effect on the text.</p> <p>I am not sure what to do to remove the old text and replace with my text.</p> <p>Note: All of my code is inside jQuery's Document Ready IE: </p> <pre><code>$(function(){ //Code Here }); </code></pre>
javascript jquery
[3, 5]
1,778,929
1,778,930
Array/List of class names
<p>Is there a way to do something like:</p> <pre><code>ArrayList&lt;Class&gt; _fragments = new ArrayList&lt;Class&gt;{ FirstFragmentClass.class, SecondFragmentClass.class, .... } return new _fragments.get(iterator); //foreach(_fragments){ ... } </code></pre> <p>P.S. I'm writing against Android API and, if I'm not mistaken, there're slight differencies between reflection in plain java and android.</p> <p>Thanks.</p>
java android
[1, 4]
4,632,729
4,632,730
Detect if user has scrolled to the bottom of a div
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6271237/detecting-when-user-scrolls-to-bottom-of-div-with-jquery">Detecting when user scrolls to bottom of div with jQuery</a> </p> </blockquote> <p>I have a page where I have a header, left menu, content, right menu and a footer. Inside my content I have a div (say id-foo) where I have some data. When user scrolls the page and reaches the bottom of div I have to make an ajax call and bring more data to fill the content there. How can I detect that user has scrolled(page scroll, there is no scroll in div) to bottom of div (foo) .</p>
javascript jquery
[3, 5]
339,382
339,383
Applying [ViewStateModeById] functionality to standard, dynamic ASP.net controls
<p>I'm new to ASP.net, the ViewState, and C# in general.</p> <p>I have some code that adds and deletes boolean constraints that will later be submitted as an SQL query. I dynamically create these constraints with unique IDs. When I delete a constraint earlier that was added before some other constraint, the viewstate tries to map the contents of the DropDownList that was deleted to the DropDownList immediately below it.</p> <p>This is turn triggers an index changed event and causes undesirable behavior in the application. I'm fairly certain that this behavior is caused because the ViewState loads the postback data into dynamically created controls via index.</p> <p>I've been searching for a solution came across [ViewStateModeById] as a possible solution. Unfortunately, this seems to only to custom controls. I would like to avoid creating new custom controls for everything just to index the controls by ID. </p> <p>Is there a way to gain this functionality without having creating custom controls?</p> <p>I should mention that each dynamically generated constraint (which is a set of about 5 controls) is inside a dynamically generated panel. I could just keep creating empty panels as a sort of placeholder to get my desired behavior, but that is just a hack. I'll end up with many, many panels unless I implement another hack to occasionally delete some of my panels.</p>
c# asp.net
[0, 9]
4,187,597
4,187,598
Gridview Datakeys problem
<p>I am trying to get the LocationID for the row in the gridview. grdFavoriteMerchant is the gridID. I am new to using gridview. </p> <p>I am using this part of code to get LocationID but it gets MerchantID when row.RowIndex = 0. </p> <pre><code>int LocationID = Convert.ToInt32(grdFavoriteMerchant.DataKeys[row.RowIndex].Value); </code></pre> <p>In the aspx, i have <code>DataKeyNames="Merchant_id, zipcode, Location_id"</code></p> <p>I am wondering how i can give hardcoded "LocationID" in the above code to get LocationID back. </p> <p>I hope i am clear :)</p> <p>Thanks in advance</p>
c# asp.net
[0, 9]
1,978,967
1,978,968
jquery fire event when element is shown
<p>I need to fire an event on the following conditions for an image:</p> <p>1) The image has been loaded (the following function takes care of that) 2) The image is shown. (if the image has not been shown yet, height() and width() return zero, meaning I cannot resize the image.</p> <p>The main problem here is that my image has been loaded into the child of a hidden div. Since it is a child of the hidden div, change() will not work.</p> <p>Here is the function I am currently using:</p> <pre><code> //Takes the number of pixesl to resize the x-axis of the image to $.fn.resizeImage = function(newX) { return this.each(function() { $this = $(this); //The load event is defined via plugin and takes care of the problem of the load event //not firing for elements that have been cached by the browser. $this.bind('load', function(){ var y = $this.height(); var x = $this.width(); //return if image does not for some reason if(x == 0 || y == 0){return;} //alert('y: ' + y + ' x: ' + x); var ratio = y / x; var newY = Math.floor(newX * ratio); $this.height(newY); $this.width(newX); }); }); }; </code></pre>
javascript jquery
[3, 5]
4,438,560
4,438,561
using html() to get changed content
<p>I have a div that I need to grab the HTML contents of (so naturally I use html())...</p> <p>However, they are text fields. Whenever I grab the contents of the div (that contains the text fields), it grabs the initial HTML and not any data changed by the end user...</p> <p>Here is JS bin version..change the input field, run the function and you see that it will only take the initial value of the field...</p> <p>Any way around this?</p> <p><a href="http://jsbin.com/oleni3/edit" rel="nofollow">http://jsbin.com/oleni3/edit</a></p>
javascript jquery
[3, 5]
2,913,828
2,913,829
jquery, find closest div which is not in any ancestry
<p>HTML:</p> <pre><code>&lt;div class="find_div" id="some_id_1"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; &lt;div class="find_div" id="some_id_2"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; &lt;div class="find_div" id="some_id_3"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; &lt;div class="target_div"&gt;&lt;/div&gt; &lt;div class="find_div" id="some_id_4"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; &lt;div class="find_div" id="some_id_5"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; &lt;div class="find_div" id="some_id_6"&gt;&lt;/div&gt; &lt;!-- other divs --&gt; </code></pre> <p>1) What is the way to find the <code>find_div</code> which is closest to <code>target_div</code> ? </p> <p>2) How to find other <code>find_div</code> divs that are less close consequtively ?</p> <p>Note that there is no ancestral relation in the case being discussed . Consequently jaquery <code>closest()</code> is not effective here i think.</p> <p>I make this question after I asked a question previously <a href="http://stackoverflow.com/questions/13137404/jquery-find-div-class-name-at-a-certain-position-while-scrolling">here</a> with a related problem. Hope that does not make any duplication.</p> <p><strong>EDIT:</strong> Added few lines of code before the <code>target_div</code> line.</p>
javascript jquery
[3, 5]
1,109,337
1,109,338
Variable is always true even when assigned later?
<p>I am getting this error and I really can't understand why. The code:</p> <pre><code> b1.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub boolean b = true; if(b == true){ tv1.setText("true"); b2.setEnabled(false); b = false; } else if(b == false){ b2.setEnabled(true); b = true; tv1.setText("false"); </code></pre> <p>As you can see I'm trying to make when a button is clicked it will check if variable "b" is true or false and then it should do the following code. But it doesn't! It only does the actions for the "if b == true". Can you help me?</p>
java android
[1, 4]
1,380,694
1,380,695
Javascript help
<p>I am very new to javascript. I want to add the same effect as that given in the text fields of this webpage in my own page... Can any one help me with how to do it or where to learn it from.</p> <p>I want my text fields to show what have to be written there but it will change as soon as I write something in it..</p> <p>Another thing is that a small popup block will appear when I click on a textbox which describes what and how to write in it... like password should be alpha numeric... or more than 6 character long ect..</p> <p>Thanks...</p>
javascript asp.net
[3, 9]
4,062,124
4,062,125
jquery in included javascript file
<p>I am new to jquery and javascript so I haven't been able to figure this problem out; nor have my google-fu skills helping me today.</p> <p>I developed a page with HTML and Javascript/Jquery, placing all the jquery between script tags and all was well. When I was done the page I realized that I wanted the same javascript on another page so I put all that jquery/javascript into an external file and tried to include it.</p> <p>That's where things went downhill. The javascript doesn't work at all on the initial page. Nothing happens. I checked the error console and I am not getting any JS errors. </p> <p>Why does this not work and how do I get it to work? </p> <p>This is the JS code in the external file: <a href="http://pastebin.com/wHBmbHLs" rel="nofollow">http://pastebin.com/wHBmbHLs</a></p>
javascript jquery
[3, 5]
1,813,855
1,813,856
How to select a input field in next TD with Jquery?
<p>I want to select a input field in next TD with Jquery. I can not use ID or class because the table's row can be add or removed.</p> <p>like ,</p> <pre><code> &lt;tr&gt; &lt;td&gt;&lt;input type='text' name='price[]' onkeyup = 'getTest(this)' /&gt; &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='qty[]' onkeyup = 'getPrice(this)' value='1' /&gt; &lt;/td&gt; &lt;td&gt;&lt;input type='text' name='amount[]' /&gt; &lt;/td&gt; &lt;/tr&gt; function getTest(obj){ //I want to select qty[] and amount[] } function getPrice(obj){ //I want to select price[] and amount[] } </code></pre> <p>anybody know how to select the input fields, please help~!</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,747,487
3,747,488
how to Set focus to a Image Button while Page Load?
<p>I have can I make an Image button have focus while loading the page. I have set the Image button's TabIndex value to "-1" in script side, while pressing tab key the tab index is changing for all the controls exactly inclding Image button, but I want the Image button to be focused while loading the page.</p> <p>Is there any difference between Image button and other controls? What property or function i've to use to set focus?</p> <p>I am using the below line to set focus, but it's not working:</p> <pre><code>ScriptManager1.SetFocus(imgSearch1); </code></pre> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
1,420,849
1,420,850
pass parameter to one function in the code behind in C# from javascript
<p>I am trying to pass parameter to one function in the code behind in C# from javascript</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#some_id").click(function () { var id = document.getElementById('HiddenField2'); var a = &lt;%=btn_Click(id)%&gt;; }); }); &lt;/script&gt; &lt;asp:HiddenField ID="HiddenField2" runat="server" Value='&lt;%# DataBinder.Eval(Container.DataItem, "item_id")%&gt;' /&gt; code behind public string btn_Click(String item_id) { /*do some thing*/ return null; } </code></pre> <p>But this piece of code always giving me error of context. That id is not defined in this context. Can some please let me know what wrong i am doing?</p>
c# javascript
[0, 3]
2,948,772
2,948,773
how to add a variable into a selector
<p>i wanna turn this </p> <pre><code>document.getElementById('group_'+group).value = attribute; </code></pre> <p>into jquery format so that it looks cleaner. i tried this and it doesnt work</p> <pre><code>$("#group_" +group).val() = attribute; </code></pre>
javascript jquery
[3, 5]
2,311,494
2,311,495
Android avoid OnResume
<p>I have 3 Acivity based application, It's work flow like this <code>MainActivity</code> <code>ListView</code> and <code>DetailView</code>. when onResume event trigger , need to call MainActivity. without going to other two activity.</p> <p>Is there any way to call <code>MainActivity</code> when onResume event trigger?</p> <p>Thank You </p>
java android
[1, 4]
2,936,628
2,936,629
How to get the value from a function
<p>How do I get a value from a function inserted into my HTML.</p> <p>I have tried this:</p> <pre><code>function testReturn(value) { var ReturnValue = value; return ReturnValue; } html = "&lt;div&gt;' + testReturn(2) + ' &lt;/div&gt;"; </code></pre> <p>I get an error saying <code>Undefined</code></p>
javascript jquery
[3, 5]
1,691,412
1,691,413
Make button change output every 3rd click
<p>When "button" is clicked in my script it brings back an image file ("#mypic"), a sound file ("#mysoundclip") and a class that styles a word to spell ("#picknext").</p> <p>The thing is, I want the button to repeat its action 3 times before moving on to the next image, sound and style. How would I do this?</p> <pre><code>$('#pickNext').click(function() { // remove the class from all td's $('td').removeClass('spellword'); // pick a random word var r = rndWord; while (r == rndWord) { rndWord = Math.floor(Math.random() * (listOfWords.length)); } // apply class to all cells containing a letter from that word $('td[data-word="' + listOfWords[rndWord].name + '"]').addClass('spellword'); }); var audio = $("#mysoundclip")[0]; var i = 0; $(".minibutton").click(function() { var noExist = $('td[data-word=' + listOfWords[rndWord].name + ']').hasClass('wordglow2'); if (noExist &amp;&amp; i &gt;= 3) { $('#pickNext').click(); i = 0; } else { $("#mysoundclip").attr('src', listOfWords[rndWord].audio); audio.play(); pic = $("#mypic").attr('src', listOfWords[rndWord].pic); pic.show(); $i++; } }); </code></pre>
javascript jquery
[3, 5]
2,638,983
2,638,984
jQuery and ASP.NET controls visibility in code behind
<p>In my codebehind, I set the display property of an asp.net control to none as follows;</p> <pre><code>fuDoc.Attributes("style") = "display:none;" 'fuDoc is a FileUpload control. </code></pre> <p>On my page, if the user wants to upload a document, they click on a link, which by using jQuery, I set the <code>display</code> property to <code>'block'</code> by using .show() as follows;</p> <pre><code>$('#fuDoc').show(); </code></pre> <p>I also tried;</p> <pre><code>$('#fuDoc').attr('style', 'display:block;'); </code></pre> <p>now, on form submit, I need to check if the <code>fuDoc</code> is <code>visible</code> and if so, do the standard file upload process e.g. check <code>.HasFile</code> etc..</p> <p>However, although the fuDoc control is set to <code>display:block</code> in HTML with no problem, the following asp.net code always produces True</p> <pre><code>If fuDoc.Attributes("style") = "display:none;" Then 'always results to true </code></pre> <p>What is the reason for this? Any help would be appreciated. </p> <p>Note: the FileUpload control is NOT created dynamically. </p>
jquery asp.net
[5, 9]
1,348,283
1,348,284
Exending Textbox to have a Unique Name
<p>Is it possible to Exend Textbox to have a Unique Name ? I have tried using UniqueID poperty,but this is not accessible with Request.Form("UniqueID")</p>
c# asp.net
[0, 9]
1,634,408
1,634,409
unable to start program, unrecognized error in windows web services framework
<p>My c# console app calls a managed c++ dll. The dll is added as a reference to the c# project. If I try to start in debug mode it says error while trying to run project. unable to start program, unrecognized error in windows web service framework. It is not a web application. If I run without debugging, the console pops up and my dll produces an error that the hdf5 header files don't match the hdf5 library my c++ dll is linked to (though it compiles and builds just fine). Both c# driver and c++ dll are 64 bit on a 64 bit machine. Both the F5 and ctrl F5 errors are puzzling. Hope someone has info on this. thanks, sb</p>
c# c++
[0, 6]
1,101,417
1,101,418
All JQuery suddendly stop working
<p>I am suddenly having a problem on my website when no jquery scripts are working.</p> <p>I've clicked on the script library links to see if the host is down and its now.</p> <p>See here:</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>How can I find out what's wrong ... any ideas on what to check?</p>
javascript jquery
[3, 5]
2,888,332
2,888,333
receiving response from page method using jquery
<p>I am calling page method using jQuery. In examples every one revceive reply using <code>result.d</code> <strong>(.d)</strong></p> <p>For example:</p> <pre><code> function onSuccess(msg){ alert("suc" + msg.d); } </code></pre> <p>Please guide me what is this <code>.d</code>?</p>
jquery asp.net
[5, 9]
5,644,475
5,644,476
How to use jquery bubble popup for more than one content
<p>Hello i need to load an image from an database and the popup should be there when i keep the mouse over the images...i used <a href="http://www.vegabit.com/jquery_bubble_popup/" rel="nofollow">http://www.vegabit.com/jquery_bubble_popup/</a></p> <pre><code>$(document).ready(function() { $('#dummy1').SetBubblePopup({ innerHtml: '&lt;p&gt;You can set any HTML tag&lt;br /&gt;inside this popup!&lt;br /&gt;&lt;a href="#"&gt;this is a link&lt;/a&gt;&lt;/p&gt;' }); }); </code></pre> <p>how can i use this for some 10 images from database using php??</p>
php jquery
[2, 5]
4,864,754
4,864,755
AutoSuggest in a asp.net
<p>How to auto suggest in a text box in a asp.net page. I want to display names of the users from the user table.</p>
c# asp.net
[0, 9]
5,199,428
5,199,429
jQuery/JavaScript and document.ready() mid-document
<p>I have looked around for similar questions and I couldn't find an answer...</p> <p>I'd like for one particular page of my web site to import a file ("clock.js"):</p> <pre><code>&lt;script type="text/javascript" src="clock.js"&gt;&lt;/script&gt; </code></pre> <p>and, on load, to run the function tick() from that page.. in the body of the document.</p> <p>I know I am supposed to do it this way:</p> <pre><code>$(document).ready(tick); </code></pre> <p>But it doesn't work and I suspect it's because these lines of code are in the middle of the document.</p> <p>Any suggestions?</p>
javascript jquery
[3, 5]
4,754,015
4,754,016
Upload files using ASP.NET
<pre><code>&lt;form action="http://s0.filesonic.com/abc" method="post" enctype="multipart/form-data"&gt; &lt;input type="file" name="files[]" /&gt; &lt;button type="submit"&gt;submit&lt;/button&gt; &lt;/form&gt; </code></pre> <p>The above code uploads the files to file sonic server, but I want to do this using programmatically using C#, basically my requirement is that the program creates the form and file control and sends the file to the Filesonic server URL mentioned in action attribute..</p> <p>I have gone through many links but with no success, I have gone through the following links with no success.</p> <p>Upload files with HTTPWebrequest (multipart/form-data)</p>
c# asp.net
[0, 9]
1,931,420
1,931,421
How to add delay to jquery mouseover?
<p>I have a bunch of images on one page and I am using the following to trigger an event:</p> <pre><code>$('.img').on('mouseover', function() { //do something }); </code></pre> <p>Is there some way to add a delay such that if a user hovers for maybe 1 second, then it does "//do something" or actually triggers the "mouseover" event?</p>
javascript jquery
[3, 5]
5,126,607
5,126,608
Disabling only the controls on the page using asp.net gridview control
<p>My dropdownlist is inside the gridview asp.net control and i am disabling the dropdownlist by doing this:</p> <pre><code> var $myddl = $('select'); $myddl.prop("disabled", true); </code></pre> <p>but the problem is that its disabling everything that have <code>select elements</code> in the entire master page, so in my situation i have two tabs <code>Tab A</code> and <code>Tab B</code> and how can i disable only the dropdownlist in Tab A?</p>
jquery asp.net
[5, 9]
5,935,121
5,935,122
Display Fees details from database In Table Format
<p>I am using a website(C#) for inserting fees details for I std to V std into a database... next i want to display in that details in next page as a table format which is mentioned below..... </p> <p>ClassName Class I ClassII ClassIII ClassIV ClassV</p> <p>TutionFees 1000 1000 1100 1100 1100</p> <p>ExamFees 500 500 500 550 600</p> <p>Bookfees 200 200 300 300 300</p> <p>How shall i Do like this format? can any one tell me the solution Of this? plz.. Thanks in advance..</p>
c# asp.net
[0, 9]
5,124,370
5,124,371
How to Add PHP Variables in a Jquery Notification
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7141860/passing-variables-from-php-to-javascript">passing variables from php to javascript</a> </p> </blockquote> <p>I am using <a href="http://dev.thrivingkings.com/read/Sticky-A-super-simple-notification-system-built-with-jQuery" rel="nofollow">this awesome</a> jQuery Stick Notification Plugin which creates notifications upon clicking various buttons. I used the following code to display the notification box...</p> <pre><code>$(".notify").click(function() { $.sticky('The page has loaded!'); }); </code></pre> <p>Can i make it display some PHP variables in place of static text message?</p> <p>Hope i've made it clear enough.</p>
php jquery
[2, 5]
2,526,706
2,526,707
Condensing Javascript/jQuery Code
<p>I'd like to start by thanking anyone who can help me condense this piece of Javascript/jQuery code.</p> <pre><code> jQuery(function() { jQuery('#pitem-1').click(function(e) { jQuery("#image-1").lightbox_me({centered: true, onLoad: function() { jQuery("#image-1").find("input:first").focus(); }}); e.preventDefault(); }); jQuery('#pitem-2').click(function(e) { jQuery("#image-2").lightbox_me({centered: true, onLoad: function() { jQuery("#image-2").find("input:first").focus(); }}); e.preventDefault(); }); jQuery('#pitem-3').click(function(e) { jQuery("#image-3").lightbox_me({centered: true, onLoad: function() { jQuery("#image-3").find("input:first").focus(); }}); e.preventDefault(); }); jQuery('table tr:nth-child(even)').addClass('stripe'); }); </code></pre> <p>Basically each #pitem-ID opens the same #image-ID in a popup.</p> <p>Thanks again to anyone who can help.</p> <p>Jack</p>
javascript jquery
[3, 5]