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 |
---|---|---|---|---|---|
4,672,638 | 4,672,639 | Javascript - Jquery .load() and setInterval() issue | <p>Let's say I do this:</p>
<pre><code>$("#content").load(...);
</code></pre>
<p>Within what I'm loading some javascript is included:</p>
<pre><code>var myCounter = 0;
var myInterval = setInterval(function(){
myCounter++;
$("#counter-display").html("Count: "+myCounter);
});
</code></pre>
<p>For an unknown reason, if I reload the content with $("#content").load(...); - myInterval is now being called twice.</p>
<p>I tried doing something like:</p>
<pre><code>if (myInterval !== undefined){
//dont set interval again
}
</code></pre>
<p>However, it doesn't work. Does anyone know any method so that myInterval is cleared on .load, without needing to put the javascript outside of the loaded file?</p>
| javascript jquery | [3, 5] |
4,156,691 | 4,156,692 | jQuery: fixed top menu like in Facebook and Twitter | <p>How to do this with jQuery?</p>
<p>I know how to do this with css (position:fixed), but IE problems (doesn't know about fixed position) worry me.</p>
<p>Maybe there is some plugin, but I didn't find it...</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
1,695,067 | 1,695,068 | query a database on onblur textbox event asp.net C# | <p>I want to query database on onblur event of a textbox.
Simple I want is that when I enter the ID in first textbox and after onblur event occurs, the name of the respective ID from database is shown in another textbox or label.</p>
| c# asp.net | [0, 9] |
687,978 | 687,979 | Updating value of input field onclick - code have to reflect in source code | <p>I have issues updating input fields values on clicking "Save", it's basicaly not saving the newly typed stuff into the value (value stays old, if you right-click and check source)...</p>
<pre><code>function editCartInfo(){
$('#CheckEdit').html('edited');
$("#FullName").prop('disabled', false);
$("#Address").prop('disabled', false);
$("#DOB").prop('disabled', false);
$("#EditSave").html('<a onclick="saveCartInfo()" class="big-white-links">Save</a>');
}
function saveCartInfo(){
$("#FullName").val();
$("#FullName").prop('disabled', true);
$("#Address").val();
$("#Address").prop('disabled', true);
$("#DOB").val();
$("#DOB").prop('disabled', true);
$("#EditSave").html('<a onclick="editCartInfo()" class="big-white-links">Edit</a>');
}
</code></pre>
<p>input field code inside my PHP file:</p>
<pre><code><input type="text" name="Address" id="Address" value="' . $cart['StreetAddress'] . '" style="width: 299px" disabled="disabled" />
</code></pre>
<p>HTML:</p>
<pre><code><div class="link-in-heading-dark" id="EditSave">
<a onclick="editCartInfo()" class="big-white-links">Edit</a>
</div>
</code></pre>
| php jquery | [2, 5] |
4,876,484 | 4,876,485 | Javascript/jQuery - On hover over a li element, change class of another li element | <p>i am having some trouble with the menu bar on this website: <a href="http://www.re-generation.ro/ro/campanii/minerit-aurifer" rel="nofollow">http://www.re-generation.ro/ro/campanii/minerit-aurifer</a> .
Now, the second <code>li</code> element is active. What i want to do, is that on <code>hover</code> over any other <code>li</code> element in the menu, the <code>class</code> of the current active <code>li</code> element becomes blank and on on hover out, it becomes active again. If you visit the link you can easily understand what i what.</p>
<p>If you need any information pls ask.</p>
<p>thank you in advance!</p>
<p>My code:</p>
<pre><code>var lis = document.getElementsByTagName('ul');
for (var i=0, len=lis.length; i<len; i++){
lis[i].onmouseover = function(){
var firstDiv = this.getElementsByTagName('li')[1];
firstDiv.className = '';
var ul = $(this).parent(document.this.getElementsByTagName('ul')[1]);
ul.className = '';
};
lis[i].onmouseout = function(){
var firstDiv = this.getElementsByTagName('li')[1];
firstDiv.className = 'active';
};
};
</code></pre>
<p>EDIT: Thank you all for your answers! That really helped! </p>
| javascript jquery | [3, 5] |
2,098,657 | 2,098,658 | Script not working when called from .cs file | <p>I am tryong to do the following in a Row_Command event of a gridview. But the the pop up box never comes up, I have tried it in so many different ways.. but yet no luck. Please if someone can see the issue i would really appreciate a pointer.</p>
<pre><code>protected void Gridview_RowCommand(object sender, GridViewCommandEventArgs e)
{
if(e.CommandName == "Merchant")
{
if (ItemsAvailable)
{
StringBuilder sb = new StringBuilder();
MyClass class = new MyClass();
TList<LineItems> otherItems = MyClass.GetItems(id);
bool IsNotAvailable = false;
foreach (LineItems item in otherItems)
{
Merchandise skuMerchandise = skuMerchandise.GetMerchandise(otherItems.mid);
if (skuMerchandise != null)
{
if (skuMerchandise.AvailableItems <= 0)
{
sb.Append(OtherItems.Name);
sb.Append(Environment.NewLine);
IsNotAvailable = true;
}
}
}
if (IsNotAvailable)
{
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "key",
"function Redirect() {location.href = 'homePage.aspx';}
if(confirm('The items : "+sb.ToString()+" will arrive in 1 month.
Do you wish to continue?') == true){Redirect();};", true);
}
}
}
</code></pre>
<p>Everytime i click the button, it just passes like nothing.. never prompts eveb though IsNotAvailable is true when I add a breakpoint.</p>
| c# asp.net | [0, 9] |
93,675 | 93,676 | How do you find all divs by class and delete them all? | <p>I have many divs with a specific class and I want to delete all those divs. How do you do this using jQuery or javascript? But, how do you delete <b>all divs</b> with a specific class? Thanks!</p>
<p>code:</p>
<pre><code><div>
<div class='testa'>test a</div>
<div class='testb'>test b</div>
<div class='testc'>test c</div>
<div class='testa'>test a</div>
<div class='testb'>test b</div>
<div class='testc'>test c</div>
<div class='testa'>test a</div>
</div>
</code></pre>
<p>How would you delete all div's with the <code>testa</code> class?</p>
| javascript jquery | [3, 5] |
4,870,581 | 4,870,582 | How to pass optional parameters for web method? | <p>I have a web method with multiple parameters. The web method is only dependent on 2 fields, the rest are all optional.</p>
<pre><code> [OperationContract]
public string WarehouseContactInformation(int WAID (Required), string CN (Required), string CT (Optional), string CC (Optional), string CFN (Optional), string CD (Optional), string CE (Optional),string CW (Optional))
</code></pre>
<p>How to I declare these parameters as optional so that when I call the Web Method I only have to pass through the fields that i have values for, example:</p>
<pre><code>WarehouseContactInformation(1,'Bill','00012311')
WarehouseContactInformation(1,'Bill','00012311','12415415','123525')
</code></pre>
| c# asp.net | [0, 9] |
4,843,077 | 4,843,078 | Get the caller id | <p>I'm trying to make app which will log my incoming and outgoing calls and the problem is i can't seem to get working this code to return caller id(Like name and surname) but it allways returns "Unknown"</p>
<pre><code>public String getname(String num,String nbc ){
String namer="";
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null);
try {
if (cur.getCount() > 0) {
while (cur.moveToNext()) {
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
Log.i("",name);
if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
System.out.println("name : " + name + ", ID : " + id);
// get the phone number
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
String phone = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
System.out.println("phone" + phone);
if(phone==nbc||phone==num)
{
namer = name;
return namer;
}
}
pCur.close();
}
}
}
}
catch (Exception e) {
// TODO: handle exception
}
return namer;
</code></pre>
<p>}</p>
<p>It doesn't execute this(<code>if(phone==nbc||phone==num)</code>) part. </p>
<p>Can you please tell me what's wrong or another way to do this or at least point me in the right direction.</p>
| java android | [1, 4] |
4,742,926 | 4,742,927 | Accessing properties of a jQuery object using .load | <p>I have the following funciton: </p>
<pre><code> $('<img/>').attr('src', lrgSrc).load(function(){
console.log($(this).innnerHeight())
})
</code></pre>
<p>The value is always 0, I would like to access the loaded images height. Can someone lend some insight on how to do this please. I feel like this should not be too far off.</p>
| javascript jquery | [3, 5] |
568,079 | 568,080 | CKEditor character count JavaScript function not working | <p>I placed the Jquery and CSS from the below link into my website.</p>
<p><a href="http://jsfiddle.net/VagrantRadio/2Jzpr/" rel="nofollow">http://jsfiddle.net/VagrantRadio/2Jzpr/</a></p>
<p>But I can't see the character countdown. What am I doing wrong?</p>
| javascript jquery | [3, 5] |
2,160,995 | 2,160,996 | <%@ Page Debug="True" ...... %> | <p>Does setting this value have the same effect as setting the debug="true" in the web.config file? If not, what does it do? </p>
<p>Thanks for the help.</p>
| c# asp.net | [0, 9] |
4,561,194 | 4,561,195 | copy value string directory to my project | <p>I develop android app on my mac;
when I finish a project ,for finishing Localization,I copied value file to my project which is in the old project ,such as value-ko-rKR,but it will cause some problem so I can't compile my project ;
in the end ,I find out that I must copy the content of string.xml to string.xml in my present value file;I can't copy value file directly from other project;
it makes me confused;who can tell me why?
is need some hidden file need to configurate or something?
thanks a a million. </p>
| java android | [1, 4] |
555,096 | 555,097 | How to get value of TextBox before postback in ASP.NET | <p>I have a TextBox(enabled with PostBack). I need to store the value of it before it's postback. Is it possible? If so, can you please tell me how? </p>
<p>Eg : I enter "10" in my TextBox. Then, in it's PostBack, a message box appears, telling "You have entered Ten!". Next, I enter "100" in my TextBox, this time, a message box appears and tells, "You have not entered the correct number!". Upto this point, it's Okay. But now what I need is, when I press the Okay button in the second mentioned message box, the number "10" should be displayed in the TextBox. </p>
<p>Thanks in advance!</p>
| c# asp.net | [0, 9] |
5,980,046 | 5,980,047 | Dynamically added table in asp.net not clearing styles | <p>I have a table who's rows are added dynamically in the code behind. The table sits inside an update panel:</p>
<pre><code> <asp:UpdatePanel runat="server" ID="upnlPR">
<ContentTemplate>
<asp:Table ID="tblPR" runat="server">
</asp:Table>
</ContentTemplate>
</asp:UpdatePanel>
</code></pre>
<p>When I do a tblPR.Rows.Clear() in the code behind, the table draws itself up again correctly but it appears that the formatting that was applied to the row in that position before the redraw is still applied to the cell which is incorrect. Any idea why this is happening?</p>
<p>I have tried making the UpdatePanel updatemode conditional and doing a upnlPR.Update() after clearing the rows but this problem persists. Particular problems being: Styles applied to cell in that row number / cell position still applied, column span of the cell in that row number / cell position still applied.</p>
<p>Thanks!</p>
<p>(asp.Net, C#)</p>
<p>To style the cells <code>cell.CssClass = competencyAchievementView.ManagerScore > competencyAchievementView.UserScore
? "manWorseScore"
: "manBetterScore";</code></p>
| c# asp.net | [0, 9] |
2,855,824 | 2,855,825 | Which technology/programming is used for drag and drop web programming? | <p>I'd like to work on drag and drop web programming. I want the data to be moved from one panel to another panel by the drag and drop feature as we experience in Google Plus. I might have panels/frames in a page like To-be-done section, Done section etc. When I'm done with a particular item, I'd drag the item from the To-be-done section to the Done section. I've a raw idea at present. Please share your thoughts on which resources (IDE/Programming/Technology) to be useful to begin my project.</p>
| php asp.net | [2, 9] |
436,583 | 436,584 | jQuery $.post string escape problem | <p>I am posting data to a php file via jQuery's $.post method, but for some reason the string comes out escaped on the other side, like so,</p>
<p>Sent:
<code>company_name="company"</code></p>
<p>Received:
<code>company_name=\"company\"</code></p>
<p>Any idea what could be the cause?</p>
<p>Thanx in advance!</p>
| php jquery | [2, 5] |
2,330,345 | 2,330,346 | .append link will not fire onclick function | <p>I've searched around I cannot find the answer to this. In my code, a link is created inside of a div and given an onclick value to pass an argument to a function. I cannot figure out why it will not fire.</p>
<pre><code>var imgCount = 0;
var curImg;
function resetImg(target) {
alert(target);
}
$(".add").click(function () {
imgCount = imgCount + 1;
curImg = "theImg" + imgCount;
//Here we add the remove link
$('#links')
.append('<a href="#" onclick="javascript:resetImg(\'' + curImg + '\');" class="dynamic">Call Function</a>');
$('.dynamic').css('display', 'block');
});
</code></pre>
<p>Here's the fiddle:
<a href="http://jsfiddle.net/stewarjs/4UV7A/" rel="nofollow">http://jsfiddle.net/stewarjs/4UV7A/</a></p>
<p>I've tried using .click() when creating the link, but the argument being passed needs to be unique to each link. I've tried grabbing $(this).attr("id") but the value comes back undefined.</p>
<p>Thanks for any and all help.
Jeff</p>
| javascript jquery | [3, 5] |
5,307,173 | 5,307,174 | How to add @ symbol to string in android? | <p>I am working on android. In my project I am adding '|' symbol and '@' symbol to string but it is not adding @ symbol. I am not
getting where I went wrong. Please help me with this.</p>
<pre><code>String str="";
str = str + "|" + id + "@" + id2 + "@" + id3;
</code></pre>
<p>When I print the string "str" it is displaying only id value but it is not printing id1 and id2.
Output:
|13</p>
| java android | [1, 4] |
4,187,341 | 4,187,342 | Need solution for a jquery slideshow | <p>I am a novice jQuery user and i need some help in implementing a slideshow for a website. The images are to be changed automatically within a specific interval (i know about setInterval). I tried to use this plugin <a href="http://tobia.github.com/CrossSlide/" rel="nofollow">CrossSlide</a>. </p>
<p>However, the images that need to be displayed are actually pulled from a database and they vary from listing to listing. This plugin needs the images to be given as arguments beforehand and this is not possible.</p>
<p>Also, image thumbnails should be displayed so when the user clicks on one, that image will be loaded and the slideshow should continue from that image. If i use clearInterval, i have to start the show from beginning. I am preferring this plugin because it has a Pause() and Resume() extension. </p>
| javascript jquery | [3, 5] |
1,114,782 | 1,114,783 | Is it a good idea to write jQuery plugins just for the sake of neat code? | <p>For example if you write a plugin you could do this <code>$('#myDiv').doAction()</code> instead of <code>doAction($('#myDiv'))</code>. and you have to admit, the first one looks more intuitive. Are there any clear drawbacks of this like performance hits?</p>
| javascript jquery | [3, 5] |
5,206,819 | 5,206,820 | String was not recognized as a valid DateTime.Couldn't store <22/06/2012 12:00:00 AM> in Purchase Date Column.Expected type is DateTime | <p>I am receiving this exception on XP running machine but on windows 7, there is no issue. I am trying to format date time as follows, </p>
<pre><code>dr.BeginEdit();
dr["Pdate"] = ((DateTime)dr[dc]).ToString("dd/MM/yyyy hh:mm:ss tt", CultureInfo.InvariantCulture);
dr.EndEdit();
dr.AcceptChanges();
</code></pre>
<p>It is working fine for '2012-03-04 00:00:00.000' but issue is for '2011-06-22 00:00:00.000'
Any idea?</p>
| c# asp.net | [0, 9] |
3,419,782 | 3,419,783 | Validation in jquery , | <pre><code><div id="default-box">
<span class="add"><input type="text" class="name" /><input type="text" class="email"/></span>
<span class="add"><input type="text" class="name" /><input type="text" class="email"/></span>
<span class="add"><input type="text" class="name" /><input type="text" class="email"/></span>
</code></pre>
<p>
There is a button to submit.</p>
<pre><code>validation:
</code></pre>
<p><code>1.</code> On these three row if any row is filled it is OK, if all three row is empty then it is invalid.</p>
<p><code>2.</code> While writing emails if it is wrong it validates on loosing focus.</p>
| javascript jquery | [3, 5] |
5,769,461 | 5,769,462 | How to link to specific anchor in table with jquery | <p>I am using this jquery plugin:</p>
<p><a href="http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx" rel="nofollow">http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx</a></p>
<p>I have anchors in the code such as:</p>
<pre><code><a name="art" id="art2"></a> Articles
</code></pre>
<p>How can I open that particular row then? In other words, when a user clicks a link from another page to this landing page I would like the appropriate row to open up based on the anchor tag.</p>
<p>Thanks in advance!</p>
| javascript jquery | [3, 5] |
1,961,338 | 1,961,339 | Remove empty <li> using jQuery | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1520981/remove-empty-elements-with-jquery">Remove Empty elements with jQuery</a> </p>
</blockquote>
<p>I want to remove empty <code><li></code> using jQuery. I am trying to do this but my code is not working as per my requirements. My code is show below.</p>
<p><strong>Script</strong></p>
<pre><code>$(document).ready(function(e) {
$('#u li').each(function() {
if($(this).html(' ')) {
$(this).remove();
}
});
});
</code></pre>
<p><strong>HTML</strong></p>
<pre><code><ul id="u">
<li>hi</li>
<li></li>
</ul>
</code></pre>
| javascript jquery | [3, 5] |
956,869 | 956,870 | Disabling and enabling a html button | <p>So I have a button like this:</p>
<pre><code><input id="Button" type="button" value="+" style="background-color:grey" onclick="Me();"/>
</code></pre>
<p>How can I disable and enable it when I want? I have tried <code>disabled="disable"</code> but enabling it back is a problem. I tried setting it back to false but that didn't enable it. </p>
| javascript jquery | [3, 5] |
2,438,935 | 2,438,936 | Clarification/explanation of RegisterClientScriptInclude method | <p>I've been looking on the Internet for a fairly clear explanation of the different methods of registering javascript in an asp.net application. I think I have a basic understating of the difference between registerStartupScript and registerClientScriptBlock (the main difference being where in the form the script is inserted).
I'm not sure I understand what the RegisterClientScriptInclude method does or when it is used. From what I can gather, it is used to register an external .js file. Does this then make any and all javascript functions in that file available to the aspx page it was registered on? For example, if it was registered in the onLoad event of a master page, would all pages using that master page be able to use the javascript functions in the .js file? What problems would arise when trying to use document.getElementById in this case, if any?
Also, when it is necessary/advantageous to use multiple .js files and register them separately? </p>
<p>I appreciate any help you can give. If you know of any really good resources I can use to get a thorough understanding of this concept, I'd appreciate it!</p>
| asp.net javascript | [9, 3] |
2,157,137 | 2,157,138 | jQuery not ready though still instantiating | <p>I am using a jQuery Class plugin as so :</p>
<pre><code>jQuery(document).ready(function($) {
window.SSK.calendar = new(Class.extend({
filter_by_filtered_names: function() {
console.log('foobar!');
},
init: function() {
if ( window.location.href.match(/name_filters/) ) {
SSK.calendar.filter_by_filtered_names();
};
}
}))
});
</code></pre>
<p>For some reason this returns on load :</p>
<pre><code>SSK.calendar is undefined
</code></pre>
<p>Which tells me that the plugin class is not loading before its own call. Very strange indeed. Curious if anyone knew a remedy?</p>
| javascript jquery | [3, 5] |
70,914 | 70,915 | jquery: function to end another function | <p><code>$('#start')</code> executes the function <code>myFunction()</code> and <code>$('#stop')</code> end it. How do I stop <code>myFunction()</code> from executing?</p>
<p><br> </p>
<pre><code>function myFunction() {
$(document).mousemove(function(e) {
$('#field').html(e.pageY)
});
}
$('#start').click(function() {
myFunction();
});
$('#stop').click(function() {
//stop myFunction
});
</code></pre>
| javascript jquery | [3, 5] |
1,238,520 | 1,238,521 | My Code Works On jQuery 1.3.2 But Not on 1.6.4 | <p>I have this following codes that works perfectly on jQuery 1.3.2 :</p>
<pre><code> $("#passwordLabel").click(function()
{
$(this).hide();
$("#password").focus();
}
);
$("#confirmpasswordLabel").click(function()
{
$(this).hide();
$("#confirmpassword").focus();
}
);
$("#password").focus(function()
{
$("#passwordLabel").hide();
}
);
$("#confirmpassword").focus(function()
{
$("#confirmpasswordLabel").hide();
}
);
$("#password").blur(function()
{
if($(this).val()=="")
{
$("#passwordLabel").show();
}
}
);
$("#confirmpassword").blur(function(value)
{
if($(this).val()=="")
{
$("#confirmpasswordLabel").show();
}
}
);
});
</code></pre>
<p>but unfortunately, this codes doesn't work anymore when I change my jQuery Library into version 1.6.4.</p>
<p>is that because jQuery 1.6.4 doesn't have that syntax anymore?</p>
| javascript jquery | [3, 5] |
90,094 | 90,095 | how to move text on mouse over in jquery? | <p>How to make a link moving to left when mouse over? I want the text move back when mouse out. Is it possible with jquery? Please help.</p>
<p>Thank You</p>
| javascript jquery | [3, 5] |
4,663,622 | 4,663,623 | Handling dynamic number of columns | <p>I'm developing a CMS of sorts, and I want to give my users the possibility of customizing the display. More precisely, I want to give them the ability to choose to display or hide the left column, the right column and/or the top div. The middle column cannot be hidden since this is where the actual content will show, whereas the other columns are for navigation or side menus.</p>
<p>I've been looking for a way to make this as smart and flexible as possible. For now I'm using a MasterPage, but that seems to be too constraining. For instance, with MasterPage you need to add a ContentPlaceHolder control in every of your ASPX pages.</p>
<p>What are the best practices in this area? I guess a simpler way of saying this would be "I want to create a template system over which I have complete control".</p>
| c# asp.net | [0, 9] |
5,112,016 | 5,112,017 | JavaScript onClick href | <p>with the use of <code><a></code> tag, i can put like:</p>
<pre><code><a href="include/sendemail.php?id_user=<?= $_GET['id_user'];?>" onclick="return confirm('Are you sure want to send an email?');" >Send Email</a>
</code></pre>
<p>and how do apply that code to button :</p>
<pre><code><input type="button" onclick="return confirm('Are you sure want to send an email?');" value="Send Email" >
</code></pre>
| php javascript | [2, 3] |
3,435,172 | 3,435,173 | Jquery | Function inside same function. It bad practice? | <p>I am using this function for easiness, as I am going to use fadeTo a lot:</p>
<pre><code>function fade_to(div, speed, opacity, after_fade) {
$(div).fadeTo(speed, opacity, after_fade);
}
</code></pre>
<p>Then I am calling the same function for after_fade parameter:</p>
<pre><code>fade_to('#div', 3000, 1, function() { fade_to('#another_div', 3000, 1)});
</code></pre>
<p>Is that a bad thing to do? Will I have speed/smoothness issues?
Is it better to just use jQuery's default fadeTo function?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
2,033,926 | 2,033,927 | How to tell a page to load a JS function based on variables being sent | <p>I have a function which loads some content when executed...</p>
<p>IE...</p>
<pre><code>function load_product(product_id) {
$.ajax({
type: 'GET',
url: 'product_image.php',
data: 'product_id='+product_id+'',
success: function(data) {
$('#product_image').html(data);
}
});
}
</code></pre>
<p>That works great. But say I want to create a link to a page, so that then something triggers to load up the dynamic content?</p>
<p>IE I link to a page, say </p>
<pre><code>www.blah.com/?product=1
</code></pre>
<p>and a few 'divs' on the page that load up different things dynamically for product #1.</p>
<p>The way I currently do it is by doing something:</p>
<pre><code><?php
if($_REQUEST['product_id']) {
echo '
<script type="text/javascript">
$(document).ready(function(){
load_product(' . $_REQUEST['product_id'] . ');
});
</script>
';
}
</code></pre>
<p>And I put that somewhere on the new page being loaded. It works. But is there a better way?</p>
| php javascript jquery | [2, 3, 5] |
4,545,141 | 4,545,142 | Input string was not in a correct format? | <p>In my application i write the code like this</p>
<pre><code>byte[] byt = new byte[Convert.ToSbyte(textbox1.Text)];
</code></pre>
<p>it is giving the error that input string was not in a correct format.</p>
| c# asp.net | [0, 9] |
877,771 | 877,772 | Nationality of site traffic in realtime? | <p>You see a whole lot of sites now which, when you visit, know what town the visitor is from - usually it's dating sites telling me there are "Single Girls in the London area".</p>
<p>Does anyone know how this is done?</p>
<p>I know it's not 100% reliable, but I want to show a banner which ha either £££, or $$$.</p>
<p>Thanks.</p>
| php javascript | [2, 3] |
3,023,664 | 3,023,665 | Unable to call Javascript function onload a asp:button using ASP.NET4 | <p>I am unable to call a Javascript function on the OnLoad event of a asp:button</p>
<p>HTML</p>
<pre><code><asp:Button ID="btnFromCalOpen" runat="server" Text=" &gt; " onLoad = "AllHide()" OnClientClick ="ShowCal()" />
</code></pre>
<p>Javascript</p>
<pre><code> function AllHide() {
alert("Hello");
}
</code></pre>
<p>Please Help</p>
| javascript asp.net | [3, 9] |
4,402,727 | 4,402,728 | About Android compiler | <p>When building an Android application, which compiler does ADT use? ECJ or Javac? Does it provide the compiler for Dalvik machine?</p>
| java android | [1, 4] |
2,066,018 | 2,066,019 | How to hide menubar, ftoolbar in IE | <p>There is a HTML page. I would like to hide the menubar, ftoolbar in IE when the page id opened.</p>
<p>I do not want to open the page from another web page (<code>window.open(....)</code>). I just want to open the current web page directly!</p>
<p>How can I do this with jQuery or plain JavaScript?</p>
| javascript jquery | [3, 5] |
4,974,604 | 4,974,605 | Still confused about $'s before variables in javascript / jquery | <p>In my previous <a href="http://stackoverflow.com/questions/10443463/do-i-need-to-put-a-dollar-before-variable-names-with-javascript">question</a> a poster suggested the following:</p>
<pre><code>var formSubmitHandler = function (link, form) {
var $form = $(form);
var val = $form.valid();
var action = $form.data('action');
var entity = $form.data('entity');
</code></pre>
<p>I understand now that the $ before is used to show the variable is a jQuery object. My question is Why do I need the line "var $form = $(form)" ? Could I not just have $form = form?</p>
| javascript jquery | [3, 5] |
1,162,910 | 1,162,911 | Checkbox change function does not work except clicking on it | <p>I have written a function for a hdcheck checkbox.</p>
<pre><code>$('#hdcheck').change(function () {
if($(this).is(':checked')) {
alert("It is Checked");
}
else {
alert("It is Unchecked");
}
});
</code></pre>
<p>It works find when I check or uncheck the checkbox but I have made a function that problematically make this checkbox checked or unchecked.
Here is the function on checkbox <code>chk_1</code>:</p>
<pre><code>$('#chk_1').change(function () {
if($(this).is(':checked')) {
$('#hdcheck').prop("checked", true);
}
else {
$('#hdcheck').prop("checked", false);
}
});
</code></pre>
<p>This function works fine on making the first checkbox (<code>hdcheck</code>) checked or unchecked but it does not pop ups the alert message. Mean the function <code>$('#hdcheck').change(function()</code>
does not work.</p>
| javascript jquery | [3, 5] |
5,918,115 | 5,918,116 | getting values from an array (JS / jQuery) | <p>I'm passing an array to a function I want to be able to show or hide columns in a table depending on what's passed.</p>
<p>So, if I pass 1,3,4 columns 1 3 and 4 should show - column 2 should not. </p>
<p>I can handle the show/hide bit. I'm just not sure how to grab the values from the array</p>
| javascript jquery | [3, 5] |
4,856,517 | 4,856,518 | Sending information from android app to a php script | <p>I'm neither a android or php expert, the thing is that I made a php script that gets the variables from the url ( <code>www.myhost.com/mailScript.php?variable1=name&variable2=age</code> ) and sends a mail with that information.</p>
<blockquote>
<p>Mail:<br>
Variable1=Name<br>
Variable2=Age </p>
</blockquote>
<p>Now, the problem is that i'm makin a android app that converts a normal form, which ask name, age, etc. And i want to take that information and run php script. But i dont want the users to see a web browser at any time, just that they click de button, get the info, run the url, and done.</p>
| php android | [2, 4] |
90,448 | 90,449 | Drawing a bitmap-animation doesn't work | <p>I got the following problem with drawing an animation on a surfaceview in android:</p>
<p>I use a thread to make the onDraw()-method get called regulary, and i use this:</p>
<pre><code>c.drawBitmap(pic, partOfTheImage, destination, null);
</code></pre>
<p>to draw the part of the spritesheet i want to draw.
The problem now is that altough i change "partOfTheImage", the only thing thats drawn is what was drawn first. It doesnt change, no animation.</p>
<p>Here is the code in the thread:</p>
<pre><code> try {
c = getGw().getHolder().lockCanvas();
synchronized (getGw().getHolder()) {
getGw().onDraw(c);
}
} finally {
if (c != null) {
getGw().getHolder().unlockCanvasAndPost(c);
}
}
</code></pre>
<p>Does anyone know why my Bitmap isnt updating?</p>
| java android | [1, 4] |
3,773,842 | 3,773,843 | How to exclude hidden variables from createRange object | <p>As mentioned in the Question, How can i exclude hidden elements from the document range object. With the below code I can create entire body text range. But I want to exclude hidden elements </p>
<pre><code>document.body.createTextRange()
</code></pre>
<p>I am experimenting with the below code </p>
<pre><code>$(':hidden').blur();
document.body.createTextRange()
</code></pre>
<p>But it does not work for me. </p>
<p>Please help me on this.</p>
| javascript jquery | [3, 5] |
2,099,846 | 2,099,847 | what is the meaning of the word "this" in Jquery script | <p>Hello I'm a newcomer in JavaScript and JQuery language. I started to see some examples of JQuery script.</p>
<p>i have the following code segment:</p>
<pre><code> <script type="text/javascript">
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
</code></pre>
<p>My question: what is the meaning of word <strong>"this"</strong> in this line of code:</p>
<pre><code> $(this).hide();
</code></pre>
| javascript jquery | [3, 5] |
529,375 | 529,376 | setInterval update ajax column unless mouseover | <p>I have a column in my web design, which is periodically refreshed by a JS function "refreshColumn()" and updated by AJAX.</p>
<pre><code>setInterval('refreshColumn()',60000);
function refreshColumn() {
..make call with AJAX and load response to element...
document.getElementById('myColumn').innerHTML = xmlhttp.responseText;
}
</code></pre>
<p>This is okay, however, it's not very practical when my user is actually using that column and it refreshes on them!</p>
<p>Is it possible to modify what I have already, to incorporate an 'onmouseover' event that will stop the function from running the AJAX and refreshing the column, and 'onmouseout' allows the script to refresh again?</p>
| javascript jquery | [3, 5] |
357,135 | 357,136 | Javascript function not working after postback? | <p>Here i am trying to increase the height of the iframe after postback but it is not working and the alert itself is not popping up.Here is my code</p>
<pre><code>function increaseiframesize() {
alert("aaaaaa");
$('#MainContent_IFTrendAnalysis').height('523');
}
</code></pre>
<p>and </p>
<pre><code>protected void lnkBTNSubmit_Click(object sender, EventArgs e
{
TextBox txtTextBoxRetailGroup = (TextBox)uscRetailParameters.FindControl("txtRetailCustomerGroup");
TextBox txtTextBoxPPGroup = (TextBox)uscRetailParameters.FindControl("txtProductGroup");
if (txtTextBoxRetailGroup.Text != string.Empty && txtTextBoxPPGroup.Text != string.Empty && txtATrendStartDate.Text != string.Empty && txtATrendEndDate.Text != string.Empty)
{
this.IFTrendAnalysis.Attributes.Add("src", "");
ScriptManager.RegisterStartupScript(this, this.GetType(), "ScriptRegistration", "increaseiframesize();", true);
}
}
</code></pre>
<p>and</p>
<pre><code><asp:UpdatePanel ID="Update" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<iframe id="IFTrendAnalysis" name="IFTrendAnalysis" scrolling="auto" runat="server"
width="100%" height="403" frameborder="0"></iframe>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="imgBTNSalesTrendChart" />
<asp:AsyncPostBackTrigger ControlID="imgBTNSalesLiftChart" />
<asp:AsyncPostBackTrigger ControlID="lnkBTNSubmit" />
<asp:AsyncPostBackTrigger ControlID="imgBTNSalesLiftChart" />
<asp:AsyncPostBackTrigger ControlID="imgBTNTAEventROI" />
<asp:AsyncPostBackTrigger ControlID="imgBTNTrendAnalyzeTBL" />
</Triggers>
</asp:UpdatePanel>
</code></pre>
<p>Any suggestion???</p>
| c# javascript asp.net | [0, 3, 9] |
601,126 | 601,127 | Gridview break Literal field into multi line | <p>I have a gridview with this field:</p>
<pre><code><asp:TemplateField HeaderText="Title">
<ItemTemplate>
<asp:Literal ID="lblTitle" runat="server" Text='<%# Eval("Title") %>' />
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>If the title is too long it completely breaks the gridview.
How can I: </p>
<ol>
<li>Make the width of this column fixed.</li>
<li>If the content is too long, break it into multi lines.</li>
</ol>
| c# asp.net | [0, 9] |
5,320,738 | 5,320,739 | How to choose each element from an array in their respective order? (jquery, JS) | <p>My code:</p>
<p>I understand that my for loop assigns all array elements to the variable pickSound and that is why I am left with it only playing the last element. So how can I get it to play each element in order and start over once done. </p>
<pre><code> function show() {
var sounds = new Array(
"audio/basement.mp3",
"audio/roll.mp3",
"audio/gatorade.mp3",
"audio/half.mp3",
"audio/hotdogs.mp3",
"audio/keys.mp3",
"audio/heil.mp3",
"audio/money.mp3",
"audio/ours.mp3",
"audio/pass.mp3"
);
for (var i = 0; i < sounds.length; i++){
var pickSound = sounds[i];
}
$('#divOne').html("<embed src=\""+ pickSound +"\" hidden=\"true\" autostart=\"true\" />");
return false;
};
</code></pre>
| javascript jquery | [3, 5] |
1,177,107 | 1,177,108 | jquery javascript - clear checkboxes on changing autocomplete field | <p>I have the below script:</p>
<pre><code>$("#product1").autocomplete({
source: "get_sku_family",
messages: {
noResults: '',
results: function () {}
},
select: function (event, ui) {
var selectedObj = ui.item;
$.post('get_as_09',
{
data: selectedObj.value
},
function (result) {
if (result[0] > 0) {
$('#h09_1').attr('checked', 'checked');
} else {
$('#h09_1').removeAttr('checked');
}
}
});
}
});
</code></pre>
<p>This has an autocomplete field that when text is entered provides options from a database. this works. then on clicking an option from the autocomplete, it queries the database with a function(<code>get_as_09</code>) and checks the checkbox based on the result.</p>
<p>Again this works 100%. </p>
<p>What I do want to change though, is that when I enter a new value on the autocomplete, it must clear the checkboxes before applying the new database lookup logic to check the boxes.</p>
<p>I just don't know where to add the <code>$('#h09_1').removeAttr('checked');</code></p>
<p>Thanks and Regards...</p>
<p>any help appreciated</p>
<p><strong>UPDATE</strong> Ripu</p>
<pre><code>if(data:selectedObj.value.length ==0 ){$('#h09_1').removeAttr('checked');};
$.post('get_as_09', {data:selectedObj.value},function(result) {
if(result[0] > 0) {
$('#h09_1').attr('checked','checked');
} else {
$('#h09_1').removeAttr('checked');
}
});
</code></pre>
| javascript jquery | [3, 5] |
97,703 | 97,704 | Wrap a mixed set of text nodes and HTML elements with JavaScript / jQuery | <p>I have this HTML</p>
<pre><code><div class="box">
<a href="#goals"> | <a href="#rules"> | <a href="#controls">
<p><a name="goals"></a></p>
<h2>Goals</h2>
... yada yada
</code></pre>
<p>and want it like this.</p>
<pre><code><div id="nav">
<a href="#goals"> | <a href="#rules"> | <a href="#controls">
</div>
</code></pre>
<p>JQuery have wrapAll(), but I can only select the links so the "|" gets left outside the div.</p>
<p>before('div') and after('div') creates a closed element, like <code><div></div></code> so what to do?</p>
<p>I'm using</p>
<pre><code>$('.box a[href^="#"]')
</code></pre>
<p>to select the links. They are part of a text resource file, so I cant edit anything.</p>
| javascript jquery | [3, 5] |
4,047,911 | 4,047,912 | Reading files in android. how to fix bad path | <p>I am trying to read a file in android.
I am used to doing this in java but here I am getting a <strong>open failed enoent (no such file or directory)</strong> error.
I am not sure how to import the file. Should I put it in the same directory as my application? right now its on my desktop.
here is my code</p>
<pre><code>package com.androidplot.fun;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class ReadFile {
private String path;
public ReadFile(String file_path){
path = file_path;
}
public String[] OpenFile() throws IOException{
FileReader fr = new FileReader(path);
BufferedReader textReader = new BufferedReader(fr);
int numberOfLines = 3;
String[ ] textData = new String[numberOfLines];
int i;
for (i=0; i < numberOfLines; i++) {
textData[ i ] = textReader.readLine();
}
textReader.close( );
return textData;
}
int readLines() throws IOException{
FileReader file_to_read = new FileReader(path);
BufferedReader bf = new BufferedReader(file_to_read);
String aLine;
int numberOfLines = 0;
while (( aLine = bf.readLine()) != null){
numberOfLines++;
}
bf.close();
return numberOfLines;
}
}
</code></pre>
<p>This is the class I've been using. And this is what I am using in my main program</p>
<pre><code>try{
ReadFile file = new ReadFile("/Users/jonathon/Desktop/data.txt");
String[] aryLines = file.OpenFile();
int x;
for ( x=0; x < aryLines.length; i++ ) {
System.out.println( aryLines[ i ] ) ;
}
}
catch ( IOException e ) {
System.out.println( e.getMessage() );
}
</code></pre>
| java android | [1, 4] |
3,208,380 | 3,208,381 | Loop through an Array to enable checkboxes | <p>I'm have a set of checkboxes and an array that contains the index of which checkboxes should be selected. I'm trying to loop through the array and for each index in it. I made a sample jsFiddle to give you guys an idea of what I'm trying to do. I have the JQuery library also if that makes things easier. <a href="http://jsfiddle.net/7EetA/1/" rel="nofollow">http://jsfiddle.net/7EetA/1/</a></p>
| javascript jquery | [3, 5] |
1,481,530 | 1,481,531 | dynamic table in android | <p>Click on below Link</p>
<p>I giving you small example for it, but first you want to retrieve data from webservice and it in your arraylist.</p>
<p>Right?</p>
<p>now you want to follow this link which will help you lot.</p>
<p><a href="http://www.4shared.com/file/BGDgBv1q/TableLayoutDynamic.html" rel="nofollow">http://www.4shared.com/file/BGDgBv1q/TableLayoutDynamic.html</a></p>
<p>Here i give you two files
1. abc.xml (layout file for desgining in android)
2. AbcActivity.java (this is activity file which handle the tablelayout dynamic)</p>
<p>and if you have any query and doubt for that then give me comment</p>
<p>Thanks & Regards,
Prashant Adesara</p>
| java android | [1, 4] |
3,552,724 | 3,552,725 | Creating and loading multiple iframes dynamically | <p>I want to add few ifamres to a page based on the search result from the database.
Also I am planing to put those I frames inside a Jquery-UI accordion menu. What is the best way of doing this. I have used PHP for creating the ifamres dynamically.</p>
| php javascript jquery | [2, 3, 5] |
2,410,296 | 2,410,297 | Declaring variables javascript | <p>I just have a quick question and cant find anything on google. I was going through some code another programmer put together and he declares ALL of his javascript variables with $ in front of them...for instance:</p>
<pre><code> var $secondary;
</code></pre>
<p>Is there a reason for this? Could this cause problems in the future if JQuery ever ends up being used. I'm just curious because I was going to clean it up if so.</p>
| javascript jquery | [3, 5] |
4,959,584 | 4,959,585 | Is it possible to add JavaScript after page load and execute it | <p>Say I have a JavaScript function that is inserted into the page after page load how can I then call that function. For example lets keep things simple. Say I make an Ajax call to get the markup of the script and the following is returned:</p>
<pre><code><script type="text/javascript">
function do_something() {
alert("hello world");
}
</script>
</code></pre>
<p>If I then add this markup to the DOM can I call <code>do_something()</code> later?</p>
<p>I'm use the jQuery JavaScript framework.</p>
| javascript jquery | [3, 5] |
1,470,768 | 1,470,769 | Find out when all content has really finished loading | <p>Is there a reliable cross-browser solution to find out when <strong>all</strong> content on the website has finished loading? As I have a lot of stuff to load (some of which is in iframes), this doesn't really work (the event is fired even though browser's loading indicator is still spinning):</p>
<pre><code>$(window).add('iframe').bind('load').promise().done(function() {
alert('Too early :(');
});
</code></pre>
| javascript jquery | [3, 5] |
1,290,211 | 1,290,212 | What are some fun beginner-level Android programs to try? | <p>I'm beginning to write Android applications for one of my CS classes and I want to know what some fun things to try would be. I'll be writing them in Java (which I'd say I'm alright with) but I'm completely new to Android/mobile programming. Advice and suggestions are much appreciated. I want to learn what I can do. Thanks.</p>
<p>Brandon</p>
| java android | [1, 4] |
2,395,181 | 2,395,182 | Loading stylesheet dependant on User Agent | <p>I have to load a different Stylesheet depending on whether the User Agent is an iPad or other. I know that generally, detecting browsers isn't the most fantastic idea and will probably cripple our maintainability sometime in the future..not my decision.</p>
<p>So here we have some JavaScript to detect the user agent. It isn't working. I may have mis-escaped something. The error I am getting is a red herring (object reference), but only shows up when I execute the JavaScript.</p>
<pre><code> $(document).ready(function () {
alert('ready fired');
if (navigator.userAgent.indexOf("iPad") != -1) {
//alert('bleep bloop blop...iPad detected');
var stringToWrite = '<script src=\'\<\%\= ResolveUrl("~/Scripts/iscroll.js") \%\>\' type="text/javascript"><\/script>';
stringToWrite += '<link href=\'\<\%\= ResolveUrl("~/Stylesheets/scrollbar.css") \%\>\' rel="stylesheet" type="text/css" \/>';
stringToWrite += '<link href=\'\<\%\= ResolveUrl("~/Stylesheets/iPadCommon.css") \%\>\' rel="stylesheet" type="text/css" \/>';
alert(stringToWrite);
document.write(stringToWrite);
}
//else
//alert('bleep bloop blop...who cares browser');
});
</code></pre>
| javascript jquery | [3, 5] |
1,460,668 | 1,460,669 | Jquery: Is there some way to make val() return an empty string instead of 'undefined' for an empty list? | <p>With Jquery, is there some way to make val() return an empty string instead of 'undefined' when called against an empty list of elements?</p>
<p>E.g., I have this code:</p>
<pre><code>var x = $('#my-textbox-id').not('.watermark').val();
</code></pre>
<p>The idea is that I want to get the value of my textbox, but I want an empty string if it is currently showing the watermark (i don't want the watermark value!).</p>
<p>The selector works, but i don't want 'undefined' - I want an empty string ''.</p>
| javascript jquery | [3, 5] |
134,774 | 134,775 | Display Registration details in Website from Database | <p>Hi
i am using a website application for registration, in that application i have inserted contols like label boxes and text boxes... And i stored these values in database...</p>
<p>now i have to display the details only without controls in seperate form and the details should take from that database...</p>
<p>How Shall i Do this?</p>
<p>The output should display in next form... the format is</p>
<p>Name:Jessy
RollNo:6315
City:ParkTown</p>
<p>Thanks In Advance</p>
| c# asp.net | [0, 9] |
3,559,067 | 3,559,068 | Android: Unexpectedly Quit When Trying to Switch Activity | <p>I'm new to posting, but have been using the site for help for a while now. So thanks for that!</p>
<p>I'm working on a new app, got everything running well. It's a kids' soundboard. 2 pages of imagebuttons in a relative layout, with onclick listeners which triggers SoundPool. </p>
<p>My question is this:</p>
<p>in testing I've discovered if you're finger is anywhere on the screen where a button is not (say pressing on the background) and then you try to touch a button (multitouch) ... the button press doesn't register. Any way to fix this?</p>
<p>Thanks!</p>
| java android | [1, 4] |
920,056 | 920,057 | jquery with check box in asp.net problem | <p>I'm trying change an input mask for textbox when the the check box has been check or unckecked but the problem that always is picking up the else condation only even the check box it is check or not.</p>
<p>please advice to fix this problem.</p>
<p>here is my code:</p>
<pre><code><%@ Page Title="" Language="C#" MasterPageFile="~/Imam.Master" AutoEventWireup="true"
CodeBehind="WebForm4.aspx.cs" Inherits="Imam_Contacts.WebForm4" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<script src="js/jquery-1.4.1.js" type="text/javascript"></script>
<script src="js/jquery.maskedinput-1.2.2.js" type="text/javascript"></script>
<script type="text/javascript">
if ($('#chkhtml:checked').size() > 0)
{
jQuery(function($) {
$("#txthtml").mask("999-99-9999");
});
} else {
jQuery(function($) {
$("#txthtml").mask("99/99/9999");
});
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<input id="chkhtml" type="checkbox" checked="checked" />
</asp:Content>
</code></pre>
| asp.net jquery | [9, 5] |
4,381,200 | 4,381,201 | Simulate multiple keypresses in javascript | <p>I would like to simulate the user pressing tab then enter when they press enter. I know this sounds bad, but I have an asp.net web application that will only allow me to have one form with runat="server" on it so when the user hits return the main form gets submitted. I have another textbox on the page though (that ideally should have it's own form but can't because it is asp), and when enter is hit from there obviously the main form is submitted. The simplest way I could think is to simulate tab then enter using javascript, but I have been unsuccessful in that. I am welcome to any other solutions to this problem. So far I have simulated pressing tab, but I don't know how to simulate more than one keypress though.</p>
<p>Here is the code I have so far, I imagine return 9; needs to be replaced with something else. JQuery will also do.</p>
<pre><code>function suppressEnter (e) {
var keyPressed;
if (window.event) { keyPressed = window.event.keyCode } // IE
else if (e) { keyPressed = e.which }; // Netscape
if (keyPressed == 13) {
return 9;
}
else {
return true;
}
}
</code></pre>
<p>EDIT: return 9 + 13; works in chrome, but not IE</p>
| javascript jquery asp.net | [3, 5, 9] |
1,890,712 | 1,890,713 | Use php as a browser | <p>I am looking for a way to let php act as a browser, does anyone know how to do that? I now how to get pages and how to send get/post forms, but How do i let php interact with AJAX and javascript on a web page?</p>
| php javascript | [2, 3] |
4,173,515 | 4,173,516 | jquery/php form validation(login as well as registration form) | <p>I am working on a project which requires registration/Login...
I want to write a Jquery and php code which validates the data on client side and data on the server side(For log in), if the user enters wrong data stays on same page else redirect to his account...</p>
| php jquery | [2, 5] |
2,819,051 | 2,819,052 | Javascript default functions? | <p>In Javascript, like <code>setInterval(draw,20)</code> you don't include anything like in C#. You can just use the function. The function is on the <code>Windows</code> object of the browser.</p>
<ol>
<li><p>Can the following objects and its functions be called without any pre-definitions?</p>
<pre><code>Window
Navigator
Screen
History
Location
</code></pre></li>
<li><p>Does JavaScript has any built-in functions?</p></li>
</ol>
| c# javascript | [0, 3] |
3,254,991 | 3,254,992 | Append object to a existing file in android | <p>i have append an object to a existing file but i can not read it ,i can read the first object and this is my code
What is the problem ??</p>
<pre><code>try{
FileOutputStream fos = openFileOutput("f.txt",MODE_PRIVATE | MODE_APPEND );
ObjectOutputStream oos = new ObjectOutputStream(fos);
String a=new String ("Hello object1 ");
String b=new String("Hello object2 ");
String c=new String("Hello object3 ");
oos.writeObject(a);
oos.writeObject(b);
oos.writeObject(c);
oos.close();
// Reading it back..
FileInputStream fis = openFileInput("f.txt");
ObjectInputStream ois = new ObjectInputStream(fis);
//ois=new ObjectInputStream(fis);
// r=(String)ois.readObject();
String r;
while ((r= (String)ois.readObject()) != null) {
Log.i("while Read r",r);
Toast.makeText(getApplicationContext(),r, Toast.LENGTH_SHORT).show();
}
ois.close();
}catch (Exception e){
Log.i("Exception",e.getMessage());
}
</code></pre>
<p>I hope you can help me!! thanks.</p>
| java android | [1, 4] |
676,553 | 676,554 | Unterminated String error while iterating | <p>This is my code :</p>
<pre><code><c:forEach items="${entry.value}" var="keyval">
var bdgroup= {
elem1: '${keyval.partno}',
elem2: '${keyval.location}',
elem3: '${keyval.village}',
elem4: '${keyval.id}'
};
exampleArray.push(bdgroup);
</c:forEach>
</code></pre>
<p>i am getting </p>
<p>'unterminated string literal error'`</p>
<p>sometimes it works fine but for other times this error happens..</p>
| javascript jquery | [3, 5] |
2,246,255 | 2,246,256 | Extracting contents from a webpage and comparing using Java | <p>I am developing a Java project in which i have a sub-module where i need to extract contents [text, image, color] from a webpage and compare it with another webpage. I am planning to use WinHTTrack software for downloading the webpage locally, but the problem is it doesn't save it as HTML. How can i download a webpage with HTML extension using softwares such as WinHTTrack [or just saving the webpage through ctrl+s is enogh.?]. Also i am planning to use HTML Parsers to extract the 3 content types[text, image, color],after downloading the webpage locally. So which parser to go with.? </p>
| java javascript | [1, 3] |
3,929,633 | 3,929,634 | Develop an android and iPhone application with shared database | <p>I have a great idea for smartphone application, And I want to develop an application suited for both android and iPhone. In addition I need to use spatial database for geo indexing that will be shared for both applications. I am new to this app world and I have some questions.</p>
<ul>
<li>Is there away to develop for both machines? I know java but not objective c.</li>
</ul>
<p>My guess is that I need to separate the database from the computing to support both applications.</p>
<ul>
<li>What are the best cloud computing providers with spatial database support that can host the server?</li>
<li>Do I need 2 hosting servers or there is one server the can support the both of them?</li>
<li>which database provider can support geo indexing and support this intergration,
I prefer providers with reasonable free quotas.</li>
</ul>
| android iphone | [4, 8] |
4,100,745 | 4,100,746 | jQuery calculation inside loop | <p>How can i make a loop and add some values for the next iteration together like these in jQuery ?</p>
<pre><code>var currLength = length;
for (var i = 1; i < dotCount -1; i++) {
$("#myElement" + i).css("width", currLength);
currLength += length + margin;
}
</code></pre>
<p><strong>Edit:
These is just an example. I just wanted to know how to use the .each function of jQuery because i had some different idea of usage. I doesn't make any difference in relation to a for loop</strong></p>
| javascript jquery | [3, 5] |
5,146,893 | 5,146,894 | A Jquery function to print images in screen? | <p>I am thinking in printing a big image (900 x 400 px) in the screen when user clicks a button, could you recommend me one (or more) jquery function to carry out this action?</p>
<p>Thank's in advanced,
Regards</p>
| javascript jquery | [3, 5] |
1,361,195 | 1,361,196 | Can any one tell what's wrong with the following script in disabling the list of dates | <p>I used <a href="http://keith-wood.name/datepick.html" rel="nofollow">Keith-Wood</a> calendar for that i added some script as follows</p>
<pre><code> <script type="text/javascript">
$function(){
var holidays = ['12-2-2010', '12-7-2010', '12-10-2010', '12-18-2010'];
$('#txtDateofBirth').datepick({onDate: function(date) {
for (var i = 0; i < holidays.length; i++) {
if (date.toString('MM-dd-yyyy')==holidays[i]) {
return {selectable: false, dateClass: 'holiday'};
}
}
return $.datepick.noWeekends(date);
}});
</script>
</code></pre>
<p>I am also having this too to disable <code>weekends</code></p>
<pre><code><script type="text/javascript">
$(function () {
$('#txtDateofBirth').datepick({
onDate: $.datepick.noWeekends, showTrigger: '#Img1'
});
});
</script>
</code></pre>
<p>But i am unable to disable the dates as per in the list can any one tell what's wrong i am doing</p>
<p>My design is as follows</p>
<pre><code><asp:TextBox ID="txtDateofBirth" runat="server" Style="left: 398px; position: absolute;
top: 131px" />
<div style="display: none;">
<img id="Img1" src="images/calendar.gif" alt="Popup" class="trigger" style="left: 568px;
position: absolute; top: 136px" />
&nbsp;
</div>
</code></pre>
| jquery asp.net | [5, 9] |
5,426,522 | 5,426,523 | Insert a single view inside a listview makes listItem non clickable | <p>I am inflating a view inside a list item on listItemClick .The list item contains a check box. When the check box is clicked a linear layout containing two/three edit text fields and buttons gets inflated to that list view ( done by getView method of cursor adapter, the inflating view is dynamically created ) . </p>
<p>the list view is registered with on item click listener . After the layout being inflated , the onItemClick Listener is not getting called for the particular item. Help me</p>
<p>my getView code</p>
<pre><code>TextView text1 = (TextView) view.findViewById (R.id.text);
text1.setText("text");
CheckBox cb = (CheckBox)view.findViewById(R.id.checkBoxList) ;
cb.setTag(tag);
cb.setChecked(false);
if ( chekedIdVector.contains(cursor.getString(cursor.getColumnIndex(ID) )))
{
cb.setChecked(true);
}
if( !idVector.isEmpty () )
{
LinearLayout ll =(LinearLayout)view.findViewById(R.id.layoutinCell);
if ( ((String)idVector.lastElement()).equals(cursor.getString(cursor.getColumnIndex(_ID) )) )
{
if (ll.getChildCount() == 0 )
{
ll.removeAllViews() ;
ll.addView(dynamicallyCreatedView); // view dynamically created with 2/3 textviews and buttons
}
ll.setVisibility(View.VISIBLE);
view.requestFocus() ;
}
else
{
ll.removeAllViews() ;
}
}
return view ;
</code></pre>
<p>Ps: I have tried on focus changed listener and set the check box to non focusable in xml</p>
| java android | [1, 4] |
513,619 | 513,620 | Function to Get Params Cuts Off Values | <p>I'm using this function to get my params in Javscript, but on occassion, it cuts off my <code>charge_id</code> param.</p>
<pre><code> $.urlParam = function(name) {
var results = new RegExp('[\\?&amp;]' + name + '=([^&amp;#]*)').exec(window.location.href);
if (results) { return results[1] || 0; }
};
if ($.urlParam('success')) {
// Get Charge ID from param
var chargeId = $.urlParam('charge_id')
};
</code></pre>
<p>In this case, the <code>charge_id</code> parameter was shortened by the above expression:</p>
<pre><code>lvh.me:3001/?charge_id=ch_1hK2X4XiaCv3r8&success=true
</code></pre>
<p>This is what is returned:</p>
<pre><code>ch_1hK2X4Xi
</code></pre>
| javascript jquery | [3, 5] |
808,183 | 808,184 | How to show an error message dialogs in Asp.net | <p>How to show an <code>error messages</code> or <code>data validation messages</code> in Asp.net with c# language.
Please guide me.</p>
| c# asp.net | [0, 9] |
3,117,734 | 3,117,735 | After learning C language, move ahead with Java or C++ first? | <p>I have completed my 1st year in Information technology(B. Tech). I have completed C programming Language and wish to study the next high level programming languages. I am confused whether to start with c++ or java first. What should i start first?</p>
| java c++ | [1, 6] |
1,003,762 | 1,003,763 | what's a proper way to check for null/empty string in js before including to params? | <p>I am building a querystring and want to exclude keys if vals are empty, what's a proper way?</p>
<pre><code> setQueryString: function () {
var keyword = $('#keyword').val();
//how to exclude it if keyword is empty?
var params = {
"keyword": $.trim(keyword)
};
return params;
}
</code></pre>
<p>take into account, that I will have 20+ inputs like keyword..trying to avoid lots of IF statements</p>
| javascript jquery | [3, 5] |
5,598,497 | 5,598,498 | jquery find a string in an array with spaces on it | <p>How can I make this work? I have an space in the third element of my array " John". </p>
<p>take a look:
<a href="http://jsfiddle.net/hyHFT/" rel="nofollow">http://jsfiddle.net/hyHFT/</a></p>
<pre><code><style>
div { color:blue; }
span { color:red; }
</style>
<div>"John" found at <span></span></div>
<div>4 found at <span></span></div>
<div>"Karl" not found, so <span></span></div>
<script>var arr = [ 4, " Pete", 8, " John" ];
$("span:eq(0)").text(jQuery.inArray("John", arr));
$("span:eq(1)").text(jQuery.inArray(4, arr));
$("span:eq(2)").text(jQuery.inArray("Karl", arr));
</script>
</code></pre>
<p>Thanks
Gracias!
el Mescal</p>
| javascript jquery | [3, 5] |
1,613,526 | 1,613,527 | catch cmd output and include it on list java | <p>i try to do some cmd command in java, my script:</p>
<pre><code>public void test(){
try{
Runtime rt=Runtime.getRuntime();
Process p = rt.exec("cmd /c "+"adb devices");
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
while((line=input.readLine())!=null){
System.out.print(line);
}
}catch(Exception e){
System.out.println("process failed");
}
}
</code></pre>
<p>and the output result:</p>
<pre><code>run:
List of devices attached
0160880B0401F006 device
</code></pre>
<p>how can i catch the part of that result: "0160880B0401F006" and put into a list on my gui?</p>
<p>thanks before</p>
| java android | [1, 4] |
1,652,228 | 1,652,229 | How to set a control ID in ListView Template dynamically? | <p>A have a ListView that is rendered with multiple items.<br>
Now I want to toggle some HTML attributes with JQuery. Therefore it would be best to have access to these elements via an unique ID.</p>
<p>But trying to create a "dynamic" and therefore unique ID by</p>
<pre><code><tr runat="server" ID='<%# this.GetUniqueID() %>'>
</tr>
</code></pre>
<p>results in an error that tells me that the ID needs to be simple and cannot be set by a call to a method.</p>
<p>I know that I can dynamically create controls in the code-behind and set the ID there. But in this case, I'd rather like to let the content be rendered by the ListView itself.</p>
<p>That brings me to the conclusion that the idea of setting a dynically ID in the Template is totally wrong. How can I achieve the desired behaviour?</p>
<p><strong>Edit</strong>: Ok I just found out, that I can set the ID with a BindingExpression, like</p>
<pre><code>ID='<%# Eval("MyColumnWithUniqueID") %>'
</code></pre>
<p>Still, is there another, or even better solution to this?</p>
| c# asp.net jquery | [0, 9, 5] |
4,615,920 | 4,615,921 | jquery issue (bug?) in IE with .css() manipulation | <p>I have a block of jquery / javascript code that sets the left margin of an image depending on the browser width.</p>
<p>I do some sums to calculate the required left margin and it goes in var $diff.</p>
<p>This code works fine:</p>
<pre><code>$('#background-wrapper>img').attr('alt',$diff);
</code></pre>
<p>which demonstrates that the sums are all working fine as the image ends up with the correct value for $diff inserted in its alt attribute. This works on IE, FF, Chrome.</p>
<p>But if I change the code to:</p>
<pre><code> $('#background-wrapper>img').css('margin-left',$diff);
</code></pre>
<p>then firefox and chrome work fine, using $diff as a value for the images left-margin as I intended, but IE throws a run time error and stops running the script, citing an Invalid Argument in jquery file. I'm using jquery 1.3.2.min.</p>
<p>Any ideas?</p>
<p>Heres the code for the full function. </p>
<pre><code>function imageResizeCenter() {
var $windowh = jQuery(window).height();
var $windoww = jQuery(window).width();
var imagesrc = $('#background-wrapper2>img').attr('src');
var myimage = new Image();
myimage.src = imagesrc;
var $width = myimage.width;
var $height = myimage.height;
var $ratio = parseInt($width,10)/parseInt($height,10);
var $newwidth = parseInt($windowh,10)*$ratio;
var $diff = (parseInt($windoww,10)-parseInt($newwidth,10))/2;
if($diff<0) $diff=0;
$('#background-wrapper2>img').attr('height',$windowh).css('margin-left',$diff);
}
</code></pre>
| javascript jquery | [3, 5] |
2,614,231 | 2,614,232 | How do I validate that a text input contains only latin letters? | <p>How can I use jQuery to validate (on <code>keyup</code>) that a text input only contains latin letters (<code>only_english = 'abcdAbDKDk',</code>), without using a plugin?</p>
| javascript jquery | [3, 5] |
385,010 | 385,011 | See if field exists in class | <p>I have a class with various variables</p>
<pre><code>public class myClass{
public int id;
public String category;
public String description;
public String start;
public String end;
}
</code></pre>
<p>Is there a way to check, either by creating an internal function or checking from the calling object, whether or not a variable exists?</p>
<p>E.g. To check whether myClass contains a variable called "category" (it does). Or whether it contains a category called "foo" (it does not).</p>
<p>Thanks for the help!</p>
| java android | [1, 4] |
5,566,354 | 5,566,355 | Pb. DataGrid.Items while enabeling the Paging | <p>I'm using a Datagrid with paginig, while clicking on select all , all items in all pages are selected but while the execution, I'ven't all the selected items.<br>
How can you get the DataGrid.Items.Count to reflect the FULL record count instead of displaying the page size?</p>
<p>I'm using this property and all it's displaying is the page size of 10.</p>
| c# asp.net | [0, 9] |
4,483,129 | 4,483,130 | mousemove strange behavior | <p>i am trying to change images of a slideshow using mousemove. but its not working correctly. It only works correctly first time and after that even the mouse is not clicked it assumed that mouse is clicked.
You can check demo here
<a href="http://unirazz.com/kb/html/movie.html" rel="nofollow">http://unirazz.com/kb/html/movie.html</a></p>
<p>here is the code for mousemove</p>
<pre><code> var clicking = false;
var pageX = 0;
$('#movieShow').mousedown(function(e){
clicking = true;
pageX = e.pageX;
});
$(document).mouseup(function(e){
clicking = false;
pageX = 0;
//alert('h');
})
$('#movieShow').mousemove(function(e){
if(clicking == false) return;
// Mouse click + moving logic here
//$('.movestatus').text('mouse moving');
if(pageX == 0) return;
if((e.pageX - pageX) > 0){
var t = e.pageX - pageX;
if(t%10 == 0){
pageX = e.pageX;
//console.log('right');
rightClick();
}
}
else{
var t = pageX - e.pageX;
if(t%10 == 0){
pageX = e.pageX;
//console.log('left');
leftClick();
}
}
});
</code></pre>
| javascript jquery | [3, 5] |
2,055,492 | 2,055,493 | Open popup and poulate it with data from parent window? | <p>How can I use Javascript/jQuery to populate a popup-window with data from JS-variables in the parent page?</p>
<p>In my example I have an array of filenames. I list at most five in the parent window and if there's more I want to provide a link that opens a popup window and lists each post in the array.</p>
<p>So if I open a popup that contains a <code><ul id="all_files"></ul></code>. How can I add <code><li></code>-items to that list?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
2,968,685 | 2,968,686 | jQuery incrementation param passing weird behavior | <p>Let me describe my scenario before I say my question:</p>
<p>Let counter be defined already as a number starting from 0.</p>
<p>I have 2 a tags: let them be a1 and a2</p>
<p>I first dynamically added a1 into my html and then used this:</p>
<pre><code>jQuery("a.adder").click(function(){adder(this, counter)});
</code></pre>
<p>then I did <code>counter++</code></p>
<p>then I dynamically added a2 into my html and then used this again on <strong>both</strong> my a tags</p>
<pre><code>jQuery("a.adder").click(function(){adder(this, counter)});
</code></pre>
<p>then I did <code>counter++</code></p>
<p>also, in my <code>adder(param1, param2)</code> , all I do is <code>alert(counter)</code></p>
<p>Okay here's my question: After doing all that, when I clicked on a1 which has 2 handlers, the alert output is 2 (it alerts twice for each handler) and for a2, the alert is also 2 when clicked. Why is this happening?</p>
| javascript jquery | [3, 5] |
4,676,912 | 4,676,913 | Move row from bottom of table to top on touchmove | <p>I'm using touch events to handle swiping a table containing roughly 350 rows. The number of rows is variable as they are pulled from a Google Spreadsheet. The table auto-scrolls continuously, which means that when a rows scrolls off at the top or bottom, I have to append or prepend it again as the case may be.</p>
<p>The user can touch the screen to swipe the table up or down (note that I'm not talking about mobile devices here, but rather a touch-screen monitor). I've provided an implementation for the <em>touchmove</em> event when swiping down, though swiping up would be similar:</p>
<pre><code>function handleMove(event) {
var touch, newY, delta,
$firstItem = $(".item:first"),
$lastItem = $(".item:last");
if (!isDown) {
return;
}
if (event.originalEvent.targetTouches.length == 1) {
touch = event.originalEvent.targetTouches[0];
newY = touch.clientY;
}
delta = lastY - newY;
if (delta < 0) { //Swiping down
//Move last row from the end of the table to the beginning if first row is fully visible.
if (($firstItem.position().top + $firstItem.outerHeight(true)) >= $page.position().top) {
$page.css("margin-top", parseInt($page.css("margin-top")) - $lastItem.outerHeight(true) + "px").prepend($lastItem);
}
$page.css("margin-top", parseInt($page.css("margin-top")) - delta + "px");
}
lastY = newY;
}
</code></pre>
<p>The problem is that the more rows that are in the table, the more sluggish the code becomes for moving the row from the bottom to the top and adjusting the margin, causing a jittery swipe.</p>
<p>I'm guessing this is an expensive operation to perform. I read up on browser reflow, but I didn't see many optimizations that I could make to my code. Even tried introducing a <em>DocumentFragment</em> to no avail.</p>
<p>Any ideas on things I can try? Or am I going to have to live with this?</p>
<p>Thx.</p>
| javascript jquery | [3, 5] |
2,428,566 | 2,428,567 | Whats the mathematical formula for converting days into weeks | <p>I don't want decimal points like <code>65 days = 6.2weeks</code>. I want <code>65 days = 6 weeks 1 day</code></p>
<p>I can't use any libraries (not homework)</p>
| java javascript | [1, 3] |
3,610,723 | 3,610,724 | What JQuery plugin can I use to animate this slider? | <p>I'm trying to convert the slider in <a href="http://designinstruct.com/web-design/create-a-bright-and-sleek-web-design-in-photoshop/" rel="nofollow">this layout</a>, but I couldn't find a plugin that meets my needs. The <a href="http://fredhq.com/projects/roundabout/" rel="nofollow">roundabout</a> plugin shares the same animation effect, but differs in the slider's picture elements and also in proportions. Can someone guide me?</p>
| javascript jquery | [3, 5] |
1,723,263 | 1,723,264 | Read POST request with AjaxMethod | <p>I need read POST request in my page. I using .net 2.0, higher version is not possible, and i try build page with AjaxPro. When i send request in JS to my destination, i cannot read request using <code>Request.Form</code>, <code>Page.Request</code> or other. Here is my code </p>
<pre><code>
public class Ajax : System.Web.UI.Page{
[AjaxMethod]
public string getString(){
//here i would like read POST request
return "";
}
}
</code></pre>
| c# asp.net | [0, 9] |
4,151,825 | 4,151,826 | Does picking a language to learn really matter? They all use similar techniques to solve problms? | <p>College student about to major in CS. Just want to know if it really matter what language you learn first?</p>
<p>Seems to me CS and the nature of our work is about problem solving. Different language seems to differ in syntax, libraries you can use, etc. etc. But when it comes down to it, if you know how to solve a particular problem in one language, you could do it in other languages as well right? I mean surely some languages are better tools and can do a more elegant job, but at the end of the day the ideas are still the same right?</p>
| c# java c++ | [0, 1, 6] |
4,307,574 | 4,307,575 | replace in jQuery | <p>Can some one help me in this</p>
<p>I had a variable </p>
<pre><code>var myValue = "what is you name? what is your age?"
</code></pre>
<p>i want to find the '?' in the string and replace it with a html input text element</p>
<p>where the user can enter the answer in the text box and at last i need a string as out put like this</p>
<p>"what is your name my name is xyz what is your age i am 25"</p>
<p>Please help me in this</p>
<p>Thanks
Kumar</p>
| javascript jquery | [3, 5] |
1,881,920 | 1,881,921 | Making a line move smoothly under my navbar | <p>So I'm trying some stuff out for webdesign but I'm having a bit of a problem with the following idea:</p>
<p>So I'm trying to make a litte .png line I made move smoothly under my navbar. So when I click on another link it slidestowards it and stays there as long as that site is active, but I'm having a bit of a problem finding the code, even tried making it myself.</p>
<p>If anybody has a usefull link for this or a code they wrote before, it would be really appreciated.</p>
| javascript jquery | [3, 5] |
3,994,548 | 3,994,549 | How to create a large selection screen? | <p>My app tracks how players at a pokertable play. I give my users the option to save up to 50 players stats in the form of a 'Player' object stored inside a JSON array within sharedPreferences. Allowing the user a way of selecting and loading one of these players has proven difficult.</p>
<p>An alertDialog seems to small, a new activity seems a bit overboard for what is essentially just a large menu and I fear passing my objects to it will prove difficult. A viewFlipper sounds interesting but I've no idea whether it's suitable.</p>
<p>How should I go about doing this? Filling the screen with dozens of buttons is really all I wish to do.</p>
| java android | [1, 4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.