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,574,262 | 5,574,263 | Add onclick to all anchors on page except for ones with a specific class | <p>I'm sure this should be relatively easy to do with Jquery, but my attempts have not worked so far (I'm a little new at Jquery).</p>
<p>Can anyone help me, please?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
1,912,976 | 1,912,977 | Javascript function work on all page except textareas, text boxes | <p>My function (which is shown below) dedicated for "copy-protecting" page.(actually it's only visual thing. Advanced user can get from source code.) What I want to do get this function work on all page parts except textareas, textboxes. How can I achieve this result?</p>
<pre><code>(function($){
$.fn.ctrl = function(key, callback) {
if(typeof key != 'object') key = [key];
callback = callback || function(){
return false;
}
return $(this).keydown(function(e) {
var ret = true;
$.each(key,function(i,k){
if(e.keyCode == k.toUpperCase().charCodeAt(0) && e.ctrlKey) {
ret = callback(e);
}
});
return ret;
});
};
$.fn.disableSelection = function() {
$(window).ctrl(['a','s','c']);
return this.each(function() {
$(this).attr('unselectable', 'on')
.css({
'-moz-user-select':'none',
'-o-user-select':'none',
'-khtml-user-select':'none',
'-webkit-user-select':'none',
'-ms-user-select':'none',
'user-select':'none'
})
.each(function() {
$(this).attr('unselectable','on')
.bind('selectstart',function(){
return false;
});
});
});
}
})(jQuery);
</code></pre>
| javascript jquery | [3, 5] |
4,279,317 | 4,279,318 | asp.net, Gridview RowEditing event only works on first row | <p>Im working on asp.net with c#.
I have a gridview with templatefield columns, data comes from an sql database. I have linkbutton on the item template, the linkbutton calls the Rowediting event to enable the editing. This works fine on the first row. But when I click on any of the other rows nothing happens, the event never gets fires.</p>
<p>How can I solve this?</p>
<p>Thanks..</p>
| c# asp.net | [0, 9] |
102,546 | 102,547 | Anyone know how to use the jQuery Gallery View Plugin? | <p>I found the <a href="http://spaceforaname.com/galleryview" rel="nofollow">jQuery Gallery View plugin</a> because I was looking for a good way to cycle through pictures including text and one that was well designed. This plugin does not seem to be updated anymore and does not have much documentation so I am having difficulties implementing it. Does anyone have an idea as to how it works?</p>
<p>Thanks in advance for any help you can give.</p>
<p>Heres the code I have now (of course with the pictures at the right locations just not possible to attach in jsfiddle): <a href="http://jsfiddle.net/chromedude/GgusY/" rel="nofollow">http://jsfiddle.net/chromedude/GgusY/</a></p>
| javascript jquery | [3, 5] |
3,077,142 | 3,077,143 | How to create a custom JSON based on form values? | <p>I am creating a JSON based on a dynamic form values below, when the user submits, i am displaying the json feed in #results</p>
<p>Is it also possible to get all the values in the form when generating the JSON, I want to get the </p>
<ul>
<li>name, ids, </li>
<li>title information,</li>
<li><p>input value etc</p>
<p>and then create/display the JSON in the order below?</p></li>
</ul>
<p>A working version can viewed here :</p>
<p><a href="http://jsfiddle.net/dev1212/GP2Y6/25/" rel="nofollow">http://jsfiddle.net/dev1212/GP2Y6/25/</a></p>
<p>Currently its not retuning any values and getting some undefined..
the code peice i tried is below</p>
<pre><code><script>
x = function(selector){
var attrs = [];
$(selector + " input").each(function(){
var attrObject = {};
$(this.attributes).each(function(index, attr){
attrObject[attr.name] = attr.value;
attrObject[attr.va] = attr.value;
//console.log(attrObject)
});
attrs.push(attrObject);
attrObject = {};
});
return attrs;
}
$(document).ready(function(){
alert(JSON.stringify(x("#myform")));
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,359,281 | 4,359,282 | At what point in the control life cycle does Control.Visible stop rendering? | <p>I am trying to write a simple utility webcontrol to display one-line messages inside a web page - status updates, error messages, etc. The messages will come from other controls on the page, by calling a method on the webcontrol. If the control doesn't have any messages by the time it gets to pre-render, I don't want it to render on the page at all - I want it to set Control.Visible = false. This only seems to work for non-postback rendering though. Here's the code I'm using:</p>
<pre><code>public class MessageList : WebControl
{
#region inner classes
private struct MessageItem
{
string Content, CssClass;
public MessageItem(string content, string cssClass)
{
Content = content;
CssClass = cssClass;
}
public override string ToString()
{ return "<li" + (String.IsNullOrEmpty(CssClass) ? String.Empty : " class='" + CssClass + "'") + ">" + Content + "</li>"; }
}
private class MessageQueue : Queue<MessageItem> { }
#endregion
#region fields, constructors, and events
MessageQueue queue;
public MessageList() : base(HtmlTextWriterTag.Ul)
{
queue = new MessageQueue();
}
protected override void OnLoad(EventArgs e)
{
this.Controls.Clear();
base.OnLoad(e);
}
protected override void OnPreRender(EventArgs e)
{
this.Visible = (queue.Count > 0);
if (this.Visible)
{
while (queue.Count > 0)
{
MessageItem message = queue.Dequeue();
this.Controls.Add(new LiteralControl(message.ToString()));
}
}
base.OnPreRender(e);
}
#endregion
#region properties and methods
public void AddMessage(string content, string cssClass)
{ queue.Enqueue(new MessageItem(content, cssClass)); }
public void AddMessage(string content)
{ AddMessage(content, String.Empty); }
#endregion
}
</code></pre>
<p>I tried putting the check inside CreateChildControls too, with the same result.</p>
| c# asp.net | [0, 9] |
4,750,047 | 4,750,048 | How can I run some code only after all callbacks complete on a jQuery animation? | <p>I have some animation code with a callback. I need a piece of code to run only after that callback has completed. I do not want to modify the animation code or callback. How can I make sure all callbacks have run before running some additional code. Should I be looking at the queue? When an animation completes but there are still callbacks pending, is that item removed from the queue? What should I be doing here?</p>
<pre><code>var animateFunc = function () {
$('#search').animate({ height: '0px', opacity: '0.0' }, 'fast', 'linear', function () {
$('#search-state').val(searchContainerState.currentPage);
});
};
</code></pre>
<p>example call: </p>
<pre><code>animateFunc();
someOtherFunc(); //someOtherFunc needs to run after the animation callback code.
</code></pre>
<p>How do I do this correctly?
Thanks!!</p>
| javascript jquery | [3, 5] |
426,339 | 426,340 | JavaScript and PHP in code - whats the difference? | <p>I have this code in my JavaScript part:</p>
<pre><code>var opConfig = new Product.Options(<?php echo $this->getJsonConfig(); ?>);
</code></pre>
<p>The PHP call returns me some string, to make it easy, lets say the string is <em>abcd</em>. So this code results in:</p>
<pre><code>var opConfig = new Product.Options(abcd);
</code></pre>
<p>Now, some lines later, I have this code:</p>
<pre><code>this.opConfig = new Product.Options(opconfig);
</code></pre>
<p>The <code>opconfig</code> variable has the same string <code>abcd</code>, but the results are different, <code>this.opConfig</code> does not look like it looked before. So is there a difference in how I use the string as param? Something I am missing? For me, it should always be the same call, namely:</p>
<pre><code>new Product.Options(abcd)
</code></pre>
<p>Ideas?</p>
<p><strong>Addition:</strong> The full call in the JS code looks like that:</p>
<pre><code>var opConfig = new Product.Options({"16":{"26":{"price":5,"oldPrice":5,"priceValue":"5.0000","type":"fixed","excludeTax":5,"includeTax":5},"28":{"price":8,"oldPrice":8,"priceValue":"8.0000","type":"fixed","excludeTax":8,"includeTax":8},"27":{"price":10,"oldPrice":10,"priceValue":"10.0000","type":"fixed","excludeTax":10,"includeTax":10}},"14":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0},"15":{"price":0,"oldPrice":0,"priceValue":"0.0000","type":"fixed","excludeTax":0,"includeTax":0}});
</code></pre>
<p>The param reaches the called function as object, no idea why. Calling it the other way, the same string seems to reach it as string. Can anybody help?</p>
| php javascript | [2, 3] |
1,304,294 | 1,304,295 | Move cursor at the end of the input | <p>This is my little jquery plugin that replaces each english symbol with other symbols while typing. Everything works fine here except when I type a long word, longer than the input itself, the cursor goes outside the input the the last part of the word isn't visible. Just visit the link bellow and type something (without the space) and you'll get what I mean.</p>
<p><a href="http://jsfiddle.net/beLMf/" rel="nofollow">http://jsfiddle.net/beLMf/</a></p>
<p>Is there any solution to fix this?</p>
| javascript jquery | [3, 5] |
4,961,904 | 4,961,905 | jquery how to use..... addClass().find().text() | <p>Here's the result I want:</p>
<pre><code><div id="error" class="alert warning"><span class="icon"></span>text here</div>
</code></pre>
<p>I tried this:</p>
<pre><code>$('#error').addClass('alert error').find('span').addClass('icon').text('text here');`
</code></pre>
<p>which results in this:</p>
<pre><code><div id="error" class="alert warning"><span class="icon">text here</span></div>
</code></pre>
<p>I also tried this:</p>
<pre><code>$('#error').addClass('alert warning').text('text here').find('span').addClass('icon');
</code></pre>
<p>which results in this:</p>
<pre><code><div id="error-arch" class="alert warning">text here</div>
</code></pre>
<p><strong>What am I doing wrong?</strong></p>
| javascript jquery | [3, 5] |
5,947,566 | 5,947,567 | Why is Context needed for getRelativeTimeSpanString? | <p>I was wondering why <a href="http://developer.android.com/reference/android/text/format/DateUtils.html#getRelativeTimeSpanString%28android.content.Context,%20long,%20boolean%29" rel="nofollow"><code>getRelativeTimeSpanString</code></a> needs a context? (leaving the puns aside)</p>
<pre><code>public static CharSequence getRelativeTimeSpanString (Context c, long millis, boolean withPreposition)
</code></pre>
| java android | [1, 4] |
440,070 | 440,071 | Auto hide element by jquery - code not work | <p>I have an element in aspx page with class= "._aHide" it carrying a message, And it is shown repeatedly.</p>
<pre><code><div id="Message1" class="._aHide" runat="server" visible="true"><p>My Message</p></div>
</code></pre>
<ul>
<li>aspx server side elements not created when page load if it's visible property = true.</li>
</ul>
<p>I need to hide this div after 7 seconds of show it, unless mouse over.</p>
<p>I created this code</p>
<pre><code>$(document).ready(function () {
var hide = false;
$("._aHide").hover(function () {
clearTimeout(hide);
});
$("._aHide").mouseout(function () {
hide = setTimeout(function () { $("._aHide").fadeOut("slow") }, 7000);
hide;
});
$("._aHide").ready(function () {
hide = setTimeout(function () { $("._aHide").fadeOut("slow") }, 7000);
hide;
});
});
</code></pre>
<p>But somthings wrong here</p>
<p>1- this code work for one time only, And I show this message many times.</p>
<p>2- All message boxes hides in one time, because I can't use $(this) in settimeout and I don't know why.</p>
<p>Thank you for your help, and I really appreciate it</p>
| javascript jquery | [3, 5] |
3,206,732 | 3,206,733 | Call function from parent | <p>Page A has iframe B. In iframe B, I have a var store a function name of page A. How to call that function from iframe B? (Both in a same domain)</p>
<p>I try this in iframe B</p>
<pre><code>eval("window.parent." + func_name + "('"+param1+"', '"+param2+"');");
</code></pre>
<p>It work well but I ask for a better solution if possible.</p>
| javascript jquery | [3, 5] |
2,837,448 | 2,837,449 | Form not submitting on text click | <p>This isthe form which i am submitting it through on click on text, but the values are not passing on the action page.</p>
<pre><code> <form action="forget_pass.php" method="post" id="new_user" name="new_user">
<ul class="inputlist">
<li><span class="redcolor">*</span>Email Address or Phone No.</li>
<li>
<input name="" class="inputbox" type="text" name="EmailAddress" id="txtEmail" />
&nbsp;&nbsp;
</li>
<li class="rightalign">
<a href="javascript:document.new_user.submit();" onclick="">
Retrieve Password</a></li>
</form>
</code></pre>
| php javascript | [2, 3] |
565,264 | 565,265 | use a if condition to find which page redirects to current page in asp.net | <p>I am redirecting to sendmessage page from group page and user page. In the sendmessage server side code how can I find which page redirected to send message page. since I have different code for each page i need to use a if condition to determine it. how to code the if condition.</p>
<p>From user page </p>
<pre><code> <asp:ImageButton ID="SendButton" ImageUrl="Styles/Images/Message.jpg" Enabled="True" Width="" runat="server" PostBackUrl='<%# Eval("Email", "SendMessage.aspx?Email={0}") %>'></asp:ImageButton>
</code></pre>
<p>From Group page</p>
<pre><code><asp:ImageButton ID="SendButton" ImageUrl="Styles/Images/Message.jpg" Enabled="True" Width="" runat="server" PostBackUrl='<%# Eval("groupname", "SendMessage.aspx?=groupname={0}") %>'></asp:ImageButton>
</code></pre>
<p>I tried this but it didn't work</p>
<pre><code>string url = Request.UrlReferrer.AbsoluteUri;
if (Request.UrlReferrer.AbsoluteUri.ToLower().Contains("SendMessage.aspx?GroupName"))
{}
</code></pre>
<p>[url= http://localhost:48996/SurelyK/SendMessage.aspx?GroupName=iCam]</p>
| c# asp.net | [0, 9] |
3,699,662 | 3,699,663 | JQuery Datepicker with generated DOM elements | <p>I have a website that uses JQuery to construct a rather large table. When I try to select a set of input elements created this way by class and add a datepicker to them, nothing happens. The table is generated durinng document.ready(); is there a certain time I have to execute $('.date_pick').datepicker(); in order for this to work? If not, what could I be doing wrong?</p>
| javascript jquery | [3, 5] |
3,545,894 | 3,545,895 | JQuery: Select Elements changes tracked but not their values! | <p>I have just got a questioned answered and have fallen into another trap!</p>
<p>I have a form which is in a <a href="http://fancybox.net/js/fancybox/jquery.fancybox-1.2.1.js" rel="nofollow">lightbox</a> and I want to track every change in the select elements. When they change I want to get the value of each of the select elements. I have tried to do the following:</p>
<pre><code>$('select.htt, select.hst').live('change', function() {
var channels = parseInt($('select.hst').val(), 10) * parseInt($('select.htt').val(), 10);
alert($('select.hst').val() + ' and ' + $('select.htt').val());
$('span.yellow2').html(channels);
});
</code></pre>
<p>However, the values are always the same i.e. the first option in each drop down box even though there are other options selected. I am guessing like somebody has explained before. The lightbox I am using takes a copy of these elements and makes changes to them and JQuery can not see this, but I have been told to reference the elements via classes which has worked but only up to this point.</p>
<p>What else can I try and what is the problem?</p>
<p>I really appreciate any help.</p>
<p>Thanks all</p>
| javascript jquery | [3, 5] |
5,652,547 | 5,652,548 | Find control of child gridview in a dropdown selected index change event | <p>i have a two gridview Gv1 which is parent and gv2 which is nested inside Gv1
and i want to find the control of child gridview as well as the label which is placed inside the itemtemplate of childgridview in the selectedindexchange of dropdownlist which is placed outside the both grids</p>
<p>i have used this code inside the dropdown selected index change</p>
<pre><code> GridView grid_child = grv_parent.FindControl("grv") as GridView;
if (grid_child != null)
{
Label lbl_asset_type = (Label)grid_child.FindControl("lbl_asset_type");
</code></pre>
| c# asp.net | [0, 9] |
3,373,889 | 3,373,890 | How to upload an image in folder with database in asp.net on remote server? | <p>I face this problem on uploading time:</p>
<blockquote>
<p>Access to the path
'D:\inetpub\vhosts\rajschool.com\httpdocs\Photo\3d_529 - Copy.jpg' is
denied.</p>
</blockquote>
<p>My code for uploading image is:</p>
<pre><code>protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
string imagefolder = "Photo";
string savepath;
string savefile;
if (FileUpload1.HasFile)
{
savepath = Path.Combine(Request.PhysicalApplicationPath, imagefolder);
savefile = Path.Combine(savepath, FileUpload1.FileName);
FileUpload1.SaveAs(savefile);
SqlDataSource1.Insert();
lblmgs.Text = "successfully upload";
}
}
</code></pre>
| c# asp.net | [0, 9] |
137,732 | 137,733 | Is this the correct way to set an id for an element that doesn't have an id yet in jQuery? | <pre><code>$("a[href*='http://www.google.com']").attr('id','newId');
</code></pre>
<p>Can only reference it by <code>href</code>.</p>
| javascript jquery | [3, 5] |
2,728,915 | 2,728,916 | Where is the Component Initialize Method in Asp.NET 3.5 | <p>I want to create my own naming convention for page events rather than AutoEventWireUp but I couldn't find Component Initialize methods any where ? Should I override it ? But in which class it is defined ?</p>
<p>Thanks...</p>
<p><strong>Edit :</strong></p>
<p>For example : I don't want to use <code>Page_Load</code> but <code>LoadThisPage</code> naming. So It should be like </p>
<pre><code>Load += new LoadThisPage(sender,e);
</code></pre>
<p>I was expecting a <code>InitializeComponent</code> method where I can initialize page,controls etc. events handlers...But it turned out to be <code>Constructor</code> function :)</p>
<p>So what confused me is I thought there should have been a method like <code>InitializeComponent</code> which does things for me already created by Designer itself so I thought I could define my own event handler names within this method by overriding it in the say <code>Default.aspx.cs</code> .</p>
<p>But the answer was simple :) Thanks...</p>
| c# asp.net | [0, 9] |
5,167,678 | 5,167,679 | How come mousdown doesn't work on <html>-tag? | <p>The mousedown-event only works if I click an elemnt, not the html-element. Why and What can I do about it? </p>
<pre><code>var curFocus;
$(document.body).delegate('*','mousedown', function(){
if ((this != curFocus) && // don't bother if this was the previous active element
($(curFocus).is('.field')) // if it was a .field that was blurred
) {
$('.' + $(curFocus).attr("id")).removeClass("visible"); // take action based on the blurred element
}
curFocus = this; // log the newly focussed element for the next event
});
</code></pre>
| javascript jquery | [3, 5] |
1,828,539 | 1,828,540 | I am using formsauthentication in my application but it is not working | <p>Below is my code for forms authentication in asp.net but some time it is not working means some time user is not logged in</p>
<p>FormsAuthentication.SetAuthCookie(authentificationString, rememberLogin);</p>
<pre><code> string cookieName = FormsAuthentication.FormsCookieName;
HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[cookieName];
if (authCookie != null)
{
System.Web.HttpContext.Current.Response.Cookies[cookieName].Domain = Utilities.ResponseManager.CookieDomain;
}
</code></pre>
<p>It is working fine in my local machine but when I deploy on my server then it is not working.</p>
<p>is it any iss setting or something else..
what I need to do for this.</p>
<p>below is web.config code</p>
<p>
</p>
<p>and local machine having IIS 6.0 and Server having IIS 7.0</p>
<p>Please help me out on this problem</p>
| c# asp.net | [0, 9] |
1,819,140 | 1,819,141 | From full path to file, to only displaying filename | <p>How can I convert a full path</p>
<pre><code>C:\some folder\another folder\my-picture.jpg
</code></pre>
<p>To:</p>
<pre><code>my-picture.jpg
</code></pre>
<p>??</p>
<p>Thank you in advance.</p>
| javascript jquery | [3, 5] |
2,142,471 | 2,142,472 | Which query is good to display results on search | <p>Let's say I have form looks like </p>
<p><img src="http://i.stack.imgur.com/ALQdh.png" alt="alt text"></p>
<p>First: Use jQuery to display data like auto submit on every select field</p>
<pre><code>$('#region,#categories,#types').change(function () {
$(this).closest("form").submit();
});
</code></pre>
<p>Second : One time query. Select all fields then click search button</p>
<p>I want to know which method is good to display the search results.</p>
| php jquery | [2, 5] |
5,311,720 | 5,311,721 | How to set Textbox value at page load? | <p>I have to set asp.net TextBox’s value at page load using JQuery.<br/>
Can somebody give me example ?</p>
| jquery asp.net | [5, 9] |
5,700,699 | 5,700,700 | Android using intents to control media player? | <p>I want to send a broadcast (or is it an intent?) from my app that will go to the next track of a music player if something is playing, or play/pause, etc. Here is the code that I have so far: </p>
<pre><code> final Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
i.putExtra(Intent.EXTRA_KEY_EVENT, KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE);
context.sendBroadcast(i);
</code></pre>
<p>However as far as I can tell from my testing this code snippet doesn't quite do anything. Btw I put this code into a function and call it from a background service, in case that's relevant. </p>
<p>So how can I get this functionality working? If it's not possible for some reason I'm open to suggestions for work-arounds and/or alternate solutions. </p>
<p>Much appreciated, thanks. </p>
| java android | [1, 4] |
1,465,401 | 1,465,402 | Convert characters to asterisks in Javascript | <p>Im trying to write a function that will convert all charactewrs after the first word into asterisks, </p>
<p>Say I have MYFIRSTWORD MYSECONDWORD, id want it to convert to asterisks on Keyup, but only for the second word, rendering it as so...</p>
<p>MYFIRSTWORD <strong><em>*</em>**</strong></p>
<p>I've been using the following only it converts each and every letter, is this possible?</p>
<pre><code>$(this).val($(this).val().replace(/[^\s]/g, "*"));
</code></pre>
| javascript jquery | [3, 5] |
5,446,670 | 5,446,671 | How to get the mousdown cursor to apply if cursor is outside of an element? | <p>In this fiddle you can grab and drag the black box around a circle</p>
<p><a href="http://jsfiddle.net/S5AT6/" rel="nofollow">http://jsfiddle.net/S5AT6/</a></p>
<p>How do I get mousedown cursor(closedhand) to be displayed instead of the default cursor, when the user has grabbed the black box, but their cursor is outside of the <code>#marker</code> element and inside the document.</p>
| javascript jquery | [3, 5] |
275,592 | 275,593 | Open login page , insert logon information and click loginbutton | <p>I want to open a logon page like www.site.com/login.php</p>
<p>insert username and password </p>
<p>and login button be invoke .</p>
<p>All of this should be done progroamlly in a server (not in a browser )</p>
<p>is it possible to do thsi ?</p>
| c# asp.net | [0, 9] |
2,211,240 | 2,211,241 | allowing to update gridview depending on user authentication asp.net | <p>i have a web app in asp.net running on windows authentication</p>
<p>i want only a specific user to be able to update, while the other users will only be able to view.</p>
<p>how do customize the gridview so that only a specific user has the option to update?</p>
| c# asp.net | [0, 9] |
3,134,637 | 3,134,638 | Hide form with php on submit? | <p>I have a simple php - password protecton / login based on a form which works. PHP-code is in page "secure.php" and includes the html-file "accessed.html" when user + pass is correct.</p>
<p>But i want the form to hide when hidden page (accessed.html) is shown.
I have tried wrapping the form in a div and using javascript and display: none to hide, but it doesnt work - not locally or on server. </p>
<p>What am i doing wrong? It doesnt have to be js hiding the form after login..</p>
<p>PHP in top </p>
<pre><code> <?php
$user = $_POST['user'];
$pass = $_POST['pass'];
if($user == "a"
&& $pass == "a")
{
include("accessed.html");
echo "<script>
document.getElementById('wrap').style.display = 'none';
</script>";
}
if(isset($_POST))
?>
</code></pre>
<p>And the form in the body:</p>
<pre><code> <div id="wrap">
<form method="POST" action="secure.php">
User <input type="text" name="user"></input>
Pass <input type="text" name="pass"></input>
<input type="submit" name="submit" value="access page"></input>
</form>
</div>
</code></pre>
| php javascript | [2, 3] |
1,129,784 | 1,129,785 | Not work my function after click? | <p>I not know why not work following code for my function(<code>alert()</code>) and is run my function(<code>alert()</code>) after tow times click on button, did you can guide me?</p>
<p><strong>Demo:(Here see my full code)</strong> <a href="http://jsfiddle.net/pRXQ7/1/" rel="nofollow">http://jsfiddle.net/pRXQ7/1/</a></p>
<pre><code>$('.iu').click(function() {
if(alert() == true){
alert('ok')
}else{
alert('no')
}
});
</code></pre>
| javascript jquery | [3, 5] |
1,889,563 | 1,889,564 | Jquery simple slider problem when browser tab not active | <p>I wrote a simple jquery slider that basically goes through 3 divs, hidding one and then fadeIn the next and so on using <code>setInterval()</code></p>
<p>The slider works just fine for my purposes, but when I open other tabs and then come back to the page's tab, all the divs are visible and then they start to disappear and it starts working again. </p>
<p>Here is my jquery, which is inside <code>$(function(){})</code>:</p>
<pre><code> $('#slideshow-next').click(function() {
pauseSlideshow();
nextSlide();
});
$('#slideshow-prev').click(function() {
pauseSlideshow();
prevSlide();
});
$('#slideshow-pause').click(function(){
pauseSlideshow();
});
$('#slideshow-play').click(function() {
playSlideshow();
});
interval = setInterval('nextSlide()', 4000);
});
function playSlideshow() {
interval = setInterval('nextSlide()', 4000);
$('#slideshow-play').hide();
$('#slideshow-pause').show();
nextSlide();
}
function pauseSlideshow() {
interval = clearInterval(interval);
$('#slideshow-pause').hide();
$('#slideshow-play').show();
}
function nextSlide() {
//hide current slide
$('#slide'+currentSlide).hide();
// show next slide
var next = (currentSlide+1)%3;
$('#slide'+next).fadeIn('slow');
currentSlide = next;
}
function prevSlide() {
//hide current slide
$('#slide'+currentSlide).hide();
// show next slide
var next = (currentSlide-1)%3;
$('#slide'+next).fadeIn();
currentSlide = next;
}
</code></pre>
| javascript jquery | [3, 5] |
4,660,137 | 4,660,138 | how to wrap text in boundfield column in gridview | <p>i am having a boundfield column and in that column if i entered a string(without spaces) of length 15, there is no problem. But if the string is more than 15, the text is not wrapped. I gave the command column.ItemStyle.Wrap=true; But its not working. I have fixed the width of the column.</p>
<p>How to wrap the text in the boundfield if a string more 15 characters.
Thanks</p>
| c# asp.net | [0, 9] |
5,160,708 | 5,160,709 | jQuery - How to check for available javascript on a page? | <p>On a html page that uses $.getScript to dynamically load .js files.</p>
<p>Later at some point if I wish to check whether a particular .js file is loaded. How to do this?</p>
<p>Can I check using filename.js? or do I have to check for an object/function/variable in that file?</p>
<p>Thanks for the answers folks. You guys suggested callback function, global variable etc. But the thing is, I work in corporate environment where one corporate .js loads other .js(the one I'm trying to detect). Not only I can't modify corporate .js, I can't control when it'll change. I was hoping may be there was a way to know which .js file is loaded on page.</p>
| javascript jquery | [3, 5] |
5,876,911 | 5,876,912 | Need help regards copy image to clipboard in website using ASP.Net or JavaScript? | <p>I need a help regards copy image to clipboard in website. The image is dynamically created one.</p>
<p>I found two solutions</p>
<p>Solution 1 : </p>
<pre><code>using System.Windows.Forms;
Bitmap bitmapImage ;
protected void buttonClipboard_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
MemoryStream memoryStream = new MemoryStream(imageByteArray); // Image byte array is the input
bitmapImage = (Bitmap)System.Drawing.Image.FromStream(memoryStream);
memoryStream.Flush();
memoryStream.Close();
Thread cbThread = new Thread(new ThreadStart(CopyToClipboard));
cbThread.ApartmentState = ApartmentState.STA;
cbThread.Start();
cbThread.Join();
}
[STAThread]
protected void CopyToClipboard()
{
if (bitmapImage != null)
{
//Clipboard.SetData(DataFormats.Bitmap, bitmapImage);
Clipboard.SetImage(bitmapImage);
}
}
</code></pre>
<p>This is working fine before publishing the website.
After publishing this won't work in any website browsers because here STAThread used.
Some websites said thread won't work in published website due to internal multi-thread handling in browsers.</p>
<p>Solution 2 : </p>
<pre><code><script type="text/javascript">
function CopyToClip() {
var imgControl = document.getElementById('imageContent');
imgControl.contentEditable = 'true';
var controlRange;
if (document.body.createControlRange) {
controlRange = document.body.createControlRange();
controlRange.addElement(imgControl);
controlRange.execCommand('Copy');
}
imgControl.contentEditable = 'false';
return true;
}
</code></pre>
<p></p>
<p>This java-script working fine for IE before & after publishing website. But it is not working in Chrome & Mozilla in any situation.</p>
<p>I need one solution for Mozilla & Chrome.</p>
<p>Please suggest any solution for this? </p>
| javascript asp.net | [3, 9] |
1,676,406 | 1,676,407 | how to destroy session when window close? | <p>I want to destroy session when i close window so i am using a code </p>
<p>java script code:</p>
<pre><code><script>
function killSession() {
location = 'index.php?destroySession=true';
}
</script>
</code></pre>
<p>php code:</p>
<pre><code><?php
if (isset($_GET['destroySession']) && $_GET['destroySession'] == "true") {
session_destroy();
$closeWin = "window.close()";
} else {
$closeWin = "";
}
?>
</code></pre>
<p>body:</p>
<pre><code><body onload="<?php echo $closeWin; ?>" onunload="killSession();">
</code></pre>
<p>But its not giving me seficient response.I want to destroy session when window close.How its possible ?</p>
| php javascript | [2, 3] |
2,271 | 2,272 | How did you learn the .NET Library? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/387181/getting-started-with-net">Getting started with .NET</a> </p>
</blockquote>
<p>Hello,
I am a junior .NET/C# developer and wanted to gauge how fellow developers learned .NET. I've been learning ASP.NET but am having some trouble remembering the members of the .NET library. So for example, I'm doing a training on ASP.NET and we do an example in the System.IO namespace then we jump to something in System.Collections. I know everything is supposed to tie together but we are zipping through it so fast that if I want to use it tomorrow I would still struggle. So any suggestions on how to best learn in a manner that will be more real world and practical? I was thinking about studying each Namespace by itself...so one week do System.IO, the next week System.Collections and so on. Just so I can see a relationship between items. Thanks.</p>
| c# asp.net | [0, 9] |
2,138,524 | 2,138,525 | jQuery find - What order does it return elements in? | <p>I have been using jQuery's <code>find</code> method and it's been very useful. </p>
<p>However, I came across an example where the <code>find</code> seemed to be duplicating things and not returning elements in the order they appeared in the document. (I'm not sure if find is supposed to do this - I doubt it). </p>
<p>However, it shouldn't have duplicates in the elements it finds and show the wrong order, surely?</p>
<p>Full example can be found here: <a href="http://jsfiddle.net/EMzDn/3" rel="nofollow"><strong>jsFiddle</strong></a> - Notice how span[9] and span[10] are in the wrong order and duplicated.</p>
<p>Why is this the case?</p>
<h2>Update</h2>
<p>Updated so that output is written to document, please use new link above.</p>
| javascript jquery | [3, 5] |
4,762,021 | 4,762,022 | PDFLib dll not working in .net4.0 | <p>I was converted my .net2.0 project into .net4.0.</p>
<p>Now I could use pdflib.dll.
I recieved the below error.</p>
<blockquote>
<p>"Declaration referenced in a method implementation cannot be a final method. Type: 'PDFLibNet.xPDFBinaryReader'. Assembly: 'PDFLibNet, Version=1.0.6.6, Culture=neutral, PublicKeyToken=26d87f7d66fb2aee'."</p>
</blockquote>
<p>In .net2.0 and net3.5 it hasworked for me but not in .net4.0.</p>
<p>How can I handle this?</p>
<p>I need any suggestions.</p>
| c# asp.net | [0, 9] |
4,845,499 | 4,845,500 | alert msg onclick event | <p>I am trying to invoke a button click from inside a .cshtml file:</p>
<pre><code> <input type="button" id="ImageHosting" value="To Image Hosting" onclick="ImageHosting_Click()"/>
</code></pre>
<p>This is the .js file:</p>
<pre><code> function ImageHosting_Click() {
$("#ImageHosting").click(function () {
alert("test");
});
}
</code></pre>
<p>I am not able to get the alert message. Any idea why?</p>
| javascript jquery | [3, 5] |
1,297,034 | 1,297,035 | How can i close all the IE browser windows that I opened in JavaScript | <p>How can i close all the IE browser window in asp.net,</p>
<p>I am opening many windows..from javascript by window.open()...
I need to close all the windows by clicking the button in main page(parent window).</p>
<p>some times we have open in in c# it self</p>
<pre><code>btnShow.Attributes.Add("onclick", @"var windowVar=window.open('" + sAppPath + @"', 'parent');windowVar.focus(); return false;");
</code></pre>
<p>at the time how can i put in array in javascript.</p>
<p>How can i do it?</p>
| asp.net javascript | [9, 3] |
2,999,716 | 2,999,717 | How to define a property instead of public variable in C# | <pre><code>public static string SEARCH_STRING = "searchkey";
string key=Request.QueryString.Get(SEARCH_STRING);
</code></pre>
<p>How to change the above code to make SEARCH_STRING be accessed using a Property(get; set;) instead of a public variable</p>
| c# asp.net | [0, 9] |
4,664,989 | 4,664,990 | Trying to get DAY_OF_WEEK from calendar cause Resoure Not Found | <p>I am trying to find the the day of the week by: </p>
<pre><code>Calendar cd = Calendar.getInstance();
int dow = cd.get(Calendar.DAY_OF_WEEK);
</code></pre>
<p>But whenever I load the program I get a </p>
<pre><code>Unable to Start Activity android.content.res.Resources$NotFound Exception: String resource ID #0x5
</code></pre>
<p>And 0x5 corresponds to Thursday, today, in the Calendar resource I think</p>
| java android | [1, 4] |
1,157,725 | 1,157,726 | receiving response from page method using jquery | <p>I am calling page method using jquery. In examples every one receives a reply using result.d</p>
<p>for example:</p>
<pre><code> function onSuccess(msg)
{
alert("suc" + msg.d);
}
</code></pre>
<p>Please guide me what is this .d ? </p>
| jquery asp.net | [5, 9] |
2,340,126 | 2,340,127 | Change javascript code to jquery code, How is it? | <p>I want change following javascript code to jquery code, How is it?</p>
<p>With done change <code>hourOffset</code> in date <code>3, 21</code> and <code>9, 22</code>.</p>
<p><strong>DEMO:</strong> <a href="http://jsfiddle.net/zJRDC/" rel="nofollow">http://jsfiddle.net/zJRDC/</a></p>
<pre><code><script type="text/javascript">
var interval = self.setInterval("clock()", 1000);
function clock() {
var date = new Date();
var hourOffset = 3;
date.setUTCHours(date.getUTCHours(), date.getUTCMinutes());
var time = date.getTime();
date.setUTCFullYear(date.getUTCFullYear(), 3, 21);
var dstStart = date.getTime();
date.setUTCFullYear(date.getUTCFullYear(), 9, 22);
var dstEnd = date.getTime();
if (time > dstStart && time < dstEnd){ hourOffset = 4;}
date.setUTCHours(date.getUTCHours() + hourOffset, date.getUTCMinutes() + 30);
var output = date.getUTCHours() + ":" + date.getUTCMinutes() + ":" + date.getUTCSeconds();
document.getElementById("clock").innerHTML = output
}
</script>
<div id="clock"></div>
</code></pre>
| javascript jquery | [3, 5] |
5,749,855 | 5,749,856 | How to write a function in jquery/javascript to add new html TDs? | <p>Assume I have an array "numbers" that contains numbers from 1 to 97 and the following table where each row can only have 4 tds:</p>
<pre><code><table id="mytable">
<tr><td>1</td><td>2</td><td>3</td><td>4</td></tr>
<tr><td>5</td><td>6</td><td>7</td><td>8</td></tr>
<tr><td>9</td><td>10</td></tr>
</table>
</code></pre>
<p>How to best create a function such that clicking on a link "Add" will call a javascript function that can add a new "td" to the table (the number 11, which is at index 10 in the numbers array), and when it hits the 4 column limit, it would create a new row.</p>
<p>Also, is there some good way to write a function that could count how many TDs are in the table at any given time?</p>
<p>What is the ideal way to do this?</p>
| javascript jquery | [3, 5] |
5,216,441 | 5,216,442 | $.get and get value | <pre><code> function get(){
$.get('/get.php', function(data) {
alert('one: ' + data)
return data;
});
}
var test = get();
alert('two:' + test);
</code></pre>
<p>In get.php is:</p>
<pre><code><?php echo "number"; ?>
</code></pre>
<p>why one alert show me
<strong>one: number</strong></p>
<p>but two alert show me
<strong>two: undefined</strong></p>
<p>How can i get this value outside function?</p>
| javascript jquery | [3, 5] |
5,039,578 | 5,039,579 | Display all my site pages from a timed loop controlled by php | <p>Bottom line, I want to display each page of our church website on a remote monitor for about 30 seconds then move to the next page, The timer control would be in a php page as the controlling page. I can figure most of it out except how to keep control in php so when the timer times out we go back to php for call to next page. Exit from the loop would be via keyboard entry. The main problem is exiting the displaying page at time out.</p>
<p>Can it be done with php or php and javascript?</p>
<p>Thannks,</p>
<p>Don</p>
| php javascript | [2, 3] |
2,973,032 | 2,973,033 | ASP.Net: GridView control and combobox woes part 2 | <p>This is a follow up to: <a href="http://stackoverflow.com/questions/7637920/asp-net-gridview-control-and-combobox-woes">ASP.Net: GridView control and combobox woes</a></p>
<p>I've implemented my code as kd7 has answered but I'm getting a "System.NullReferenceException: Object reference not set to an instance of an object." I've simplified the code as follows:</p>
<p>Event handler for the button click:</p>
<pre><code>protected void btnSubmit_Click(object sender, EventArgs e)
{
ViewState["MyKey"] = "Test";
}
</code></pre>
<p>The Page_Load now has:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
txtDisplay.Text = ViewState["MyKey"].ToString();
}
}
</code></pre>
<p><strong>My question is:</strong> Why is ViewState["MyKey"] coming back as null and causing a NullReference exception?</p>
<p><strong>Please note that the code above is only a simplified version of what I'm trying to do. Please see the previous question given in the first line of this question to see full details.</strong></p>
<p>Any suggestions?</p>
| c# asp.net | [0, 9] |
5,675,782 | 5,675,783 | Getting the a text from EditText (but a Number) | <p>I know that you can get a normal text like this:</p>
<pre><code>EditText input = (EditText) findViewById(R.id.input);
String value = input.getText().toString();
</code></pre>
<p>but now I need a to an input like this: 0xFFFFFF (a Hex-Color), an Integer... But value is only a String and I don't know how to convert it... I'm using view.setBackgroundColor(color);</p>
<p>Thanks a lot! </p>
| java android | [1, 4] |
3,411,274 | 3,411,275 | The Jar file ../android-8/android.jar has no source attachment | <p>I came across this no source attachment problem when I was debugging the project, but when I run the android program without debugging enabled, the program would run without any trouble. Even after I attached the jar file manually, it still reported that properties.class could not be found! What should I do with this problem? What is the reason for this? thanks!!!</p>
<p>Daniel </p>
| java android | [1, 4] |
2,543,843 | 2,543,844 | media player equalizer | <p>I am developing an android media player application.
Can you anyone tell me please how can I assign the preset value to the songs and play it.</p>
<p>Could you please give me the solution?</p>
<p>The below is the code which am using ,</p>
<pre><code>equalizer = new Equalizer(1, audioSessionId);
equalizer.setEnabled(true);
equalizer.usePreset(preset);
</code></pre>
| java android | [1, 4] |
4,358,047 | 4,358,048 | C# oncheckedchanged event handler of aspcheckbox does not fire when checkbox is unc | <p>Hey could you look at this code: I get this error:</p>
<blockquote>
<p>Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. </p>
</blockquote>
<p>Source Error: </p>
<pre><code>{
CheckBox chkBox1 = (CheckBox)e.Row.Cells[8].FindControl("chkStatus");
chkBox1.CheckedChanged += new EventHandler(chkStatus_OnCheckedChanged);
chkBox1.Checked = true;
chkBox1.AutoPostBack = true;
}
</code></pre>
| c# asp.net | [0, 9] |
1,196,027 | 1,196,028 | JQuery plugins stop working on appending querystring parameters | <p>I'm new with Javascript programming, I need to insert this code in the body of a page, I take some Get parameters from URL and I attach them to the iframe string:</p>
<pre><code><script>
document.write("<iframe width='700' height='500' frameborder='0' src=https://www.mysite.com/abs/indexabs.php?stid=261&lg=en&step2=1&"+unescape(window.location.href.slice(window.location.href.indexOf('?') + 1)))+"></iframe>"
</script>
</code></pre>
<p>This code runs and loads the iframe content...but there are other jQuery elements on the page, that don't run anymore (i.e. Nivo slider, Jquery UI datepicker)</p>
<p>Is there a different manner to do the same without jQuery incompatibility?</p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
137,125 | 137,126 | Javascript Typewriter effect PAUSE/STOP button | <p>I've this script below allows me to play the text with a type writer effect when the button is clicked. But how can I change the code that allow me the pause or stop the script when the button is clicked again. </p>
<p>HTML</p>
<pre><code> <div ID="textDestination" class="news"></div>
<div class="play" id="playbtn"></div>
</code></pre>
<p>JavaScript</p>
<pre><code> var text="I remember the big tree in Mums yard I used to climb when they were drinking. I remember sitting up there crying cause I knew I’d have to get down, and how the look on his face made me want to laugh, how small he looked from up there. I remember he would threaten to throw things at me if I didn't get down. He knew he had no power over me up there, but he also knew eventually I would have to get down. Then he would say I was in for it whether I came down or not. But up there I was untouchable, and the world outside our house held endless possibility."
var delay=50;
var currentChar=1;
var destination="[none]";
function type()
{
//if (document.all)
{
var dest=document.getElementById(destination);
if (dest)// && dest.innerHTML)
{
dest.innerHTML=text.substr(0, currentChar)+"_";
currentChar++;
if (currentChar>text.length)
{
currentChar=1;
setTimeout("type()", 5000);
}
else
{
setTimeout("type()", delay);
}
}
}
}
function startTyping(textParam, delayParam, destinationParam)
{
text=textParam;
delay=delayParam;
currentChar=1;
destination=destinationParam;
type();
}
$('#playbtn').click(function() {
javascript:startTyping(text, 50, "textDestination");
});
</code></pre>
| javascript jquery | [3, 5] |
202,062 | 202,063 | Android - contacts picker , too many results... names only list , how? | <p>Here is the code i use to open contacts picker:</p>
<pre><code>public void doLaunchContactPicker(View view) {
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
</code></pre>
<p>}</p>
<p>How can I open this with only names in contacts list when it opens from intent? Is their flags to add during intent to obtain this display effect when contacts picker starts?</p>
<p>much appreciated. ??</p>
| java android | [1, 4] |
1,720,856 | 1,720,857 | c# code in control attribute in aspx file | <p>I'd like to change the text attribute of a button according to the session landuage. So I write:</p>
<pre><code><asp:Button id="btOptIn" runat="server"
Text="<% = UI.Instance.TxtSubmit %>"
onclick="btOptIn_Click" />
</code></pre>
<p>This does not work. I tried several other versions (like <code>Text='<%# Eval(UI.Instance.TxtSubmit) %>'</code>) but could not succeed.</p>
<p>The same code (<code><% = UI.Instance.TxtSubmit %></code>) works outside the quotes of the attribute. What is the syntax to make it work within an attribute of a control?</p>
<p>Thank you for your time.</p>
| c# asp.net | [0, 9] |
239,147 | 239,148 | Why is the fact that Microsoft decided to support jQuery such a big deal? | <p>I don't see what all this fuss is about Microsoft's decision to support JQuery within ASP.NET MVC.</p>
<p>There were signs that open-minded people are starting to have some say in the matters of marketing for a while now. And even the way MS does business has started to change. But at it's core it's still acting in response to customers' requests.</p>
<p>I for one don't know what to make of it, except that it brings back to Microsoft's sphere of influence a very visible product.</p>
| jquery asp.net | [5, 9] |
57,123 | 57,124 | How to create table with different number of cell in each row programmatically? | <p>I am a new ASP.NET developer. I need to create a table with different number of cells in each row, so how to do that in C#?</p>
<p>I googled about it but I could not be able to find clear useful resource about this issue.</p>
| c# asp.net | [0, 9] |
1,901,461 | 1,901,462 | jQuery looking for scroll height code to determine when to add new items to lazy loading scrollable div [jsFiddle attached] | <p>I have a large array of items that I render with jQuery templates. I want to render 50 or so at a time, and show more when the user scrolls down. I'm trying to find the correct logic on working with the scroll bar. I am doing something like this, but the scrolling is still a bit wonky:</p>
<pre><code>var listItems = this.buildItemList(this.list, regex);
var renderItems = this.renderItems;
renderItems(listItems, wrapper, 50);
wrapper.scroll(function() {
// This works, but doesn't work quite right. Looks a bit wonky.
if (wrapper.scrollTop() > .5 * wrapper.children().length * wrapper.children().first().outerHeight())
{
renderItems(listItems, wrapper, 30);
}
});
</code></pre>
<p>View this jsFiddle I wrote, it's a great example of what I need.</p>
<p><a href="http://jsfiddle.net/8rWTg/32/" rel="nofollow">http://jsfiddle.net/8rWTg/32/</a></p>
<p>Here's what's not working for me. I want to items to get added when you're about 80% through the list, however, with the logic I made, it happens at varying points depending on the number of items in the list, and between browsers.</p>
| javascript jquery | [3, 5] |
1,217,795 | 1,217,796 | wheel of fortune for selecting player in jquery | <p>I am making a game Truth and dare in android. I am using WebView and js. I want a UI that will select player for its turn for asking truth or dare. in that view i want a wheel of fortune, in that wheel name of players will be written, number of players can be dynamic. is there any code available which can help me ? . code can be in jquery or in java. </p>
| java javascript jquery android | [1, 3, 5, 4] |
5,357,073 | 5,357,074 | Javascript function not returning result | <p>I have a function that is not returning a value the way I would like it to. What the function does is get information that is echoed from a PHP page (the PHP page has an SQL query) and return it. Here it the code:</p>
<pre><code>function getValues(var1,var2) {
$.post("http://url/to/file.php", {var1:var1,var2:var2}, function(data) {
values = data.split(',');
return values[0];
});
}
</code></pre>
<p>I know that the PHP file is working because if I were to write <code>alert(data);</code> or <code>alert(values);</code> I can see the values there. When I call the function, for example, <code>var result = getValues(5,6);</code> result is undefined. Maybe it is because they are not in a list or an array? Help appreciated, thanks.</p>
| javascript jquery | [3, 5] |
1,998,697 | 1,998,698 | automatically authenticate user using c# membership provider | <p>I am using c# membership provider and I get the username from a query string. Now I need to check if the username exist if it does I need to automatically authenticate the user.</p>
<p>How do I check if the user exists in the membership database?</p>
| c# asp.net | [0, 9] |
2,610,412 | 2,610,413 | Input string was not in a correct format - Converting textbox text to Int32 | <pre><code> Postalcode = Convert.ToInt32(txtcity.Text);
Mobileno = Convert.ToInt32(txmobileno.Text);
Phoneno = Convert.ToInt32(txtphoneno.Text);
</code></pre>
<p>I am getting this error please any one help</p>
| c# asp.net | [0, 9] |
738,822 | 738,823 | java Script User Define $ function like jquery | <p>I'm trying to Create user define $ function as i cannot use Jquery in existing project.</p>
<p>I want to get this function as work as Jquery $('ID')</p>
<p>Please give me some hint Any hint OR Example
for Example</p>
<pre><code>function $(element) {
}
var value = $('elementID').value
</code></pre>
<p><strong>UPDATE:</strong>
As i have prototype.js</p>
<pre><code>function $(element) {
if (arguments.length > 1) {
for (var i = 0, elements = [], length = arguments.length; i < length; i++)
elements.push($(arguments[i]));
return elements;
}
if (Object.isString(element))
element = document.getElementById(element);
return Element.extend(element);
}
</code></pre>
| javascript jquery | [3, 5] |
674,154 | 674,155 | how to a make label message disable after 10 seconds | <p>I have a form with two text boxes. Once I enter the data and click the save button, I get a message in label: indicating that it saved successfully.</p>
<p>Then i am in the same form again, but when I click on the save button, I get a message telling me that it cannot be blank "as textbox value is empty this time" from the required field validator.</p>
<p>But I am still showing the message "data saved successfully," which should not happen.
is there any way can after showing the message: data saved sucessfully. after 10 seconds. i can hide the label. are clear the value in tha label. sothati snt show the message
How do I solve this issue?</p>
<p>Thank you.</p>
| javascript jquery | [3, 5] |
5,797,311 | 5,797,312 | Android List View set default position without animation | <p>I have a table list view in my app. and user can add more data in the list. I would like to show the default list view position at the newly added data. however, i use if i use smoothScrollToPosition, there is animation slowly scrolling down, which is not desirable. Do you guys know how to set the default position without that animation?</p>
<p>thanks alot for reply!
regards
penny </p>
| java android | [1, 4] |
902,115 | 902,116 | Wire up button click events after AJAX post | <p>I have a HTML table with various rows, each have a delete button with a class. </p>
<p>On the DocumentReady event I wire up all buttons with this class to handle the click event. </p>
<p>On the click event it does a jQuery post which deletes data from the database and returns the table with the removed row. </p>
<p>If I go to click another delete button it doesn't do anything as if the click event is not wired up. I have tried wiring it up in the OnSuccess event as well as DocumentReady but nothing.</p>
| javascript jquery | [3, 5] |
2,347,722 | 2,347,723 | Ajax based File Uploads | <p>I'm looking for a javascript/ajax based file upload. The way it would work is this:</p>
<p>1) User clicks browse</p>
<p>2) User selects CTRL and selects the files he wants to upload</p>
<p>3) Via Javascript the user is shown a few loading graphics (1 per each file being uploaded)</p>
<p>4) After each upload finishes, a loading graphic is replaced with a success graphic and the filename of the uploaded file.</p>
<p>So what I'm really asking for is:</p>
<p>1) A way to do javascript/ajax based file uploads.</p>
<p>2) A way to detect when a file starts/finishes uploading, or to call a function when it happens.</p>
| javascript jquery | [3, 5] |
532,639 | 532,640 | jQuery: preview images | <p>I have a high-quality image and I want to generate <strong>img</strong> tag with this image.
The problem is that it will take a lot of time to load this image.
So the question is: how can I reduce image's quality without creating another one with low quality?</p>
| javascript jquery | [3, 5] |
2,722,968 | 2,722,969 | Why does jQuery store an element as a function? | <p>I am calling a div with an ID of car like this:</p>
<pre><code>var car = $('#car');
console.log(car);
</code></pre>
<p>When I log it, it comes back like this in the console:</p>
<pre><code>[div#car, context: document, selector: "#car", jquery: "1.9.0", constructor: function, init: function…]
</code></pre>
<p>Is the "constructor: function" part of the log telling me that it has been stored as a function, and if so why and how to get it to store as an object?</p>
| javascript jquery | [3, 5] |
2,338,401 | 2,338,402 | javascript match() error in IE8 | <p>I am having problems figuring out why IE8 doesn't like this:</p>
<pre><code>//get all checked values from the checkboxes with the option_checkbox class
var values = $j('input:checkbox:checked.option_checkbox').map(function () { return this.value; }).get();
if (values.length>0){
for (x in values){
if(values[x].match("v")){ // <--this line causes a javascript error in IE8
//do something here
}
}
}
</code></pre>
<p>I get this error:
"Object does not support this property or method"</p>
<p>I am thinking I should do some other sort of validation to verify type as perhaps map() and get() are not returning what I expect (a string with the value of that particular checkbox).</p>
<p>Any advice?</p>
| javascript jquery | [3, 5] |
2,027,937 | 2,027,938 | Check if asp.net control exists with jQuery | <p>When referring asp.net control inside a MasterPage in this way:</p>
<pre><code> $(function() {
$('#<%=txtMunicipio.ClientID%>').autocomplete({
source: function(request, response) {
$.ajax({
url: 'http://localhost/Autocomplete/WSAutocomplete.asmx/Poblacion',
data: 't=' + request.term,
type: 'POST',
//contentType: 'text/xml;charset=utf-8',
dataType: 'xml',
success: function(data) {
response(a = $.map(splitResponse(data), function(a, n) {
return formatCity(a, n);
}));
}
});
},
........
</code></pre>
<p>I am getting error "Object expected" because control does not exist in page. How can I check if control exists before associate autocomplete function?</p>
<p>Thanks in advance</p>
| jquery asp.net | [5, 9] |
1,993,760 | 1,993,761 | Pass variable between functions | <p>I have the following line of code that is executed inside the <code>$(document).ready</code>:</p>
<pre><code>$('#sliding_menu_area').toggle(effect, reAlign);
</code></pre>
<p><code>reAlign</code> is a function that is declared outside of the <code>$(document).ready</code> main function in my <code>.js</code> file.</p>
<p>I have a variable called <code>tag</code> that is declared also inside the <code>$(document).ready</code> and I need to pass the variable to the <code>reAlign</code> function. I tried </p>
<pre><code>$('#sliding_menu_area').toggle(effect, reAlign(tag));
</code></pre>
<p>but it didn't work. Can I declare the <code>tag</code> variable as a global so functions declared outside of <code>$(document).ready</code> to be able to access it? So far the functions declared inside the <code>$(document).ready</code> can access it just fine.</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
5,230,579 | 5,230,580 | jQuery.HTML not obeying formating within text | <p>Why dose the following not obey formating, the "li"s have no effect</p>
<pre><code><script>
function showENQ() {
jQuery('#enqtext').html("<li>showtext</li>");
}
$('#enq').live('pageshow', function () { showENQ(); });
</script>
<ul data-role="listview" data-filter="true" data-filter-placeholder="Search Enquirylist..."
data-theme="e" data-filter-theme="d" >
<div id="enqtext"></div>
</ul>
</code></pre>
| javascript jquery | [3, 5] |
5,319,846 | 5,319,847 | Is it impossible to make an Android game stutter-free? I am going crazy here | <p>I have been working on an Android game for the past 6 months or so, and have posted on here several times about various lag issues that I cannot get rid of.</p>
<p>I ended up grabbing the LunarLander example and stripping it down to its very core components to see if I could make anything at all that doesn't lag. All it really does is change the amount the canvas is translated each frame, and then draw a background onto the canvas. EVEN THIS, about as simple as you can get for a surfaceView application - stutters...</p>
<p>My game is a scrolling game where you continuously move up the screen (think of a flying game), but the way I am currently doing the background results in constant stuttering every second or so for about 50-100ms. This isn't game breaking, but it is very distracting and makes the game seem as if it was programmed by a complete moron (though I am starting to suspect this might be the case). </p>
<p>No, it is not the garbage collector, there are no new objects being created at all during the game's run loop, and the GC barely ever runs while my game is running.</p>
<p>I am practically tearing my hair out with frustration. I have spent over 40 hours just trying to get rid of the lag on this simple application example over the past week alone and it is driving me crazy. How can an application as simple as the one I have linked possibly have lag issues? You wouldn't think a scrolling background could get much simpler than that...</p>
<p>NOTE: This demonstration constantly gets about 60fps on my phone (A Motorola Milestone). Uncomment the FPS code in the example to see the FPS.</p>
<p>TL;DR: Extraordinarily simple program that is just a scrolling background shows stuttering. Please have a look...</p>
<p>Link to download simple stuttering example based off the LunarLander example:
<a href="http://dl.dropbox.com/u/4972001/LunarLander.rar" rel="nofollow">http://dl.dropbox.com/u/4972001/LunarLander.rar</a></p>
| java android | [1, 4] |
2,470,277 | 2,470,278 | Is jQuery's $(selector).eq(index) and $(selector)[index] the same? | <p>What is the difference between all these ways?</p>
<pre><code>//1
$('div').eq(index)
//2
$('div')[index]
//3
$($('div')[index] )
//4
$('div').get(1)
</code></pre>
<p>Are they same?</p>
<p><img src="http://i.stack.imgur.com/iXlVs.png" alt="ScreenShot"></p>
| javascript jquery | [3, 5] |
5,295,474 | 5,295,475 | ASP.net Get Path | <p>I have </p>
<pre><code>C:\Softwares\Test\ASPnetTest\Project11\Shared\Public\Images\
</code></pre>
<p>How to convert it to</p>
<pre><code>Shared\Public\Images\
</code></pre>
<p>Thank you.</p>
| c# asp.net | [0, 9] |
1,679,741 | 1,679,742 | can not read object property in javascript | <p>Trying to hide the left / right navigation text by listening to object & its properties.</p>
<p>working example : <a href="http://jsfiddle.net/ylokesh/9EyEu/29/" rel="nofollow">http://jsfiddle.net/ylokesh/9EyEu/29/</a></p>
<p>But, getting following error " Uncaught TypeError: Cannot call method 'hide' of undefined "</p>
<pre><code>if(!scroller) { var scroller = {}; }
scroller = {
next : "#leftControl",
prev : "#rightControl",
videos : {
hideButtons : function() {
var obj = this;
obj.next.hide();
obj.prev.hide();
},
init : function() {
var obj = this;
obj.hideButtons();
}
},
init : function() {
var obj = this;
obj.videos.init();
}
}
scroller.init();
</code></pre>
| javascript jquery | [3, 5] |
5,351,446 | 5,351,447 | How do I return stored preferences from another activity in Android? | <p>I cant seem to return a string to an activity in my android application from shared preferences.</p>
<p>In my UI class I have this:</p>
<pre><code> SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
format = preferences.getString("BallPref", "number");//not sure what needs to be in value
</code></pre>
<p>in Preferences.xml I have this:</p>
<pre><code><ListPreference
android:name="BallDisplayPreference"
android:key="BallPref"
android:summary="Show numbers or notes on balls"
android:title="Balls"
android:defaultValue="Fret"
android:entries="@array/listArray"
android:entryValues="@array/listValues" />
</code></pre>
<p>In the settings class I have this:</p>
<pre><code>public class Settings extends PreferenceActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
SharedPreferences preferences =
PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
editor.putString("BallPref", "Fret"); // value to store
editor.commit();
}
</code></pre>
<p>What I want to do is go into settings, and select my string option. then i want to find out what the user selected when the game starts. this doesn't seem to be working, any ideas on where I am going wrong?</p>
| java android | [1, 4] |
5,690,982 | 5,690,983 | Handling resizing over 100,000 uploaded images per day | <p>Currently we are resizing images in real time. Our users are uploading some 50K to 100K images per day. And our server is pegged at 100% cpu usage 24/7. And page load times are slow. <strong>Ram is not an issue.</strong></p>
<p>We have a <strong>Dual cpu intel xeon L5630 2.13GHz</strong> server with <strong>24 gigs</strong> of ram. And we are using a simple image resize script to make the thumbnails from the original image. But this is maxing out the cpu's.</p>
<p>I'd like to attack this problem both via hardware and software. </p>
<ul>
<li><p>On the hardware side we are going to order another server with Dual Xeon 3GHz processors. This server will handle the image processing seperate from the website.</p></li>
<li><p>On the software I'd like to ask someone with experience what kind of software they are using to process images with low cpu overhead.</p></li>
</ul>
<p>Any thoughts would be appreciated.</p>
| c# asp.net | [0, 9] |
5,745,543 | 5,745,544 | Editing in Existing Pdf File in asp.net | <p>I have written this code i want to edit the existing PDF file by removing already text and want to enter new data for edit but this code not work after adding text first text not removed.</p>
<pre><code>string fileName = "PdfFileDocument1.pdf";
string newFile = "File.PDF";
PdfReader reader = new PdfReader(Server.MapPath(fileName));
Rectangle size = reader.GetPageSizeWithRotation(1);
Document document = new Document(size);
// open the writer
FileStream fs = new FileStream(Server.MapPath(newFile), FileMode.Create, FileAccess.Write);
PdfWriter writer = PdfWriter.GetInstance(document, fs);
document.Open();
// the pdf content
PdfContentByte cb = writer.DirectContent;
// select the font properties
BaseFont bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
cb.SetColorFill(Color.BLUE);
cb.SetFontAndSize(bf, 8);
// write the text in the pdf content
cb.BeginText();
string text = "Some random Words";
// put the alignment and coordinates here
cb.ShowTextAligned(1, text, 100, 0, 0);
cb.EndText();
cb.BeginText();
// put the alignment and coordinates here
cb.ShowTextAligned(2, text, 0, 40, 0);
cb.EndText();
// create the new page and add it to the pdf
PdfImportedPage page = writer.GetImportedPage(reader, 1);
cb.AddTemplate(page, 0, 0);
// close the streams and voilá the file should be changed :)
document.Close();
fs.Close();`enter code here`
writer.Close();
reader.Close();
</code></pre>
| c# asp.net | [0, 9] |
4,073,860 | 4,073,861 | Request redirection handler | <p>I have win forms client application that should communicate with third party web services. Web services requires specific authentication and I should keep it secured from win forms client. To do it, i created HttpHandler (IHttpHandler), that adds authentication header.</p>
<p>Please find following workflow:</p>
<ol>
<li><p>Win forms application prepare web request for third party service and send it to my HttpHandler.</p></li>
<li><p>HttpHandler add authentification header</p></li>
<li><p>HttpHandler forward request to third party web service.(?)</p></li>
<li><p>Response directly returned to win forms application (this necessary, because the third party service can provide very big responses and these data shouldn't transfered through my HttpHandler).</p></li>
</ol>
<p>How I can forward request to third party web service?</p>
<p>RewritePath - works only in boundaries of one application and it can't forward request to another domain.</p>
<p>Response.Redirect is not solution, because it only notifies win forms application to send request to new location and doesn't keep authentication header.</p>
| c# asp.net | [0, 9] |
1,944,838 | 1,944,839 | debug script loaded with getScript | <p>How do you debug a script that was loaded with the jquery getScript(), it does not show up in the google chrome scripts list ? </p>
| javascript jquery | [3, 5] |
1,497,006 | 1,497,007 | Extending objects with JQuery, Object has no method error | <p>I have this javascript code:</p>
<pre><code>var TodoController = {
init: function() {
$(this).find('input.todo_check').click(function(){
$(this).parents('li.todo').done();
});
}
}
var Todo = {
done: function() {
$(this).toggleClass('done');
}
}
$(document).ready(function() {
$("li.todo").extend(Todo);
$("#todo_list").extend(TodoController).init();
});
</code></pre>
<p>When I click on a 'input.todo_check' I expect done() function, on 'li.todo', to be executed. But I get:</p>
<p>=> Uncaught TypeError: Object [object Object] has no method 'done'</p>
<p>What I'm doing wrong? </p>
<p>This statement should add 'done()' function to "li.todo" elements?:</p>
<pre><code>$("li.todo").extend(Todo);
</code></pre>
<p>Thanks.
JM</p>
| javascript jquery | [3, 5] |
2,963,928 | 2,963,929 | FadeOut for same link that was clicked | <p>I want with click on each link, after click on button <code>ok</code> in <code>myalert()</code> same link is <code>fadeOut()</code>. if clicked on cancel, is not <code>fadeOut()</code>. How can fix it with use of function <code>myalert()</code> ?</p>
<p><strong>Example:</strong> <a href="http://jsfiddle.net/MaGyp/11/" rel="nofollow">http://jsfiddle.net/MaGyp/11/</a></p>
<pre><code>function myalert() {
var result = true;
//var hide = $('.alert').fadeOut(100);
//var css = $('#appriseOverlay').css('display','none');
var $alertDiv = $('<div class="alert">Do you want to delete this item?<button class="ok">ok</button><button class="cancel">cancel</button></div>');
$('body').append($alertDiv);
$('.ok').click(function () {
$('.alert').fadeOut(100);
$('#appriseOverlay').css('display', 'none');
callback(true);
});
$('.cancel').click(function () {
$('.alert').fadeOut(100);
$('#appriseOverlay').css('display', 'none');
callback(false);
});
$alertDiv.fadeIn(100);
$('#appriseOverlay').css('display', 'block');
return result;
};
$('.iu').click(myalert)
function callback(result) {
//
if (result) {
$(this).fadeOut('slow');//I mean, this part from code
} else {
alert('no')
}
}
</code></pre>
| javascript jquery | [3, 5] |
3,307,418 | 3,307,419 | Dilemma with window.onbeforeunload and image | <p>The following is my main JS file:</p>
<pre><code>window.onbeforeunload = function () {
showME();
}
var ShowMe = function(){
$('<img src="http://cdn.sstatic.net/stackoverflow/img/sprites.png" style="position:fixed;left:0;top:0" />').appendTo('body');
}
</code></pre>
<p>When window.onbeforeunload gets called (i.e user navigating away from the page) ShowMe() gets executed but I do not see the image on the page.</p>
<p>However if you run showMe() in your console the image will show. </p>
<p>This is happening in all non-FireFox Browsers. Firefox seems to work fine. </p>
| javascript jquery | [3, 5] |
1,015,577 | 1,015,578 | Having Trouble Using LINQ to Objects on the Controls Collection of a Page | <p>I need to store data from a form for recovery from the session.
Below is my rough first attempt for a generalized method for textboxes:</p>
<p>Load Session:</p>
<pre><code>Dictionary<string, string> AppInfo = (Dictionary<string,string>) Session["ApplicantionInfo"];
this.Controls.OfType<TextBox>()
.ToList<TextBox>()
.ForEach( x => x.Text = AppInfo[x.ID] );
</code></pre>
<p>Save Session:</p>
<pre><code>Session["ApplicationInfo"] = this.Controls.OfType<TextBox>()
.ToList<TextBox>()
.ToDictionary<TextBox,string>(kvp => kvp.ID);
</code></pre>
<p>However, it appears that the Controls collection is not working for me. What am I doing wrong?</p>
<p><code>this.Controls.OfType<TextBox>()</code> yields no results at run time when I do a quick watch on it.</p>
| c# asp.net | [0, 9] |
914,117 | 914,118 | using c# variable in javascript | <p>I want to know how can I use a C# variable in javascript?</p>
| c# javascript | [0, 3] |
5,072,746 | 5,072,747 | Javascript C++ binding? | <p>I have some C++ code that I want to expose to client side of a web app. Ideally, I want to write Javascript wrapper objects for my C++ classes so that I can use them clientside.</p>
<p>Has this been done before?. Does anyone have a link to show how this may be achieved?</p>
| javascript c++ | [3, 6] |
410,036 | 410,037 | how to assign a class in jquery from a php variable? | <p>Is it possible to assign a class from a php variable to a new appended div in jquery?</p>
<pre><code>$newItems = $('<div class="PHP VARIABLE PRINTS HERE A CLASS"></div>');
</code></pre>
<p>In my case, for other things, I am defining a var to defign what I then append in jquery but I need to get the class of the newly inserted div from a php variable. Is it possible?</p>
| php javascript jquery | [2, 3, 5] |
2,367,556 | 2,367,557 | Disable checkboxes based on status of one checkbox | <p>if 'choose not to answer' is checked, i need to disable the other checkboxes, here is my code and html, any help as to why it's not working?</p>
<p><strong>code</strong></p>
<pre><code>function toggleStatus() {
if ($('#toggleElement').is(':checked')) {
$('#living :input').attr('disabled', true);
} else {
$('#living :input').removeAttr('disabled');
}
</code></pre>
<p><strong>html</strong></p>
<pre><code><p>With whom do you live? Choose all that apply<br/>
<input type="checkbox" name="living" value="alone" id="living">
Live alone <br>
<input type="checkbox" name="living" value="husband" id="living">
Husband <br>
<input type="checkbox" name="living" value="partner" id="living">
Partner <br>
<input type="checkbox" name="living" value="children" id="living">
Children <br>
<input type="checkbox" name="living" value="parents" id="living">
Parents <br>
<input type="checkbox" name="living" value="other_relatives" id="living">
Other relatives <br>
<input type="checkbox" name="living" value="religion" id="living">
Religious order <br>
<input type="checkbox" name="living" value="no_answer"
id="toggleElement">
Choose not to answer <br>
</p>
</code></pre>
| javascript jquery | [3, 5] |
2,365,675 | 2,365,676 | jquery fading in from full opacity to 0.2 | <p>when the page loads i would like the span overlay to fade in from full #000 to opacity 0.2
and then stay at 0.2 to which when i hover it goes to opacity 0</p>
<p>this is the code i have at the moment</p>
<pre><code>$(function () {
$('ul li a').append('<span id="load"></span>');
$('span').css('display', 'block').fadeOut(3400);
$('span') .animate ({
"opacity" : .2
});
$('span') .hover(function() {
$ (this) .animate ({"opacity": 0});
}, function () {
$(this).stop() .animate ({"opacity": .2 });
});
});
</code></pre>
<p>here is an example</p>
<p><a href="http://satbulsara.com/experiment-04/" rel="nofollow">http://satbulsara.com/experiment-04/</a></p>
| javascript jquery | [3, 5] |
3,098,314 | 3,098,315 | Javascript Opacity Issue | <p>Using absolute positioning, I have placed a div with opacity of 0.5 in front of an image by giving it a higher z-index. Also using absolute positioning, I want to put another smaller div in front of the first div using a higher z-index. This smaller div would show only part of the image (like a window), but have no opacity. Eventually, I will make the smaller image draggable. However, what I am struggling with is that, as long as the main div has the 0.5 opacity, the smaller one will also show the picture with the same opacity. How do I overcome this? </p>
| javascript jquery | [3, 5] |
982,626 | 982,627 | How to render a web page using the in-built android browser with the jdk? | <p>My app needs to use the in-built <strong>Internet Browser</strong> to render a web page.</p>
<p>How to do this kind of job?</p>
| java android | [1, 4] |
3,919,713 | 3,919,714 | jquery addclass error | <p>I have a little problem with jQuery:</p>
<pre><code>$('#form-submit').click(function () {
$('#textarea, #name').removeClass('error-state').addClass('normal-state');
var myName = $('#name').val();
var myContent = $('#textarea').val();
if ( myContent == '' || myName == '')
{
$('#textarea, #name').removeClass('normal-state').addClass('error-state');
return false;
}
[more code here]
});
</code></pre>
<p>This code works good for <code>#textarea</code> but doesn't for <code>#name</code>, I've check and re-recheck without find the error.</p>
<p>But, if we add:</p>
<pre><code>$('#name').val('some value');
</code></pre>
<p>before <code>return false;</code> change the value but the CSS class still the same.</p>
<p>Any ideas?</p>
| javascript jquery | [3, 5] |
2,330,230 | 2,330,231 | The import javazoom cannot be resolved | <p>hi all
i use the javazoom.jl.player.Player package but it is says The import javazoom cannot be resolved. i am using eclipse and doing Android project. i clean the project still the same error is shown. please correct me.</p>
| java android | [1, 4] |
2,043,191 | 2,043,192 | creating a data grid in javascript | <p>I want to know if there is an API to create a datagrid like here:</p>
<p><a href="http://socghop.appspot.com/gsoc/program/accepted_orgs/google/gsoc2010" rel="nofollow">http://socghop.appspot.com/gsoc/program/accepted_orgs/google/gsoc2010</a></p>
| php javascript | [2, 3] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.