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,280,571 | 5,280,572 | how to resize image according to div tag image automatic | <p>i want to resize my image that is inside div tag according to changing my div tags size automatically.how can i achieve using j query please help us
NOTE image is inside div tag.</p>
| javascript jquery | [3, 5] |
4,972,254 | 4,972,255 | Adding values from C# to DIV via JavaScript | <p>The last module of my chat script is passing values from C# code to JavaScript and JavaScript will post values to the DIV. Before I used DataBinder but when using it directly C# code is taken by AJAX's update panel. Now, I need a set of Array values to be passed via Timer Tick function to JavaScript. How can I pass Arrays from C# to JavaScript using <code><%= %></code>. A part of my code follows.</p>
<pre><code>protected void Timer1_Tick(object sender, EventArgs e)
{
if (MyConnection.State == System.Data.ConnectionState.Open)
{
MyConnection.Close();
}
MyConnection.Open();
OdbcCommand cmd = new OdbcCommand("Select message from messages where name=?", MyConnection);
cmd.Parameters.Add("@email", OdbcType.VarChar, 255).Value = "human";
OdbcDataReader dr = cmd.ExecuteReader();
ArrayList values = new ArrayList();
while (dr.Read())
{
string messagev = dr[0].ToString();
// What should I do here?
}
MyConnection.Close();
}
</code></pre>
<p>I don't want values to directly to be sent to the DIV. First it must be sent to JavaScript and then it must go to DIV.</p>
<p><strong>For more clarification</strong></p>
<p>I need C# to retrieve data from backend and to pass that data to client side (i.e. JavaScript) from JavaScript it has to be forwarded to DIV layer.</p>
| c# javascript | [0, 3] |
924,896 | 924,897 | Capturing IP address of web stream with StreamReader returning too much data | <p>I have this piece of code:</p>
<pre><code>WebClient web = new WebClient();
System.IO.Stream stream = web.OpenRead("http://url/getAddress.html");
string text = "";
using (System.IO.StreamReader reader = new System.IO.StreamReader(stream))
{
text = reader.ReadToEnd();
reader.Close();
}
</code></pre>
<p>The result of this in HTML is an IP Address, but when i try to save this result in a database, the result that returns is the whole html page of the web request.
What am i doing wrong?</p>
<p>Example:</p>
<p><strong>text</strong> has the result </p>
<p>if i do a <code>Response.Write(text);</code> it returns: <strong>111.222.33.3</strong></p>
<p>if i try to save the variable <strong>text</strong> which returns the value, this will save the whole html content from the web request page.</p>
| c# asp.net | [0, 9] |
5,394,635 | 5,394,636 | JavaScrip/jQuery - How to check if a string contain specific words | <pre><code>$a = 'how are you';
if (strpos($a,'are') !== false) {
echo 'true';
}
</code></pre>
<p>In PHP, we can use the code above to check if a string contain specific words, but how can I do the same function in JavaScript/jQuery?</p>
| javascript jquery | [3, 5] |
4,516,321 | 4,516,322 | How to detect if shift has been released? | <p>I want to be able to run a function when the shift key is released.</p>
<p>I know the shift key can be detected with something like:</p>
<pre><code>$(window).bind("keydown keyup", function(ev) { ... });
</code></pre>
<p>It works very well for detecting key combinations (e.g. <code>shift+a</code>). Problem is, if you want to detect the shift key itself, this triggers a <code>keydown</code> with <code>ev.shiftKey=false</code>, <code>ev.which=16</code> and a <code>keyup</code> with <code>ev.shiftKey=true</code>, <code>ev.which=16</code>. I've tried to attach an event to this combination on <code>keyup</code>, but this fail in a very subtle way when both shift keys are pressed: for the second shift key you get both <code>keyup/keydown</code> with <code>true,16</code> and then you get another <code>keyup</code> with <code>true,16</code> when the first shift key is released. </p>
<p>Is there any clean way to do this? Or should I just ignore the two shift key case?</p>
| javascript jquery | [3, 5] |
512,932 | 512,933 | Checking if browser is in fullscreen | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1047319/detecting-if-a-browser-is-in-full-screen-mode">Detecting if a browser is in full screen mode</a> </p>
</blockquote>
<p>Is there a way to check if a browser is currently in fullscreen mode (after the user pressed f11)?</p>
<p>Something like:</p>
<pre><code>if (window.fullscreen) {
// it's fullscreen!
}
else {
// not fs!
}
</code></pre>
<p>Thanks.</p>
<p>Steerpike's answer is pretty good, but my comment:</p>
<blockquote>
<p>Thanks a lot, but this answer is not
sufficient for FF. In Chrome I can set
a small tolerance, but in FF the
urlbar and tabs takes a while to
disappear, which means after pressing
f11, the detected window.innerWidth is
still too small.</p>
</blockquote>
| javascript jquery | [3, 5] |
4,010,324 | 4,010,325 | Call C# method inside a class file from javascript | <p>Is it possible to call a C# function which is inside a specific class file by javascript?</p>
<p>My Function is like this</p>
<pre><code> public static void PrintPDF()
{
}
</code></pre>
<p>and this function is inside a class file <code>XSLTHelper</code>
In C# I can call this function by <code>XSLTHelper.PrintPDF();</code>.
Is there is any way to do the same from javascript?</p>
| c# javascript asp.net | [0, 3, 9] |
5,602,998 | 5,602,999 | How to call Confirmation box in IF condition from Code-Behind? | <p>I'm using a LinkButton and a DropDown.</p>
<p>When I click on the LinkButton the DropDown appears.</p>
<p>After selecting a DropDown value, I want a confirmation box called from JavaScript to appear, ensuring that the value is changed.</p>
<p>I'm calling this script in the second <code>if</code> condition, but it's not working.</p>
<p>After the confirmation I want to change the other value and exit from the condition.</p>
<pre><code>protected void lnkbtnSave_Click(object sender, EventArgs e)
{
if ((ddlHiringManager.SelectedItem != null &&
(ddlHiringManager.SelectedItem.Text != lblHiringManager.Text)) &&
(Convert.ToInt32(ddlHiringManager.SelectedValue)) != -1)
{
if (ClientScript.RegisterStartupScript(typeof(Page), "Confirm", "<script type='text/javascript'>Confirm('Are you sure you want to change Hiring Manager for this requirement.');</script>"))
{
ClsClientManager objClientManager = new ClsClientManager();
if (objClientManager.UpdateHRManagerByReqID(Convert.ToInt32(hdnReqId.Value), Convert.ToInt32(ddlHiringManager.SelectedValue)) > 0)
{
lblShowHiringManager.Text = ddlHiringManager.SelectedItem.Text;
}
}
}
else
{
ClientScript.RegisterStartupScript(typeof(Page), "SymbolError", "<script type='text/javascript'>alert('Please Select Hiring Manager !');</script>");
}
}
</code></pre>
| c# javascript asp.net | [0, 3, 9] |
4,420,041 | 4,420,042 | meta tag for compatibility mode | <p>I have web app with lots of JS and jQuery code and my problem is with IE9. For some reason my JS is not responding in IE9, in all other browsers is working well including IE8.</p>
<p>What is happening is that when I put <code><meta http-equiv="X-UA-Compatible" content="IE=8"/></code> the JS is working in IE9 but not like in other browsers (some of the features are not working well), then when I change it to <code><meta http-equiv="X-UA-Compatible" content="IE=9"/></code> and refresh everything starts to work fine, but if I clear the cache and restart browser I have the same problem again.</p>
<p>I've also tried to remove meta tag totally but that doesn't help. If someone have more experience with IE any advice is welcome.</p>
<blockquote>
<p>Note: This problem is appears only on online server, locally on my WAMP is fine.</p>
</blockquote>
<p>Thanks</p>
| php javascript jquery | [2, 3, 5] |
2,621,770 | 2,621,771 | jQuery submit ajax form with 2 submit buttons | <p>im trying to achieve the following, in php i have a form like this:</p>
<pre><code><form method="post" id="form_1" action="php.php">
<input type="submit" value="add" name="sub"/>
<input type="submit" value="envoi" name="sub"/>
</form>
</code></pre>
<p>the form action file is:</p>
<pre><code><?php
if( $_POST["sub"]=="add"){ ?>
<script>
alert("")
</script>
<?php echo "ZZZZZZ"; ?>
<?php } ?>
</code></pre>
<p>so this means if i press sub with value add an alert prompt will come up, how can i do the same thing(differentiate both submit) but using a Ajax request:</p>
<p>the following code so does not work:</p>
<pre><code> $(function(){
$('form#form_1').submit(function(){
var _data= $(this).serialize()
$.ajax({
type: 'POST',
url: "php.php?",
data:_data,
success: function(html){
$('div#1').html(html)
}
})
})
})
</script>
</head>
<body>
<div id="1" style="width: 100px;height: 100px;border: 1px solid red"></div>
<form method="post" id="form_1" action="javascript:;">
<input type="submit" value="add" name="sub"/>
<input type="submit" value="envoi" name="sub"/>
</form>
</body>
</code></pre>
| php javascript jquery | [2, 3, 5] |
2,758,703 | 2,758,704 | Reading an XML Node only | <p>I am having an issue getting the value of an XML, it is loading it in the XML document when i debug, but it is not finding the value or the node i want to access. Here is the xml. The value i want to get is "Active". Now this XML is not a file or anything , is being passed as a string... (can not modify this part) have only access to the class where i can create functions to access it but can not modify the actual code getting the values and passing it as a "xml string"</p>
<pre><code><Clients>
<BillingCycle>30</BillingCycle>
<Category>1</Category>
<Type>Admin</Type>
<AddressCat>3</AddressCat>
<ZipCodeCat>5</ZipCodeCat>
<ClientManager>
<UserID>5</UserID>
<ZPVal>1</ZPVal>
<DRY1>Test</DRY1>
<Active>1</Active>
</ClientManager>
</Clients>
</code></pre>
<p>C# code here</p>
<pre><code>public bool IsActive(int ClientID, int VassID)
{
bool isActive = false;
HelperClass helper = new HelperClass();
XmlDocument xml = new XmlDocument();
//at this point i can see the data was stored in the xml when debugging
xml.LoadXml(helper.GetClientXML(ClientID, VassID));
//have tried the following do not woerk
// XmlNode node = xml.SelectSingleNode ("/Clients/ClientManager/Active/text()");
XmlNode node = xml.SelectSingleNode("Clients/ClientManager/Active");
int isActiveVal = Convert.ToInt32(node.Value);
if (isActiveVal == 1)
{
isActive = true;
}
return isActive;
}
</code></pre>
| c# asp.net | [0, 9] |
1,093,594 | 1,093,595 | asp:linkbutton inside gridview | <p>I have a serverside dropdownlist and I am accessing it's id in jquery like this</p>
<p>$('#<%=ddldropdownlist.clientID%>')</p>
<p>I have a asp:LinkButton inside a gridview and I want to access it's client ID.</p>
<p>when I do as above in jquery it doesn't work</p>
<p>I think that's not the correct way since the server control is inside another server control</p>
<p>Could someone please help</p>
| asp.net jquery | [9, 5] |
4,537,123 | 4,537,124 | whats wrong with this jquery script? | <p>so im trying to apply a basic on click show hide element but for some reason it doesnt take no effect</p>
<p>im using it via an external javascript file and including the latest jquery library both included in my master page firebug shows the code so i know its picking it up </p>
<p>heres the code ive tried </p>
<pre><code>$(document).ready(function () {
// hides the divx as soon as the DOM is ready
$('#ecom').hide();
// shows the div on clicking the noted link
$('.eco').click(function () {
$('#ecom').show('slow');
return false;
});
// hides the div on clicking the noted link
$('.eco').click(function () {
$('#ecom').hide('fast');
return false;
});
});
</code></pre>
<p>html</p>
<pre><code><h2 class="eco">Ecommerce Web Design</h2>
<div id="ecom">content</div>
</code></pre>
<p>I dont see the problem myself</p>
<p><strong>This was the solution i used in the end does what i want it to do :)</strong>
Thankyou all for the answers too </p>
<pre><code>$(document).ready(function () {
$('#ecom').hide();
$('.eco').click(function () {
$('#ecom').toggle('slow');
return false;
});
</code></pre>
| javascript jquery | [3, 5] |
4,149,347 | 4,149,348 | Grab text contained within PHP-generated element | <p>I'm having trouble grabbing the actual text within a header tag that is generated by some PHP code. Here's the portion of the page that I'm grabbing.</p>
<pre><code><div class="container">
<div class="majorContainer">
<h2>Your results for: <small>"tables"</small></h2>
<hr />
<div class='accordionButton'>
<h3 style="display:inline">1. </h3>
<h3 style="display:inline" id='major-1'>Electrical Engineering Technology</h3>
<p>...</p>
</div>
<div class='accordionButton'>
<h3 style="display:inline">2. </h3>
<h3 style="display:inline" id='major-2'>Retail Management</h3>
<p>...</p>
</div>
</code></pre>
<p>Basically, when the user clicks on an 'accordionButton', I want to pull the text from the header tag of that specific button. In my PHP, I assigned an ID to each header tag because I figured I could just pull the text doing:</p>
<pre><code>document.getElementById(this.getElementsByTagName("h3")[0].id).text
</code></pre>
<p>When I alerted this in a message box, I'm only seeing 'undefined'. I tried, instead, just doing...</p>
<pre><code>$(this).text()
</code></pre>
<p>...but this returned "1. Electrical Engineering Technology..." which is not what I want. I just want the title "Electrical Engineering Technology" that is contained in the h3 tag.</p>
<p>What am I doing wrong? Thanks!</p>
| php javascript jquery | [2, 3, 5] |
3,546,112 | 3,546,113 | passing arguments to click or submit function | <p>Is it possible to pass arguments to click or submit function like :</p>
<pre><code>$("#example").click(function()
{
var myVar = x; // refering to x as passed argument
});
</code></pre>
<p>Maybe function inside a function ? </p>
<pre><code>function Func(){
$("#example").click(function()
{
var myVar = x;
});
}
</code></pre>
<p>Maybe something like calling <code>Func()('33');</code> will this pass the 33 to the click function, is it possible after all?</p>
| javascript jquery | [3, 5] |
4,341,642 | 4,341,643 | BOOT_COMPLETED broadcast not working on Android 2.3.3 | <p>I was looking for a solution to a problem with BOOT_COMPLETED. The code was working file on Android 2.1, but not in 2.3.3. </p>
<p>Here my Manifest:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="jv.android.atm"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-sdk android:minSdkVersion="10" />
<application android:debuggable="true" android:label="@string/app_name">
<receiver android:name=".AtmLauncher">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" android:enabled="true" android:exported="true"/>
</intent-filter>
</receiver>
</application>
</manifest>
</code></pre>
<p>And the AtmLauncher.java:</p>
<pre><code>package jv.android.atm;
import android.content.BroadcastReceiver;
public class AtmLauncher extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
// Something.
}
}
</code></pre>
<p>What I'm doing wrong?</p>
| java android | [1, 4] |
3,728,040 | 3,728,041 | How do I make my app look like a standard Android app? | <p>I notice that most android apps have some sort of standard in that they all look similar. Most of them have some sort of list of Text that are click-able. It's somewhat hard to explain but they look really nice and I was wondering is there some sort of tool or api that allows me to change the look of an app to make it similar? Or do I have to specifically specify the different fonts and different graphics? Like this:</p>
<p><a href="http://www.androidandme.com/wp-content/uploads/2009/03/tmobapp1.png" rel="nofollow">http://www.androidandme.com/wp-content/uploads/2009/03/tmobapp1.png</a></p>
<p>I am new to Android programming so sorry if this sounds like a dumb question. Thank you.</p>
| java android | [1, 4] |
1,397,870 | 1,397,871 | Cursor : get the field value (Android) | <p>I have problems with Cursor in my Android application.
I have a SQLiteDatabase that return me Cursor when I try to fetch the values with :</p>
<pre>
public Cursor fetchOption(long rowId) throws SQLException {
Cursor mCursor =
mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
</pre>
<p>But I don't know how to obtain the value of the field in the Cursor.
If I do that :</p>
<pre>
String a = mOptionDb.fetchOption(0).getColumnName(0).toString();
String b = mOptionDb.fetchOption(0).getColumnName(1).toString();
String c = mOptionDb.fetchOption(0).getColumnName(2).toString();
</pre>
<p>I obtain the name of the columns (_id, title, body) but not the value.
How can I resolve that?</p>
<p>Thank you in advance for your answer.
Michaël</p>
| java android | [1, 4] |
846,430 | 846,431 | Rookie mistake:Trying to pass outgoing number to activity | <p>I am retrieving the outgoing number from the broadcast receiver and trying to send it to the activity thru a method getNumber() however the value is coming out null. Im my code below In the activity class the String phonenumber is null</p>
<p>BroadcastReciever Class:</p>
<pre><code>public class OutgoingBroadcastReceiver extends BroadcastReceiver {
String phonenumber = null;
@Override
public void onReceive(Context context, Intent intent) {
phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
if (intent.getAction().equals("android.intent.action.NEW_OUTGOING_CALL"))
{
Log.i("System out", "IN OUTGOING CALL......... :IF");
MyPhoneStateListener phoneListener = new MyPhoneStateListener(
context);
TelephonyManager telephony = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
telephony.listen(phoneListener,
PhoneStateListener.LISTEN_CALL_STATE);
} else {
Log.i("System out", "IN INCOMING CALL.........:else:receiver");
}
public String getNumber()
{
return phonenumber;
}
</code></pre>
<p>Activity Class:</p>
<pre><code>public class OutgoingCallScreenDisplay extends Activity
</code></pre>
<p>{</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.outgoing_main);
OutgoingBroadcastReceiver outreciever = new OutgoingBroadcastReceiver();
String phonenumber= outreciever.getNumber();//this is coming out NULL needs to be the outgoing number
}
</code></pre>
| java android | [1, 4] |
5,031,444 | 5,031,445 | Best tool for Code-Analyzement or Code-Review | <p>Which code-Analyzer or Code-Review tool do you suggest ,</p>
<p>For Analyzing <strong>DotNet 2.0 & 3.5</strong> code and getting</p>
<p><em>All classes , Methods , Properties , Instances , Definition ,
Databases & and their relation to code ,</em></p>
<p>I want to <strong>get print-ready Information</strong> about codes & projects ,</p>
<p>( <em>here I dont mean a tool for testing the code & structures</em> )</p>
<p>Is there anyone with similar specifications ?</p>
| c# asp.net | [0, 9] |
3,370,558 | 3,370,559 | Render image to a page | <p>I have a page <code>http://www.mysite.com/image.aspx</code>, that I want to load and display an image instead of rendering HTML.</p>
<p>I have the ContentType of the page set to <code>image/png</code>, and here's my code:</p>
<pre><code>using (Bitmap image = new Bitmap("http://www.google.com/images/img.png"))
{
using (MemoryStream ms = new MemoryStream())
{
image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
ms.WriteTo(Response.OutputStream);
}
}
</code></pre>
<p>But I get an error saying:</p>
<blockquote>
<p><em><strong>URI formats are not supported.</em></strong> </p>
</blockquote>
<p>How can I load an external image and render it to the page?</p>
| c# asp.net | [0, 9] |
3,398,434 | 3,398,435 | jQuery checkbox and span that share a click event | <p>So I have a checkbox and a span</p>
<p><code><input type="checkbox" class="checker"> <span class="something">Label</span></code></p>
<p>From which the span already has some functionality based on clicking it, I am adding a checkbox to the equation for visual aid. What I am trying to do is, when the checkbox is checked/unchecked I want it to trigger the spans already existing click function. Which this I can do.</p>
<p>I also want the same click function on the span to check/uncheck the checkbox next to it, while continuing its base function. Which this I can do as well. </p>
<p>The snag it seems is when I have both logics in the script, one will always X out the other, leaving one working and the other not. So I am trying to figure out how to make this work in harmony and I apparently am having issues thinking outside the box at the time and need some assistance getting there.</p>
<p>Here is the JS I am attempting to use currently</p>
<pre><code>$('.checker').live('click', function(e){e.preventDefault();$(this).siblings('.something').trigger('click');});
$('.something').live('click', function(e)
{
e.preventDefault();
if($(this).siblings('.checker').is(':checked'))
{
$(this).siblings('.checker').attr('checked', false);
}
else
{
$(this).siblings('.checker').attr('checked', true);
}
});
</code></pre>
| javascript jquery | [3, 5] |
2,088,107 | 2,088,108 | Unknown Ajax output | <p>My jquery ajax code is like this</p>
<pre><code> $(".head-text").live('click', function (event) {
var url = new URI().addQuery("showlist", 1);
$.ajax({
url: url, type: "GET"
, success: function (data) {
var $response = $(data);
alert($response.html);
}
});
return false;
});
</code></pre>
<p>and the alert always displays this message</p>
<pre><code> function ( str ) {
if ( typeof str != 'undefined' )
{
if ( this.data( 'dotdotdot' ) )
{
if ( typeof str != 'function' )
{
return this.trigger( 'update', [ str ] );
}
}
return _orgHtml.call( this, str );
}
return _orgHtml.call( this );
}
</code></pre>
<p>I cant understand what went wrong or what this means.I just want to see the result html.</p>
| javascript jquery | [3, 5] |
493,961 | 493,962 | jquery hide li tag | <p>I've html like this. I want to only show first <code>li</code> tags and don't want to show span. How to do this with jquery?</p>
<pre><code> <div id="div1">
<ul class="class2">
<li class="class3"><span class="sfBreadcrumbNodeSeparator">/</span> </li>
<li class="class3"> </li>
<li class="class3"> </li>
</ul>
</div>
</code></pre>
| javascript jquery | [3, 5] |
5,615,688 | 5,615,689 | Easing the excution flow in JS/JQuery | <p>Easing the excution flow in JS/JQuery
I've loop like this:</p>
<pre><code>for (int i = 0; i < 100; i++)
{
doSomething(...); // returns momentally
}
</code></pre>
<p>I'm looking for a way to apply easing to the execution flow - by giving a total duration and an easing pattern (ex. 2 seconds & easeback). Is is something doable in JS (I'm using jQuery too)?</p>
<hr>
<p><strong>Update 2</strong> Updated to clarify the question - I'm looking for the following:</p>
<p><strong>Update 3</strong> - Sheikh Heera is right, the sample I gave doesn't illustrate the real problem, execute function is updated to call an external module, which is closer to what I have. I don't see how jQuery's animate can be applied directly for calling functions.</p>
<pre><code>easer.ease({ start: 0,
end: 100,
duration: 900,
easing: "easeOutBounce",
execute: function (e) { ExternalModule.DoSomethingUseful(e); } });
</code></pre>
<p>where <code>start</code> the <code>end</code> are integers, specifying the animated range, <code>duration</code> is animation duration in milliseconds, <code>easing</code> is the easing pattern used to animate the values within a range, <code>execute</code> - the function which gets called with values from <code>0</code> to <code>100</code>, using the easing pattern supplied in the sample above it will animate myDiv's height from <code>0</code> to <code>100</code> within <code>0.9</code> seconds using <code>easeOutBounce</code> easing function. </p>
<p>Ideally as a small standalone plugin based on <code>jQuery</code>, definitely not part of <code>Mootools</code> or any other heavy hitters I can't afford bringing them in just for that.</p>
| javascript jquery | [3, 5] |
2,091,443 | 2,091,444 | Fixed position until scrolled | <p>I was hoping someone could help me here. </p>
<p>Im trying to fix a div at the bottom of the page until the user scrolls it will then scroll up too.</p>
| javascript jquery | [3, 5] |
3,773,077 | 3,773,078 | jQuery replaceWith find new element | <p>I'm writing a script to replace some images with divs in jQuery. I'm currently using the <a href="http://api.jquery.com/replaceWith/" rel="nofollow"><code>replaceWith()</code></a> method, which works fine, but returns the original (removed) element instead of the new element.</p>
<blockquote>
<p>The .replaceWith() method, like most
jQuery methods, returns the jQuery
object so that other methods can be
chained onto it. However, it must be
noted that the original jQuery object
is returned. This object refers to the
element that has been removed from the
DOM, not the new element that has
replaced it.</p>
</blockquote>
<p>How can I get a reference to the new DOM element I just created?</p>
| javascript jquery | [3, 5] |
1,578,323 | 1,578,324 | AJAX Cascading dropdown without updatepanel? | <p>I want to make a cascading dropdown list without using an UpdatePanel. I need tips for starting out this task. Currently,</p>
<ol>
<li>I am using asp.net 2.0</li>
<li>Will I be able to parse JSON in VSS 2005 if I use JQuery ?</li>
<li>What is the recommended alternate for UpdatePanel in Visual Studio 2005 ?</li>
</ol>
| asp.net jquery | [9, 5] |
4,237,859 | 4,237,860 | How to Convert event object to string in JavaScript? | <p>I am trying to get which event is occured :: </p>
<pre><code>function getEvent(){
alert(window.event);
}
</code></pre>
<p>I am getting below event object. I want it in string to compare. if event onclick event then I want to do the action. how can I get it in string? or how can I convert event object to string?</p>
<pre><code>[object MouseEvent]
</code></pre>
| javascript jquery | [3, 5] |
1,428,326 | 1,428,327 | Access HttpContext.Current.Application from batch process c# | <p>I have a C# ASP.NET web application which starts a thread running some methods in a class called <code>SiteCrawler.cs</code>.</p>
<p>In <code>HttpContext.Current.Application</code> I want to save some value when all the threads are finished running. My problem is that the <code>HttpContext.Current</code> object is <code>null</code> in the spawned threads because it doesn't exist there.</p>
<p>I have tried to search around every inch of Stackoverflow to find a solution but without any luck....</p>
| c# asp.net | [0, 9] |
3,840,217 | 3,840,218 | Figuring out which page is calling a piece of JavaScript, in PHP | <p>I have a PHP file that generates a JS file, that is being included on a number of sites. I'd like to be able to check which site the file is being included from on each request. I tried using <code>$_SERVER['HTTP_REFERER']</code> in PHP, but that just returns the domain that the JS file is hosted on. </p>
<p>Any ideas would be greatly appreciated.</p>
| php javascript | [2, 3] |
96,681 | 96,682 | Loading .js file cross domain using ajax | <p>I'm trying to access a cross domain .js file using ajax:</p>
<pre><code>$.ajax({
type:'get',
crossDomain:true,
url: "http://localhost/62588/scripts/bootStrapper.js",
contentType: "application/json",
dataType: 'jsonp'
}).done(callback);
</code></pre>
<p>I have a callback at the moment:</p>
<pre><code>getBootStrapperScript(function (callback) {
//do somethibg
})
</code></pre>
<p>I get the following error:</p>
<pre><code>XMLHttpRequest cannot load http://localhost/62588/scripts/bootStrapper.js. Origin http://localhost:62607 is not allowed by Access-Control-Allow-Origin.
</code></pre>
<p>I have been reading about JSONP but I'm not sure how to use it to load a .js file from anoather domain.</p>
<p>If I change the above code to use 'jsonp' for the datatype but I then get this errer:</p>
<pre><code>GET http://localhost/62588/scripts/bootStrapper.js?callback=jQuery18206067646441515535_1354459693160&_=1354459696966 404 (Not Found)
</code></pre>
<p>How can I load cross domain js files?</p>
| javascript jquery | [3, 5] |
2,572,545 | 2,572,546 | javascript/jquery- how to determine if a list/checkbox allows multiple values to be selected or not | <p>I am trying to parse through a typical form using jquery. I want to obtain all details about the various fields in the form- viz field name, field type (eg radio/checkbox/list)...</p>
<p>How do I determine if a field allows multiple values to be selected? (eg in check box or list box)?</p>
<p>If this cannot be done using jquery, then can it be done using pure javascript? I already have with me a ref to the element for which this (whether multiple values are allowed or not) has to be determined...</p>
| javascript jquery | [3, 5] |
3,000,705 | 3,000,706 | Which is the 'correct' way to do this (if statement) | <p>I've got plenty of these lying around, and I'm wondering if I'm going to face any trouble - or performance problems.</p>
<p>I have method A:
<pre><code>
MyClass monkey;
...
if(monkey != null) {
...
}
</pre></code></p>
<p>Or method B:
<pre><code>
boolean hasMonkey; //This is set to TRUE when monkey is not null
MyClass monkey;
...
if(hasMonkey) {
...
}
</pre></code></p>
<p>On a functional level, they both do the same thing. Right now, I'm using method A. Is that a bad way of doing things? Which is going to perform better?</p>
| java android | [1, 4] |
4,847,232 | 4,847,233 | about android calendar | <pre><code>Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime",XXX);
intent.putExtra("allDay",false);
intent.putExtra("eventLocation",XXX);
intent.putExtra("description","XXX");
startActivity(intent);
</code></pre>
<p>When i load this application locally calendar showing in all mobiles . We uploaded application into Android market. But calendar not showing any of the android mobiles. </p>
<p>What's wrong?
Thanks in advance!!</p>
| java android | [1, 4] |
4,185,962 | 4,185,963 | What is jQuery(document) vs. $(document) | <p>I don't get what jQuery(document) is here. I thought you always used $(document)</p>
<p>see here in his examples: <a href="http://sorgalla.com/projects/jcarousel/" rel="nofollow">http://sorgalla.com/projects/jcarousel/</a></p>
| javascript jquery | [3, 5] |
2,914,059 | 2,914,060 | Javascript: How to hijack input type=submit on click behavior? | <p>I got a button:
</p>
<p>Whenever I click on it, it submits to a form.</p>
<p>I want to hijack this behavior, so when I click, it calls a JS function instead. How do I do this? I added:</p>
<pre><code>$('input.submit').live('click', addFood);
</code></pre>
<p>The problem is it still submits to the form. When I remove "type="submit", it works. </p>
<p>I don't want to remove the HTML code. it'a also bound to CSS, and I don't want to change CSS because I'm afraid of messing it up =)</p>
<p>So question is: how do to change behavior of submit button so it doesn't submit to form but calls my Javascript (JQuery) function?</p>
| javascript jquery | [3, 5] |
3,558,878 | 3,558,879 | How to add multiple objects of class for same key value in HashMap in java? | <p>I want to store objects of class from arraylist to hashmap, one key may contain multiple objects, how to do that </p>
<p>here is my code,</p>
<p><code>Map<Integer, classObject> hashMap = new HashMap<Integer, classObject>();</code></p>
<pre><code>for(int i=0; i<arraylist.size(); i++)
{
sortID = arraylist.get(i).getID();
if(!hashMap.containsKey(sortID))
{
hashMap.put(sortID, arraylist.get(i));
}
hashMap.get(sortID).add(arraylist.get(i)); //i got error in add method
}
</code></pre>
<p>give any idea to add classobjects in hashmap for same key value...</p>
| java android | [1, 4] |
2,792,163 | 2,792,164 | cross page posting asp.net not returning values | <p>I have a web form as </p>
<pre><code><asp:TextBox ID="txtname" runat="server" Text="Post on Next Page"/>
<asp:Button ID="btn1" runat="server" PostBackUrl="~/Page2.aspx" Text="Post on next page" />
</code></pre>
<p>Now on <code>Page2.aspx</code> the code-behind is as follows:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if(PreviousPage!=null && PreviousPage.IsCrossPagePostBack)
{
TextBox txt1 = (TextBox)PreviousPage.FindControl("txtname");
label1.Text = "Value: " + txt1.Text;
}
}
</code></pre>
<p>I end up getting the error <code>object reference not set to instance of an object</code> for <code>txt1</code></p>
<p>Where <code>label1</code> is a label used to display the output. However, the value is not displayed.</p>
<p>What step am i missing?</p>
| c# asp.net | [0, 9] |
4,817,108 | 4,817,109 | I want to parse json , but unsuccessful. Can any one check my code | <p>I created a php page which print this from the database</p>
<pre><code>[{"sha_id":"2","sha_text":"This is 1st sha."},{"sha_id":"4","sha_text":"this is 2nd sha"}]
</code></pre>
<p>now i want to extract each variable out of this.. after googling for a while i got this</p>
<pre><code>$(document).ready(function(){
var output = $('#output');
$.ajax({
url: 'http://xxxx.com/android_sha/index.php',
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
success: function(data, status){
$.each(data, function(i,item){
var landmark = '<h1>'+item.sha_id+'</h1>'
+ item.sha_id+'</p>';
output.append(landmark);
});
},
error: function(){
output.text('There was an error loading the data.');
alert("error");
}
});
});
</code></pre>
<p>but it always alert error for me. I could be something wrong at <code>$.each(data, function(i,item){</code> but can't figure out what should be the correct format.</p>
| javascript jquery | [3, 5] |
3,208,447 | 3,208,448 | Need to change div's contents while slider changes | <p>My jquery banner needs to some fixes. I have used echo slider for banner. when banner image change to another image, we need to change the content in a div which is not inside the slider's boundary. The Div is separate div (No connection with slider ).</p>
<p>I have tried with the code. i just put if statement based on slider's navigation. </p>
<p>My codes affected the 1st banner image only. it doesnt affect next banner</p>
<p>Help me</p>
<p>Here below my codes</p>
<pre><code><div class="echo-nav">
<a rel="0" class="echo-control active" href="javascript:;">1</a>
<a rel="1" class="echo-control" href="javascript:;">2</a>
<a rel="2" class="echo-control" href="javascript:;">3</a>
<a rel="3" class="echo-control" href="javascript:;">4</a>
<a rel="4" class="echo-control" href="javascript:;">5</a>
<a rel="5" class="echo-control" href="javascript:;">6</a>
</div>
<script>
$(document).ready(function(){
if($('.echo-nav a.active').attr('rel')=='0'){
$('#app_info').text('Some dummy contents for one');
}
else if($('.echo-nav a.active').attr('rel')=='1'){
$('#app_info').text('Some dummy contents for Two ');
}
});
</code></pre>
| javascript jquery | [3, 5] |
4,088,125 | 4,088,126 | Javascript alert() after Response.Redirect | <p>I am calling this in my code behind: </p>
<pre><code>(test.aspx)
Response.Redirect("~/Default.aspx");
</code></pre>
<p>I want to include a javascript alert after/before being redirected to Default.aspx, is it possible?
I'm doing this because I'm passing a value to another page (test.aspx) and that page checks the db, if reader HasRow(), then redirect to Default.aspx. </p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
274,331 | 274,332 | Making one unique RadioButton across multiple RadioButtonLists? | <p>I have a repeater control that makes multiple RadioButtonLists. However, I only want one RadioButton (out of all of them) to be selectable at a time. What is the most effective way to do this?</p>
| c# asp.net | [0, 9] |
1,393,257 | 1,393,258 | Convert Javascript function to jQuery plugin | <p>I have already a short-hand function like so:</p>
<pre><code>function myObj() {};
myObj.prototype.read = function (name) {alert(name);};
...(more functions)
</code></pre>
<p>Now I would like to "convert" this to a jQuery plugin.<br>
What is the best way to do so? (My function doesn't need a selector before it).
I thought about doing it like this:</p>
<pre><code>$.myObj.methodHere();
</code></pre>
<p>Thanks in advance.</p>
| javascript jquery | [3, 5] |
3,975,270 | 3,975,271 | String comparison of text files | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1510520/compare-the-content-of-2-text-files-in-java-language">Compare the content of 2 text files in java language</a> </p>
</blockquote>
<p>I am trying to compare strings of two .txt files in an android application. can you please tell me how to proceed??
i want to insert the code in this</p>
<pre><code>try {
URL url = new URL("httpurl");
URLConnection ucon = url.openConnection();
InputStream is = ucon.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
ByteArrayBuffer baf = new ByteArrayBuffer(50);
int current = 0;
while ((current = bis.read()) != -1) {
baf.append((byte) current);
}
FileOutputStream fos = new FileOutputStream("/mnt/sdcard/random.txt");
fos.write(baf.toByteArray());
fos.close();
} catch (IOException e) {
Log.d("ImageManager", "Error: " + e);
}
</code></pre>
| java android | [1, 4] |
4,915,077 | 4,915,078 | Escape all characters that need to be escaped | <p>I am using a modal window in my asp.net application. On clicking a button I do some serverside processing and then use cs.RegisterStartupScript to close the window and return a value to the parent window. To do that I use RegisterStartupScript to run window.close. </p>
<p>Now the problem i am having is that I want to send a return value (a string) to the parent. But since the string is a user entered text that can have any characters, I need to escape all of them. Without that I am unable to send the return value to the parent.</p>
<p>This is my script that causes failure (error message :
unterminated string constant
DO you want to continue running scripts on this page?)</p>
<pre><code> StringBuilder saveScript = new StringBuilder();
saveScript.Append("var template = new Object();");
saveScript.AppendFormat("template.DescriptionPlainText = \"{0}\";",description);
saveScript.Append("window.returnValue = template;");
saveScript.Append("window.close();");
cs.RegisterStartupScript(typeof(myPageType), scriptName, saveScript.ToString(), true);
</code></pre>
<p>description is a string.</p>
<p>However this succeeds</p>
<pre><code>StringBuilder saveScript = new StringBuilder();
saveScript.Append("var template = new Object();");
saveScript.AppendFormat("template.DescriptionPlainText = \"{0}\";","xx");
saveScript.Append("window.returnValue = template;");
saveScript.Append("window.close();");
cs.RegisterStartupScript(typeof(myPageType), scriptName, saveScript.ToString(), true);
</code></pre>
| c# javascript | [0, 3] |
90,709 | 90,710 | Code won't execute in $(document).ready but will in developer console | <p>I have some code wrapped in <code>$(document).ready(function(){ /*code*/ });</code>, and all of it works fine, except for one line. The code above it works fine, the code below it works fine, I'm not getting any errors in my console.</p>
<pre><code>$('.main-right.category').height( $('.footer').height() + $('.main-right.category').height() );
</code></pre>
<p>That doesn't fire. However, if I paste that exactly in the developer console and press enter after the page has loaded, it works. All of the elements exist at page load (meaning none are built dynamically via javascript). Same result in chrome, firefox, IE. </p>
<p>Any ideas?</p>
<p>edit: I should add that my css is loaded before my javascript, and I've done other CSS related tweaks in this same javascript file that have worked fine.</p>
<p>Also, if I console.log $('.main-right.category').height() and $('.footer').height() right above that line of code, they both give non-zero integer values like I'd expect.</p>
| javascript jquery | [3, 5] |
748,265 | 748,266 | Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable | <p>I keep getting this error when I do this:</p>
<pre><code><?php
$info = $_POST['mname'];
$info = ucwords($info);
// Make a MySQL Connection
mysql_connect("localhost", "user", "password") or die(mysql_error());
mysql_select_db("javadatest") or die(mysql_error());
// Get a specific result from the "example" table
$result = mysql_query("SELECT * FROM movieList
WHERE name = '$info'") or die(mysql_error());
// get the first (and hopefully only) entry from the result
$row = mysql_fetch_array( $result );
// Print out the contents of each row into a table
//echo $row['name']." ".$row['year']." ".$row['genre'];
echo "
<script language=javascript>
var jsvar;
jsvar = <?php echo $row['name'], $row['year'], $row['genre'];?>
function buy() {
window.location = \"https://www.paypal.com\";
alert(\"Thanks for shopping at Movie Store\");
}
var myWindow = window.open('', '', 'width = 300, height = 300);
myWindow.document.write(jsvar);
myWindow.document.write('<body>');
myWindow.document.write('<input type="button" value="Buy" onclick=/"buy()/">');
myWindow.document.write('</body>');
//myWindow.buy = buy;
</script>
";
?>
</code></pre>
<p>I'm trying to use javascript in a php file by putting my javascript code in my echo statement. I can't figure out what I'm doing wrong. Any help would be appreciated.</p>
| php javascript | [2, 3] |
2,470,805 | 2,470,806 | How do I pass a searchstring to perform a search? | <p>again I'm stuck and asking you to help me.</p>
<p>I want to enter a search string in an input-field. The search string should perform a search like <a href="https://.../=~searchstring" rel="nofollow">https://.../=~searchstring</a></p>
<p>The textfield:</p>
<pre><code>$("<input id='field-inputSearchString' type='text' name='field_inputSearchString'>").insertAfter('.completed ticket');</code></pre>
<p>I've got two questions here:</p>
<ol>
<li><p>I guess I need to 'find' the string to pass it to the search link. Is it sth. like this?
<code><pre>$(function() {
var foundin = $('input[id$='field-inputSearchString']:contains(text)');
});
</code></pre></p></li>
<li><p>And how do I pass the text to the link? Have you got an example or link explaining what I'm looking for?</p></li>
</ol>
<p>I appreciate every help. Thank you so much in advance.</p>
| javascript jquery | [3, 5] |
2,616,672 | 2,616,673 | About clearing the Queue when the page load in ASP.net | <p>I'm trying to fill a queue with user's mails to send confirmation mails to them after a period of time, so every time any user fill his registration form I add him to the queue in order to send mails to them after about one minute and here is my code</p>
<pre><code>public static class Gmail
{
private static int ? date;
public static bool SendMail(string AdminMail,string AdminPassword,string subject,string toAddress, string content,DateTime SendTime)
{
var toAddressList = new Queue<string>();
toAddressList.Enqueue(toAddress);
if(date==null)
{
date = DateTime.Now.Second;
}
if (date-SendTime.Second > 120)
{
var message = new MailMessage
{
From = new MailAddress(AdminMail)
};
foreach (var toAddressl in toAddressList)
{
message.To.Add(new MailAddress(toAddressl));
}
message.Subject = subject;
message.Body = content;
message.IsBodyHtml = true;
var smtp = new SmtpClient
{
Credentials = new System.Net.NetworkCredential(AdminMail, AdminPassword),
Port = 587,
Host = "smtp.gmail.com",
EnableSsl = true
};
smtp.Send(message);
//date = SendTime;
return true;
}
return false;
}
}
</code></pre>
<p>but actually what happens is that the queue starts from zero every time, so it is only filled with the mail of the current registered users and never contain the mails of the previous registered users which I want them to exist as I will send mails to all mails existing in the queue.So I'm wondering how I can prevent the queue from been cleared when the page loads.Any ideas??</p>
| c# asp.net | [0, 9] |
5,005,430 | 5,005,431 | Compensate drawing delay from the game logic updates | <p>Now I have (1: the UI-loop, there my SurfaceView is placed), (2: a second thread, there the draw function from the UI-loop is called AND the update calculations from my Engine) and (3: the engine, there all the calculations stuff are).</p>
<p>Now I wonder how the best and smoothest way to do the SurfaceView independent from the actual frame rate. How shall I do so it will compensate if there is a low frame rate?</p>
<p>I think my current solution isn't enough, see code below.</p>
<p>Thread-class</p>
<pre><code>//Constructor stuff....
int static delay = 0; /* My delay in milliseconds, depends most on
which sort of game I'm trying to make */
@Override
public void run() {
while (state==RUNNING) {
long beforeTime = System.nanoTime();
engine.updateSprites(); //Update calculations from my engine
//Rita
Canvas c = null;
try {
c = surfaceHolder.lockCanvas(null);
synchronized (surfaceHolder) {
view.myDraw(c); //My draw function
}
} finally {
if (c != null) {
surfaceHolder.unlockCanvasAndPost(c);
}
}
sleepTime = delay-((System.nanoTime()-beforeTime)/1000000); /* 1000000 because
of the nanoTime gives us the current timestamp in nanoseconds */
try {
if(sleepTime>0){
Thread.sleep(sleepTime);
}
} catch (InterruptedException ex) {
}
}
</code></pre>
<p>Is this code enough to ensure the independent from low frame rate? If not, where is my way to go?</p>
<p>Thanks in advance!</p>
| java android | [1, 4] |
3,744,321 | 3,744,322 | change a value in a php variable using javascript | <p>I have a value in a php variable <code>$thumb_path="images/Gallery1/thumbs/";</code>. I need to change this value to <code>$thumb_path="images/Gallery2/thumbs/";</code> when I am clicking on Gallery2 Link n my project. IS it possible to change a value in a php variable using JavaScript?
Or
Is there is any other way to do this?</p>
<p>Please help me</p>
| php javascript | [2, 3] |
2,078,474 | 2,078,475 | how can i load the contents of an xml file at a url into a string? | <p>how can i load the contents of an xml file at a url into a string?</p>
<p>eg there is an xml file at <a href="http://www.example.com/test.xml" rel="nofollow">http://www.example.com/test.xml</a></p>
<p>I want the text of the xml to be assigned to a string.
How can i do that using c#?</p>
<p>thanks</p>
| c# asp.net | [0, 9] |
2,806,032 | 2,806,033 | How to create a program that solves a Triangular Peg solitare - C++ / Java programming? | <p>Honestly, I only knew of such a game recently and I wonder how one can create a solving algorithm using the recursive search method?</p>
<p>There are 15 holes in total in the triangular board. Making that 14 pegs with a total of 13 moves.
I don't know where to start with this in C++ nor Java. I have studied C++ for an year before. So I'm familiar with the concepts of stacks, linked lists etc.</p>
<p>I just don't know how to start the code. The program firstly asks the user where they want to start (How is this done?)
Then once it solves it , a certain number of pegs more than just one will be left and the program will ask the user for a better solution (like this until the board is left to just one peg.)</p>
<p>I certainly cannot think of how to make the moves possible ( How do I write a code that "SHOWS" that one peg moves over a hole ,into another?)</p>
<p>I'd love some coding assistance here. It would really be appreciated.</p>
| java c++ | [1, 6] |
1,240,247 | 1,240,248 | Display postback value | <p>I am working on a project and I found that the Session transferred value not being displayed in Label on first click. On clicking the button for the second time only the Session transferred value is being displayed. The sample code is below please let me know how to get the value displayed on the first click. Note: Value to be displayed inside the <code>IsPostBack</code> function as I am using lots of functions inside <code>IsPostBack</code></p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
string kitty = Convert.ToString(Session["ping"]);
Label1.Text = kitty;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string a = TextBox1.Text;
Session["ping"] = a;
}
</code></pre>
| c# asp.net | [0, 9] |
1,329,004 | 1,329,005 | Login with formAuthentication in Asp.net using c# | <p>How to login or authenticate using FormAuthenticate method in ASP.NET web forms and after login how to check on each page whether user is authenticaed or not.</p>
<p>please give me a sample for that how to use form authentication in login page.</p>
| c# asp.net | [0, 9] |
1,929,876 | 1,929,877 | Jquery Iterate over table and highlight cells that have changed | <p>I have a table that is a history of a mysql record.</p>
<p>I want to add a button that will highlight the changes.</p>
<pre><code><table>
<tr>
<td>100</td>
<td>200</td>
<td>300</td>
</tr>
<tr>
<td>100</td>
<td>200</td>
<td>600</td>
</tr>
</table>
</code></pre>
<p>In this example the 600 would be highlighted as it was 300 and is now 600.</p>
<p>UPDATE: Thanks, I should have said there would be more than 2 rows. could be upto 20 rows</p>
| javascript jquery | [3, 5] |
329,897 | 329,898 | Javascript Background color switching | <p>I am trying to use javascript to control the background color of a form element, what I have so far:</p>
<pre><code> <script type="text/javascript">
$(document).ready(function() {
$('option.POIs').click(function() {
$(this)
.css('background-color','#EE178C')
});
});
</script>
</code></pre>
<p>It works well, however I would like for it to toggle between to different colors. Default color would be #FFFFFF and the other would be #EE178C. So when the page loads the bg color is #FFFFFF when I click on the item the bg changes to #EE178C, and if I click on it again it goes back to #FFFFF.</p>
<p>Any help would be appreciated!</p>
| javascript jquery | [3, 5] |
3,233,371 | 3,233,372 | jquery and jscript if else | <p>I'm using the code below to make a box appear when certain text is clicked. How do i limit it so only one box can be slid down at a time.</p>
<p>E.g. if i click the first button it slides down, then if i click the second button the first box slides up again?</p>
<p>Here's my code</p>
<pre><code><script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".flip1").click(function(){
$(".panel1").slideDown("fast");
});
});
$(document).ready(function(){
$(".flip2").click(function(){
$(".panel2").slideDown("fast");
});
});
$(document).ready(function(){
$(".flip3").click(function(){
$(".panel3").slideDown("fast");
});
});
$(document).ready(function(){
$(".flip4").click(function(){
$(".panel4").slideDown("fast");
});
});
</script>
<div id="betslip">
<td><div class="panel1"><?php echo $bet1; ?></div></td>
<td><div class="panel2"><?php echo $bet2; ?></div></td>
<td><div class="panel3"><?php echo $bet3; ?></div></td>
<td><div class="panel4"><?php echo $bet4; ?></div></td>
</div>
</code></pre>
| javascript jquery | [3, 5] |
5,323,653 | 5,323,654 | JQuery / Javascript Add "id" to a <div> where class="x" | <p>I have a line of code which is...</p>
<pre><code><div class="x">
xyz
</div>
</code></pre>
<p>I want to write a script to find the div where class == "x", and change it to be...</p>
<pre><code><div class="x" id="y">
xyz
</div>
</code></pre>
<p><strong>any help is appreciated</strong></p>
| javascript jquery | [3, 5] |
4,890,451 | 4,890,452 | How to define document height is changed in javascript/jquery? | <p>I have a problem for showing a full size div over all of my HTML document. I've set the size of my div to my page width and height. and write this codes for resizing of document:</p>
<pre>
$(window).resize(function(){
sysSetOverlaySize(cDivOverlay);//cDivOverlay is my full size div
});
</pre>
<p>when my browser window resize this function is called and set the new size of my div from the size of my page. but when tinymce increase my page height this function only called in FF. I want some action to define when document height is changed.
Thanks a lot </p>
| javascript jquery | [3, 5] |
2,856,872 | 2,856,873 | JQuery Detect class changes | <p>I am using a plugin that added a class <code>open</code> to <code>.slide-out-div</code> when opened.</p>
<p>So I am trying to change some css if the open is detected.</p>
<p>What I need to do is </p>
<pre><code>IF
$('.slide-out-div **open**') IS Detected then
$('.otherDiv').css('top','0px');
</code></pre>
<p>Not sure how to put this together...</p>
| javascript jquery | [3, 5] |
5,599,001 | 5,599,002 | Extract word from Url | <p>I have a search function, and would like to display the search term in the search input.</p>
<p>My url is: <code>search-1.html?keyword=XXXXXX</code></p>
<p>How do I get this, and display it in an input?</p>
<p>Thank you in advance.</p>
| javascript jquery | [3, 5] |
5,151,000 | 5,151,001 | How to enqueue callbacks before jQuery is loaded? | <p>I switched to using Require.JS in an app and immediately faced this problem:</p>
<p>I used to use inline JS to initiate certain calls once certain part of DOM is loaded. Now apparently jQuery loads only after those calls are executed, thus resulting in errors because jQuery ($) is undefined.</p>
<p>What's the best way to enqueue callbacks for jQuery before it's loaded? I need them to fire either immediately if jQuery is already loaded, or immediately once it's loaded.</p>
| javascript jquery | [3, 5] |
1,854,036 | 1,854,037 | how to fill textbox from dataset? | <p>i run this and i want to fill textbox txtFname with data - but it dont do nothing</p>
<pre><code> using (Conn = new SqlConnection(Conect))
{
Conn.Open();
SQL = "SELECT * FROM MEN where id = '" + txtBAR.Text.Trim() + "'";
dsView = new DataSet();
adp = new SqlDataAdapter(SQL, Conn);
adp.Fill(dsView, "MEN");
adp.Dispose();
txtFname.Text = dsView.Tables[0].Rows[3][0].ToString();
txtFname.DataBind();
Conn.Close();
}
</code></pre>
<p>how to do it ?</p>
<p>thank's in advance</p>
| c# asp.net | [0, 9] |
5,473,941 | 5,473,942 | ASP.Net WebForms| Show text only to login users? | <p>So. i got a website in asp.net webforums, the thing is. </p>
<p>i can easyley control who can look to each pages with :</p>
<pre><code><location path="seetalktous.aspx">
<system.web>
<authorization>
<allow users="admin"/>
<deny users="*" />
</authorization>
</system.web>
</location>
</code></pre>
<p>the thing is, what can i do if i want a page to be seen to normal users, but only a text line will be showed to login ones, or only button will be showed to a user(admin) how can i do that?</p>
<p>thanks alot!</p>
| c# asp.net | [0, 9] |
3,415,754 | 3,415,755 | Rewriting Java code to c# | <p>I am busy rewriting some code to c# but i have rub into some difficulty with the following piece.</p>
<pre><code> SearchControls ctls = new SearchControls();
ctls.setReturningAttributes(attrIDs);
ctls.setSearchScope(ctls.SUBTREE_SCOPE);
String searchBase ="";
searchBase = "ou=Users,ou=ABSASAPHR,c=za";
int count=0;
int count2=0;
NamingEnumeration answer = ctx.search(searchBase, filter, ctls);
while (answer.hasMore())
{
count=count+1;
SearchResult sr = (SearchResult)answer.next();
String dn = sr.getName();
Attributes attrs = sr.getAttributes();
String uid,cn,emp,empno;
try
{
cn = attrs.get("cn").toString();
} catch (Exception err)
{
cn = " ";
}
String cn1[]=cn.split(": ");
uid=cn1[1];
try
{
emp = attrs.get("uid").toString();
} catch (Exception err)
{
emp = " ";
}
String empno1[]=emp.split(": ");
empno=empno1[1];
boolean flag=false;
</code></pre>
<p>I presume a converter would not work and ihave a very basic understanding of java. Could any one please point me in the right direction.
Thanks</p>
| c# java | [0, 1] |
253,946 | 253,947 | jQuery add not working with HTML | <p>In the <a href="http://api.jquery.com/add/" rel="nofollow">jQuery <code>add</code> documentation</a>, it lists an <code>add(html)</code> overload which describes the <code>html</code> argument as:</p>
<blockquote>
<p>An HTML fragment to add to the set of matched elements.</p>
</blockquote>
<p>Since there is already an <code>add(element)</code> overload, I assume this means that you pass it an HTML string, as in:</p>
<pre><code>var set = $();
set.add("<div></div>");
document.write(set.length); // prints 0
</code></pre>
<p>However, <a href="http://jsfiddle.net/s2zQr/" rel="nofollow">when this code is run</a>, it has no effect on the jQuery wrapped set. What am I missing?</p>
| javascript jquery | [3, 5] |
1,980,979 | 1,980,980 | How can I find the (file) name of the current page in ASP.NET? | <p>How can I find the name of (default.aspx ) current page or web control in the code behind?</p>
<p>I want to write a superclass that uses this name.</p>
| c# asp.net | [0, 9] |
4,836,341 | 4,836,342 | ClientScript.RegisterStartupScript in footer | <p>Can we call:</p>
<pre><code>ClientScript.RegisterStartupScript(typeof(Page), "KyAUIDFCS", "<script language='javascript' type='text/javascript'>slidershow();</script>");
</code></pre>
<p>in user control, how can we implement this let me know because there page object in usercontrol. Are there any alternate ways. </p>
| c# asp.net | [0, 9] |
3,210,388 | 3,210,389 | Hide Links not containing my Keyword (Case Sensitive) | <p>I'm using this shopping cart script that sends Links to my own website. Meaning I have no control over the HTML.</p>
<p>The links look like this:</p>
<pre><code><a href="something.com">Yamaha 800cc motorbike</a>
<a href="something.com">800cc Kawasaki</a>
<a href="something.com">Motorbike 1000cc Honda</a>
</code></pre>
<p>And there are variations in which the anchor text Casing is different as well.</p>
<p>ie:</p>
<pre><code><a href="something.com">YAMAHA 800cc motorbike</a>
<a href="something.com">yamaha 1000cc motorbike</a>
</code></pre>
<p>My Goal:</p>
<p><strong>HIDE all Links that Do Not have Yamaha, yamaha or YAMAHA in the anchor text.</strong>
(all text casings)</p>
<p>To end up with Yamaha motorbikes only.</p>
<p>Anyone know how to do this?</p>
<p>Thanks and best regards,</p>
<p>Chakhun</p>
| javascript jquery | [3, 5] |
4,952,376 | 4,952,377 | when i submit the form all the values which i entered gone out | <p>The values which i have entered gone out if i submit the form with any validation error. I want remaining values has to be stay in particular field except the validation error filed</p>
| php javascript | [2, 3] |
2,362,459 | 2,362,460 | jQuery - passing id element to a non-anonymous callback function without using an anonymous function | <p>I'm trying to pass an element's <code>id</code> to <code>storePair</code></p>
<p><code>$("#someid").click(storePair($(this).val(),$(this).attr("id"));</code></p>
<p>using <code>$(this)</code> doesn't work. no value.</p>
<p>Another <a href="http://stackoverflow.com/questions/948198/non-anonymous-function-for-jquery-selector-click-myfunc">stackoverflow post</a> suggests that I use an anonymous function as a wrapper for <code>StorePair(val,id)</code>, i.e., </p>
<pre><code>$("#someid").click(function(){storePair($(this).val(),$(this).attr("id")});
</code></pre>
<p>That seems kind of roundabout... Is there a way to call <code>StorePair</code> and pass the value and id without using the anon function?</p>
| javascript jquery | [3, 5] |
230,236 | 230,237 | how to set builtindocument proprties of excel before saving to clientPC | <p>I am trying to set builtindocument property value to excel. Excel is created using response object and pop up the dialog box on client side to save it . I want to assign vaue to document property before the dialog box appears . I am getting exception
when assigning response to new excel.application object.</p>
<pre><code> string importFile = da.ImportFile(ddlFile.SelectedValue, ddlFile.SelectedItem.Text);
Response.Clear();
Response.AddHeader("content-disposition", "attachment; filename=" + ddlFile.SelectedItem.Text + ".xls");
Response.AddHeader("content-type", "excel");
using (StreamWriter writer = new StreamWriter(Response.OutputStream))
{
writer.Write(importFile);
}
Excel.Application oXL = new Excel.Application(Response); Microsoft.Office.Core.DocumentProperties properties;
properties = (Microsoft.Office.Core.DocumentProperties)oXL.ThisWorkbook.BuiltinDocumentProperties;
Microsoft.Office.Core.DocumentProperty prop;
prop = properties["Revision Number"];
if (prop.Value == null)
{
prop.Value = 5; // this will be auto-increment
}
Response.End();
</code></pre>
<p>Can someone pl. help how I can use response to set builtinproperties . Thanks in advance !</p>
| c# asp.net | [0, 9] |
5,488,787 | 5,488,788 | Using other web app App_GlobalResources resorces asp.net C# | <p>I cant't figure out how can i use other web app App_GlobalResources resources file in my webapp</p>
<p>both are in same server.</p>
<p>Thanks! </p>
| c# asp.net | [0, 9] |
4,628,093 | 4,628,094 | Convert a .val() into string jQuery | <p>I have a jQuery function that gets the value from a form input text object named <code>content</code> in which a user can enter an HTML tag in the form. For example, the user types "Sample" with <code><b></code> tags. Once submit is fired, jQuery gets the value from <code>content</code>.</p>
<pre><code>var content = $('[name=content]').val();
</code></pre>
<p>My problem is if the user has a tag lets say a <code><b></code> tag, I want to output the raw html string to the user instead of having it rendered.</p>
<p>How can I do it? Any help will be much appreciated, I'm new to jQuery.</p>
| javascript jquery | [3, 5] |
4,779,535 | 4,779,536 | jQuery variable contains " and ' | <p>is it at all possible to replace the <code>'</code> in the postbody variable with <code>&#39;</code> without actually editing the postbody variable contents</p>
<pre><code>var postbody = '<div class="postbody">this is tom's and bill's post</div>';
var postid = $('#post-content');
postid.append(postbody);
</code></pre>
<p><a href="http://jsfiddle.net/3nVrZ/" rel="nofollow">http://jsfiddle.net/3nVrZ/</a></p>
| javascript jquery | [3, 5] |
482,533 | 482,534 | create image from divs composite | <p>I'd like to have a div as a canvas, where users would choose images to show, out of a list. They will choose what background it would have, icons, and they will upload an image which will appear in this canvas too.</p>
<p>I'm looking for solutions in PHP or ASP.NET.</p>
<p>thansk</p>
| php asp.net | [2, 9] |
4,338,474 | 4,338,475 | compare between input value with 0 trail | <p>I found that when jQuery get a value with 0 (for example 100)trail, it will omit it. So if I compare 5>100, the result is true. So how do I solve this?
here is the HTML code:</p>
<pre><code><form id="target">
<input type="text" id="max" value="100"/>
<input type="text" id="number" />
<input id="submit" type="submit" value="submit" />
</form>
</code></pre>
<p>And here is jquery:</p>
<pre><code>$('#target').submit( function() {
var a = $("#number").val();
var b = $("#max").val();
if( a > b){
alert("exceed limit");
}
return false;
});
</code></pre>
<p>Here you can see demo: <a href="http://jsfiddle.net/yqMGG/91/" rel="nofollow">http://jsfiddle.net/yqMGG/91/</a></p>
| javascript jquery | [3, 5] |
5,222,071 | 5,222,072 | parallax with 1 image | <p>I want to use parallax effect with only 1 image. Can it be done?</p>
<p>Actually, it's not really parallax, I have one big image in the center of screen, so when I move my mouse to the left, I want the image slightly moves to the right, move mouse to the right, the image slightly moves to the left, move mouse up image moves down, move mouse down image moves up.</p>
<p>I think I've seen this effect before, but I kinda forget where I see it. Really appreciate help. Thanks</p>
| javascript jquery | [3, 5] |
2,421,245 | 2,421,246 | JS to PHP conversion | <p>I've got an old JS script to retrieve my last tweet and display the date in a « X minutes ago » fashion. I want to convert it to PHP and, in the process, improve/optimize it if possible :</p>
<pre><code>var dateAct = new Date();
var diff = dateAct.getTime() - dateTwit.getTime();
var min = (diff/(1000*3600))*60;
var result; var sec;
var y = i+1; var z; var k;
if (min < 0) result = 'recently'
else if (min < 1) { sec = (diff/(1000*3600))*60*60; result = Math.round(sec) + ' seconds ago'; }
else if (min < 60) result = Math.round(min) + ' minutes ago';
else if (min < 120) result = 'about an hour ago';
else if (min < 1440 ) { var hours = Math.round(min/60); result = 'about ' + hours + ' hours ago'; }
else {
var days = Math.round(min/1440);
if (days < 365) result = 'about ' + days + ' day(s) ago';
else result = 'over a year ago';
}
</code></pre>
| php javascript | [2, 3] |
840,936 | 840,937 | identifying code that compiles in both Java and C# but runs differently | <p>I am having to port code from Java to C# (and soon the other way round) by copying and pasting and then editing compiler errors. (Please accept that this is necessary; I can explain if required). Are there cases where the same code fragment runs differently in the two languages? I would include cases where order or operation or operator precedence was defined in one languge but undefined in the other but exclude cases where it was undefined in both.</p>
<p>I would be particulary interested in any development tools which could identify such fragments.</p>
<p>@Thomas. Thanks. J# is not an option - the code is mandated to be in C#. What does "this" refer to in your comment?</p>
| c# java | [0, 1] |
4,162,168 | 4,162,169 | Can jQuery manipulate inserted elements? | <p>I'm a freshman to jQuery. I think it's reasonable that jQuery could manipulate elements added by code, but I found it couldn't just now. </p>
<pre><code>$(function(){
$("#addVideo").click(function(){
$("#publisher").append("<div id='choseType'><input type='button' value='video'> <input value='music' type='button'> <input type='button' value='X'></div>");
})
$("#choseType input:eq(0)").click(function(){
$(this).addClass("selected");
})
})
</code></pre>
<p>Is it jquery's limitation or my code's fault? It seems if I put the second <code>click()</code> function into the first one it will run correctly, but it will only run once(if I remove the appended <code>#choseType</code>and append it again the second click won't work.).Then how do I manipulate code added elements? Thanks!</p>
| javascript jquery | [3, 5] |
5,599,795 | 5,599,796 | Js : open new window and work with it | <p>is possible to open new window ( with external url ) with javascript or jquery and check if in that window was submited a form</p>
<p>something like : <code>window.open(....)</code> then : <code>if ( POST in new window ) { document.write('in new window was submited a form ' ); }</code> ..</p>
<p>Thanks in advance</p>
| javascript jquery | [3, 5] |
889,530 | 889,531 | hide div if clicked outside of it | <p>I’m having a little trouble with this JQuery function.</p>
<p>Basically, I have a div, that when clicked, shows another Div. It’s set to a toggle, actually, so it toggles on/off when you click.</p>
<p>I want to have it where if you click on anywhere outside of the opened div (that appears after you click on the first div), the div that was opened is closed.</p>
<pre><code>$("#idSelect").click(function() {
$("#idDiv").toggle();
});
</code></pre>
| javascript jquery | [3, 5] |
697,951 | 697,952 | how to reduce a latitude to 4 decimal places | <p>This is my second post on this subject. I have found dozens of posts on this subject and not a single solution that works. The location listener will provide you a latitude such as 3.734567E7. My goal is to reduce the accuracy of that latitude to four decimal places. I don't care if I truncate it or round it. the following code...</p>
<pre><code> Double d = Double.parseDouble("3.734567E7");
NumberFormat fmtr = new DecimalFormat("###.####");
String f = fmtr.format(d);
Log.w(getClass().getName(), "result using DecimalFormat = " + f );
d = (double) Math.round(d * 10000.0) / 10000.0;
Log.w(getClass().getName(), "result using math round = " + d );
f = d.toString();
Log.w(getClass().getName(), "result string using math round = " + f );
</code></pre>
<p>produces three lines:
37345670
3.734567E7
3.734567E7</p>
<p>none of this processing has any affect on the number.</p>
<p>when I had to do this in C# on my windows phone app I did the following...</p>
<p>myExecution.latitude = Math.Round(newLatitude, 4); It took less than a minute of my time. I have over a weeks time trying to figure out how to do the same thing in java. the Java math.round, oddley enough, has no way to specify how many decimal places you desire to round to making it totally usless as far as I can understand.</p>
<p>I realize that scientific notation is only supposed to be a way of displaying values and does not have anything to do with how an amount is stored internally. This makes this problem all the more perplexing.</p>
<p>Can anyone modify the code above to make it round to 4 decimal places?</p>
<p>(but you can't change the 1st line of code. It must be specified in scientific notation. If you specify it in decimal notation it works wonderfully.
thanks, Gary</p>
| java android | [1, 4] |
3,205,405 | 3,205,406 | getting value from popup window | <p>is this code is write or wrong?</p>
<pre><code>imgbtnProdSearch.Attributes.Add("onclick", "window.open('popUp.aspx?name=" +txtSelectProdName.ClientID+"','_new','width=1000px,height=1000px');return false");
</code></pre>
| javascript asp.net | [3, 9] |
1,963,644 | 1,963,645 | how to use PyV8 and httplib to interpret javascipt | <p>I would like to write my own web test engine that will request (get/post) my wsgi application and i would like my client to interpret the return page that contains some javascript code. </p>
<p>Basically it is how to use a PyV8 to make a headless browser.</p>
<p>Thx</p>
| javascript python | [3, 7] |
4,982,482 | 4,982,483 | Base64 string Compression | <p>I have got an ActiveX Control that gets an image from a fingerprint device as base64 string. The Active works great and I could transfer the returned base64 string to the server to be converted to a binary data and then to be saved to a database. I use ASP.NET as server side technology and JavaScript as client side technology. The problem is that the base64 string is tool large and it would take from 30 to 40 seconds for the string to be transferred to the server. My question is: Is there any way to compress this base64 string on client (Browser) and deflate it back on server. </p>
| asp.net javascript | [9, 3] |
3,305,492 | 3,305,493 | How to do a jquery find on intially hidden element | <p>I have a div with a class name 'form'. When the page is initially loaded this div is hidden (it's an asp.net web forms Panel control). The panel is displayed when a search button is clicked to open a search form on the page. I need to capture when the user hits enter in any of the textboxes and have it click the Search button which I've added a class named 'form-default'. </p>
<p>The problem I have is that my event handler isn't hooked up because because 'form' wasn't visible when the page was initially loaded and so couldn't access my textboxes. I could have them attach when the form is opened but I'm trying to get a small code snippet that can be loaded in a global file so that we can easily alot class names of 'form' to div's and 'default-form' to buttons within the div to have default buttons within the page in more than one place. I don't want developers to need to remember to hook up the calls when the UI changes. Can I use live() to hook this up or am I doing something else wrong?</p>
<pre><code>$(".form").find(".ec-text").keydown(function(e){
if (e.which == $.ui.keyCode.ENTER){
this.closest(".form-default").click();
}
});
</code></pre>
<p>EDIT: This works fine:</p>
<pre><code>$(".ec-text").live("keydown", function(e){
if (e.which == $.ui.keyCode.ENTER){
this.closest(".form-default").click();
}
});
</code></pre>
<p>BUT I need to attach the event handler to items ONLY inside a .form div. Applying this:</p>
<pre><code>$(".form").find(".ec-text").live("keydown", function(e){
if (e.which == $.ui.keyCode.ENTER){
this.closest(".form-default").click();
}
});
</code></pre>
<p>doesn't work. Any ideas?</p>
| jquery asp.net | [5, 9] |
2,683,223 | 2,683,224 | (html/css/javascript) Trying to make my Current Page link in the navbar a different color | <p>I've been reading around and people recommending only CSS to change the current page navbar link background color but I don't get how that's possible since CSS is static and I won't be able to add/remove the <code>.currentlink</code> class on the links? So right now I'm using JS / jquery to try to add / remove class based on click, but the site refreshes and nothing is saved when I click, so that the class that I added/removed doesn't do anything. May someone guide me the right direction? Example: I click on the last link of the HTML I gave you, but it would just go to that site and since everything refreshes to a new site, the background doesn't change.</p>
<p>HTML</p>
<pre><code> <nav class="clearfix">
<a href="#">home</a>
<a href="#">about us</a>
<a href="#">tour</a>
<a href="index.html">flickr search</a>
<div class="rightnav">
<a href="#">Sign Up</a>
<a href="#">Log In</a>
</div>
</nav>
</code></pre>
<p>CSS</p>
<pre><code>.greybackground {
background: #E6E6E6;
}
</code></pre>
<p>JS</p>
<pre><code>$('nav a').on('click', function(){
$('nav a').removeClass('greybackground');
$(this).addClass('greybackground');
});
</code></pre>
| javascript jquery | [3, 5] |
3,087,059 | 3,087,060 | Where to store data in order to avoid database hitting? | <p>I am using webmethod which fetches data from database & storing it in a static variable so that next time it will not hit the database becoz the data is being accessed frequently. Creating static variable doesn't seem to be a proper solution what is an alernative to this scenario.</p>
<p>e.g</p>
<pre><code>public static List<SupplierGridData> lstFullSupplierData;
public static List<SupplierGridData> GetProductData()
{
if (lstFullSupplierData == null)
{
//first time get data from database
lstFullSupplierData = new List<SupplierGridData>();
lstFullSupplierData = new POProcess().GetInquiryDetails();
}
else
{
//use lstFullSupplierData which holds data
}
}
</code></pre>
| c# asp.net | [0, 9] |
979,958 | 979,959 | Max amount of elements to append | <p>What I'm trying should be easy, but I don't seem to be able to figure it out (ore google the problem)</p>
<p>I have elements that I find, after finding them I want to append them to a container. But I don't want to many items so I want to be able to limit the amount of items to be appended.</p>
<p>For example:</p>
<pre><code><div class="appending">
</div>
<div class="toAppend">
<div class="box project">
<h3>Project Box</h3>
</div>
<div class="box project">
<h3>Project Box</h3>
</div>
<div class="box social">
<h3>Social Box</h3>
</div>
<div class="box video">
<h3>Video Box</h3>
</div>
<div class="box project">
<h3>Project Box</h3>
</div>
<div class="box social">
<h3>Social Box</h3>
</div>
</div>
</code></pre>
<p>Here are 3 items in div.toAppend that I would like to append to the div.appending</p>
<pre><code>var appenditems = $(".toAppend").find(".project");
appenditems.appendTo(".appending");
</code></pre>
<p>This is easy, but my problem is that I want to limit the amount of div.project that are appended , for example, only append the first 2 that I find. I'm unsure of any way to do this.</p>
| javascript jquery | [3, 5] |
3,053,234 | 3,053,235 | How to make a javascript redirect within a php if statement | <p>I am developing a personality test, and php result script now just echoes a personality description based on an if statement:</p>
<pre><code>if ($i = 5 AND $alpha[$i] >= 9 ) {
echo " Description ";
}
</code></pre>
<p>However, instead of this description, I would want to make a redirect to another url.
Can't seem to figure this one out.
Cheers,
Jelmar</p>
| php javascript | [2, 3] |
1,304,365 | 1,304,366 | Good resource for creating a portal in aspx from design perspective | <p>I want to learn how to create a portal using asp and C#. I have learned language features of C# and asp. I want to learn how one should design a portal (like banking).</p>
<p>Regards,</p>
<p>Sachin</p>
| c# asp.net | [0, 9] |
3,114,022 | 3,114,023 | Differentiate between admin and user login? | <p>I am designing a website, which has a login module.. here 3 users/persons (mainly) will be accessing the login page:</p>
<ol>
<li>Superadmin (domain owner)</li>
<li>Local admin (under domain owner)</li>
<li>Normal user (under local admin)</li>
</ol>
<p>Where domain owner has rights over local admin & normal user, and local admin has rights over normal user..</p>
<p>Now, how can I differentiate the login type for the above users?</p>
<p>I have tried putting a dropdown, and adding the three members, but I don't feel it looks good.</p>
<p>Any ideas of doing the above scenario?</p>
| c# asp.net | [0, 9] |
4,033,917 | 4,033,918 | How do I connect gridview to sql using C# in asp.net? | <p>I know how to connect, open, read, close as you see below. I also have awesome tutorial how to add update/delete etc. </p>
<p>I can connect dataTable to sql using asp.net controls, but I want to learn how to manipulate it from C#.</p>
<p>MasterCust is my gridview table name. How do I connect the to it?</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
SqlConnection Conn = new SqlConnection("Data Source=aserver;Initial Catalog=KennyCust;Persist Security Info=True;user id=sa;pwd=qwerty01");
SqlDataReader rdr = null;
string commandString = "SELECT * FROM MainDB";
try
{
Conn.Open();
SqlCommand Cmd = new SqlCommand(commandString, Conn);
rdr = Cmd.ExecuteReader();
while (rdr.Read())
{
Console.WriteLine(rdr[0]);
}
}
finally
{
if (rdr != null)
{
rdr.Close();
}
if (Conn != null)
{
Conn.Close();
}
}
//MasterCust.
//MasterCust.DataSource = commandString;
//MasterCust.DataBind();
}
</code></pre>
<p>Edit: This code worked</p>
<pre><code> try
{
Conn.Open();
SqlCommand Cmd = new SqlCommand(commandString, Conn);
SqlDataAdapter sdp = new SqlDataAdapter(Cmd);
DataSet ds = new DataSet();
sdp.Fill(ds);
//rdr = Cmd.ExecuteReader();
MasterCust.DataSource = ds.Tables[0];
MasterCust.DataBind();
}
</code></pre>
| c# asp.net | [0, 9] |
1,088,766 | 1,088,767 | popup based on the result of comparison | <p>The situation is that the user enters a value in the textbox.Now whenever user enters the value, the value is to be compared to a value(field) which has been retrieved form the database.If the value the user has entered is higher than that of the database then they should be displayed with a popup.How do i do that?The language which i am using is PHP.The popup should be automatic</p>
<p>Thanks in advance</p>
| php javascript | [2, 3] |
1,044,875 | 1,044,876 | DRY attribute selection | <p>Say I have an element on the page:</p>
<pre><code><div data-name='foo'>
</code></pre>
<p>What's the best way to get the attribute value? Is there anything more DRY than <code>$('[data-name]').attr('data-name')</code> or <code>$('[data-name]').data('name')</code>?</p>
| javascript jquery | [3, 5] |
777,506 | 777,507 | Working with a narrowed down DOM using jQuery | <p>I am currently trying to figure out a way to work within a selected <code><div></code> in order to be able to send a text formatted email. </p>
<p>So there is a button says "email". When a user clicks on it, it grabs a closest div as below.</p>
<pre><code>var selectedDiv = $(callingElement).closest(".myClassName");
</code></pre>
<p>And from there I would like to grab various dom elements to create a clean text format. So how do I work within selectedDiv using jQuery? </p>
<p>For example, </p>
<ol>
<li>Getting <code><h1></code> value.</li>
<li>Getting <code><li></code> value with certain class names</li>
<li>Getting "title" attribute value.</li>
</ol>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.