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,002,252
5,002,253
Android crashing on activity start
<p>Android crashes whenever this activity is started. here is the code.</p> <pre><code>import java.util.ArrayList; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.telephony.TelephonyManager; import android.view.KeyEvent; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class SettingsActivity extends Activity { EditText vname, vphone, vemail, vaddress; TextView textDeviceID; Button settings_submit; @Override public void onCreate(Bundle savedInstanceState) { setContentView(R.layout.settingmenu); vname = (EditText) findViewById(R.id.get_name); vphone = (EditText) findViewById(R.id.get_phone); vemail = (EditText) findViewById(R.id.get_email); vaddress = (EditText) findViewById(R.id.get_address); settings_submit = (Button) findViewById(R.id.settings_submit); settings_submit.setOnClickListener(settings_submitOnClickListener); TextView textDeviceID = (TextView) findViewById(R.id.deviceid); super.onCreate(savedInstanceState); TelephonyManager telephonyManager = (TelephonyManager) getSystemService( </code></pre>
java android
[1, 4]
5,444,730
5,444,731
Checking something isEmpty in Javascript?
<p>How can I check if a variable is empty in Javascript? Sorry for the stupid question, but I'm a newbie in Javascript!</p> <pre><code>if(response.photo) is empty { do something else { do something else } </code></pre> <p><code>response.photo</code> was from JSON, and it could be empty sometimes, empty data cells! I want to check if it's empty.</p>
javascript jquery
[3, 5]
2,594,016
2,594,017
Set Page Variable With JS/JQuery
<p>I have an html page that is basically a wrapper. I have tabs on the page, that when clicked uses the JQuery.load function to load a particular page in a subdirectory. This allows me to change content to suit a partticular page view without having to refresh the page or set session variables. However, if I <em>do</em> refresh the page, I'm back to viewing the wrapper's default content. </p> <p>How can I set a variable using JQuery that will allow me to check if that variable is set, and if so, immediately load page when the window refreshes? I think I managed to find a way to do this via PHP by calling an additional AJAX call that sets a PHP session when a tab is clicked, but I am trying to get away from that.</p> <p>TIA.</p>
javascript jquery
[3, 5]
4,962,072
4,962,073
Jquery - techniques for extending 'perimeter' for mouseout?
<p>I would like to implement behaviour such that a mouseover/hover event is triggered when the mouse pointer hovers over a certain div, but such that the mouseout event tiggers not when the pointer leaves the div, but when it leaves the area 10px ourside the div.</p> <p>Is there any way of achieving this that doesn't involve creating a larger parent div to bind the mouseout event to?</p>
javascript jquery
[3, 5]
1,259,755
1,259,756
Better Way to Remove Elements from a List?
<p>I'm going to have a unordered list (<code>&lt;UL&gt;</code>) of items. Each item will have a delete button, which will make an ajax call &amp; then remove the item from the list. I have all the info I need to make the Ajax call, but I'm wondering the best way to let the user remove any item in the list.</p> <p>My first thought is to dynamically assign each <code>&lt;LI&gt;</code> a unique class identifier &amp; then use jquery's <code>remove()</code> on each element, but is there a better way? I have a feeling my approach is somewhat ham-fisted.</p>
javascript jquery
[3, 5]
5,481,598
5,481,599
Prevent scrolling to top using .load()
<p>I'm trying to prevent the scrolling to the top when using jQuery's .load function. I've read at SO that you can use <code>event.preventDefault(); event.stopPropagation();</code>. <a href="http://stackoverflow.com/questions/7537777/prevent-scrolling-to-top-when-using-jquery-load">Here</a> is the link to this question. But when using beginform, you don't have an event here. </p> <p>I also tried to put a click event on the submit button, but this also didn't work. </p> <p>Thanks in advance! </p> <p>This is the code of the view. When success the function closeFancyReservationCancel is called. </p> <pre><code>@using ( Ajax.BeginForm("Cancel", "Reservation", new AjaxOptions { HttpMethod = "POST", OnSuccess = "closeFancyReservationCancel"}, new { id = "cancelForm" })) { ... } ) </code></pre> <p>And this is the jQuery function</p> <pre><code>function closeFancyReservationCancel() { $.fancybox.close(); $('#reservationList').load(ResolveUrl('~/Reservation/reservationList')); } function ResolveUrl(url) { if (url.indexOf("~/") == 0) { url = baseUrl + url.substring(2); } return url; } </code></pre> <p>Here a part of my HTML:</p> <pre><code>&lt;div id="reservationList" class="tblContainer"&gt; @Html.Action("reservationList", "Reservation") &lt;/div&gt; </code></pre> <p>The action reservationList returns a view with the table. Only the body of the table has an <code>overflow: auto;</code>.</p> <p><strong>EDIT: added more information</strong></p> <p>I have a div with a list of my reservations table. I am using MVC3 to show that list. When press the cancel button, the div will reload by the .load function.</p> <p><strong>EDIT</strong></p> <p>Here my HTML view with the table: <a href="http://pastebin.com/VnzLnUj3" rel="nofollow">Pastebin</a></p>
c# jquery
[0, 5]
4,144,537
4,144,538
What's a good Javascript tutorial library?
<p>I'm looking for something that will allow me to walk a new user through a a web app one step at a time with different hints on what to click and look at. Does something like this exist?</p>
javascript jquery
[3, 5]
5,162,894
5,162,895
Arraylist in arraylist
<p>I wonder how I create arraylists dynamically and add them to an arraylist that holds all arraylists? I also wonder how I read from a dynamically created arraylist inside the main arraylist in a for-each loop?</p>
java android
[1, 4]
494,343
494,344
How to Stop Browser from Closing Using ASP.NET or Else?
<p>i got a web page and when browser fire Closing Event i wanna stop it ? How can i do that in asp.net or anyother alternative?</p>
c# asp.net javascript
[0, 9, 3]
2,251,246
2,251,247
Where can I find a plugin that will zoom in and out a div's content with a slider?
<p>Are there any plugins that allows zooming in and out a div and it's content via a slider?</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,945,692
5,945,693
Map structure in Android and dynamic memory allocation
<p>Not so recently I've published a game that is written entirely in Java on Android platform. Currently I'm trying to get as much of the performance as possible. It seems that the problem in my game's case is that I'm using more too often <code>ArrayList</code> container in places where <code>Map</code> could be better suited. To explain myself I did it because I was afraid of dynamic memory allocations that would be triggered behind the scene (<code>Map</code>/<code>Tree</code> structures on Android). Maybe there is some sort of structure on Android/Java platform I don't know about, which will provide me with fast searching results and additionally will not allocate dynamically extra memory when adding new elements?</p> <p>UPDATE: For example I'm using an ArrayList structure for holding most of my game's Particles. Of course removing them independently (not sequentially) is a pain in the b**t as the system needs to iterate through the whole container just to remove one entity object (of course in the worst case scenario).</p>
java android
[1, 4]
1,755,185
1,755,186
Passing PHP variables to jQuery integer
<p>basically I know more or less how to do it but would like to know if there is any better way?</p> <p>I have the following variables in PHP</p> <pre><code>$day; $month; $year; </code></pre> <p>The ones above have values from exploding a php date string.</p> <p>Below is PHP plugin function which states the date for countdown.</p> <pre><code>&lt;script type="text/javascript"&gt; $(function () { var austDay = new Date(); austDay = new Date(2013, 12, 22); $('#defaultCountdown').countdown({until: austDay}); }); &lt;/script&gt; </code></pre> <p>I would like to pass the date day/month/year variables into that function from PHP how can I do it, when I tried to attach to the javavariable and put that variable in place of the date part, it didnt work.</p> <p>Thanks for all help</p>
php javascript jquery
[2, 3, 5]
907,478
907,479
Constraint - Derived Class must have a default Constructor
<p>I want to Constraint that the Derived Class must have a Default Constructor. I am currently thinking it in a perverted way</p> <pre><code>template &lt;typename Derived&gt; class Base{ public: Base(){ } virtual ~Base(){ new Derived; } }; </code></pre> <p>Another idea comes to mind is to keep a pure virtual create() method with no arguments.</p> <p>But is there any other way ? Other than these two. I am thinking it in C++ way. But Is there any way to do this in PHP (I expect negetive answer LOL)</p>
php c++
[2, 6]
3,472,159
3,472,160
change content of a cell in table usnig javascript
<pre><code>&lt;html&gt;&lt;head&gt; &lt;script type="text/javascript"&gt; function addFunction(id) { cnt=parseInt(id.substr(7)); var row=document.getElementById('driverDetails').insertRow(cnt+1); var c1=row.insertCell(-1); var c2=row.insertCell(-1); var c3=row.insertCell(-1); c1.innerHTML="row"+(cnt+1)+"colum1"; c2.innerHTML="row"+(cnt+1)+"colum2"; c3.innerHTML='&lt;input type="button" id="addNew_'+(cnt+1)+'" name="addNew_'+(cnt+1)+'" value="Add New" onclick="addFunction(this.id)"/&gt;'; } &lt;/script&gt; &lt;/head&gt;&lt;body&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;row1 colum1&lt;/td&gt; &lt;td&gt;row1 colum2&lt;/td&gt; &lt;td&gt;&lt;input type="button" id="addNew_1" name="addNew_1" value="Add New" onclick="addFunction(this.id)"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>when i click <strong>Add New</strong> button <strong>can we change the content of 3rd cell of previous row</strong></p>
php javascript
[2, 3]
570,266
570,267
add dynamically tab panel and add the image button or button on the dynamically added tab and show like the internet explore tab
<p>I want to add a tab dynamically and also add a button or image button in the added tab. But when i add a but on the added tab the button show below the tab header text. I want that The header text of dynamic added tab and button show in single line i.e align horizontal. The code is given below. Please suggest me.</p> <pre><code>UserControl uscont = (UserControl)this.LoadControl("JQGrid.ascx"); TabPanel t = new TabPanel(); Button btnclose2 = new Button(); btnclose2.Text = "Xjkjlk"; btnclose2.ID = "btn" + id; btnclose2.Click += new EventHandler(btnclose_Click); btnclose2.CausesValidation = false; PlaceHolder ph = new PlaceHolder(); t.Controls.Add(ph); ph.Controls.Add(btnclose2); ph.Controls.Add(uscont); t.HeaderText = mybtn.Text; newTabCon.BorderStyle = BorderStyle.Solid; newTabCon.Tabs.Add(t); </code></pre>
c# asp.net
[0, 9]
1,590,556
1,590,557
Adding support for settings screen android
<p>I'am using several CheckBoxPreference in my android app to add a settings menu. But is there a way to say that one and only one CheckBoxPreference <strong>MUST</strong> be checked at the time? </p>
java android
[1, 4]
1,022,274
1,022,275
Stop/break an SaxXMLparsing
<p>Im making an app that fetches some XML using SAXparser. Im parsing the xml and if the xml does not have a specific node I have to start over the SAXparser with a different URL. </p> <p>This means that when I'm in my XML handler inside startElement I have to break/stop it and do it again. How can I do this break/stop/exit?</p> <p>Here are some fake code to explain:</p> <pre><code>private String browsLevel(String url) { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); XMLReader xr = sp.getXMLReader(); URL sourceUrl = new URL(url); MyXMLHandler myXMLHandler = new MyXMLHandler(); xr.setContentHandler(myXMLHandler); xr.parse(new InputSource(sourceUrl.openStream())); } //external class in a separate document public class MyXMLHandler extends DefaultHandler { @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // Im checking here if a special node exsists and if not I need to break/stop this and go to the Restart point above. //I need to do something like this: if (!localName.equals("mysspecialnode")) { MyXMLHandler.break(); //???? browsLevel("a different url"); } </code></pre>
java android
[1, 4]
1,908,302
1,908,303
Why selector ":button" doesn't work with click event?
<p>Hi I'm using the Jquery selector ":button" but doesn't work combine with click event....</p> <pre><code>$(":button").click(function () { alert("click"); return false; }); </code></pre>
javascript jquery
[3, 5]
805,358
805,359
Dropdownlist not showing previous value
<p>I have an asp.net dropdownlist control with autopostback false. I have written js code to display confirm message while dropdown value changed.</p> <pre><code>function ConfirmAbsent(ddlPresence) { if (ddlPresence != null) { var myValue = ddlPresence.options[ddlPresence.selectedIndex].text; var blnAbsent = confirm("This will mark as "+ myValue +". Please confirm clicking OK."); if (blnAbsent) { return true; } else { return false; } } } </code></pre> <p>And add this attribute to dropdownlist like below</p> <pre><code>ddlUserPresence.Attributes.Add("onchange", "if (!ConfirmAbsent(" + ddlUserPresence.ClientID + ")) return; else __doPostBack('" + ddlUserPresence.UniqueID + "', '');"); </code></pre> <p>When i click on ok button it postback the page working correctly, but when i click on cancel button it is not showing me the previous value instead showing the current value.</p> <p>So when i click on cancel button it should show me the previous value.Please help.</p>
javascript asp.net
[3, 9]
2,584,599
2,584,600
jquery how to wrap every fifth element
<p>i know i can do that in the hard way by using for loop or something like that but i'm asking </p> <p>if : there is any simple way to wrap every 5 images in a long list of images</p> <p>Thanks</p>
javascript jquery
[3, 5]
812,766
812,767
adding css to custom reusable function
<p>i created a function in jQuery which lets me create a lightbox as following:</p> <pre><code>var lightbox = create_lightbox(params); </code></pre> <p>I would like to expand this function so i can add custom css to it and make it look like a feel in any given circumstance. I would prefer to be able to do the folowing:</p> <pre><code> lightbox.css = { "background-color" : "red", etc... } </code></pre> <p>What would be the best way to do this and how would i iterate over the css elements inside my function?</p> <p>tyvm </p>
javascript jquery
[3, 5]
2,581,157
2,581,158
jQuery submit with $_Get parameter not working
<p>Hi I have a form here:</p> <pre><code>&lt;form method="post" name="work_form" action="&lt;?php echo $link; ?&gt;" </code></pre> <p>All is working OK and I have a separate jQuery that will also do the same submission and I have been reading on SOF and seems I can do something like this:</p> <pre><code>var action="activity.php?view&amp;pid=1044&amp;hash=bab54ffd80cc30083ffee373141a4926"; //same as php $link value// $("form:work_form").attr('action', action).submit(); </code></pre> <p>Which is suppose to simulate the submit. I have a issue here, when I do a normal submit from the usual</p> <pre><code>&lt;input type="submit" name="submit" value="Submit" class="submit" /&gt; </code></pre> <p>It is ok but if I trigger it from the jQuery, I only get this</p> <pre><code>http://www.myurl.com//activity.php? </code></pre> <p>The $_Get prefix is not pass.</p>
javascript jquery
[3, 5]
4,532,329
4,532,330
need Help on storing data
<p>Im my application i have one page which shows lots of records in gridview and i also have one dropdown(html control ) in that page. User can select one or more records from gridview and need to select anyone option from dropdow.After that user need to click submit button(Html button not a server control). Based upon the avlue selected in dropdown i need to redirect into diffentpages(.aspx ) this i know how to do.But i need to store the records in xml file before redirecting to different page.I am prepfer to write storing code in one place instead of wrting in all pages.How to do implement give me a suggestion. </p>
c# asp.net
[0, 9]
351,270
351,271
Android record exists() in database?
<p>I am looking to the fastest and the correct way to check if a record exists in the database:</p> <pre><code>public boolean Exists(String _id) { Cursor c=db.query(TABLENAME(), new String[] {"1"}, "_ID="+_id, null, null, null, null); if (!c.equals(null)) return c.moveToFirst(); return false; } </code></pre> <p>Do you see any problem with it?</p>
java android
[1, 4]
5,107,394
5,107,395
Create a cookie accessible to a domain A from a popup in a domain B
<p>The functionality im trying to create is similar to how <em>facebook connect</em> works, in a domain A when a button is pressed a popup fires up, showing content from a domain B, on this popup if the user login a cookie is created and then the popup is closed, but since this cookie was created in the domain B i cant access that information from A. How facebook solve this? Im a javascript and PHP developer so if you provide me with a code example it will be very appreciated. </p>
php javascript
[2, 3]
2,448,376
2,448,377
How to maintain JavaScript performance while making an Ajax request at mousemove event?
<pre><code>$( document ).bind( 'mousemove', function ( e ) { if ( e.pageY &gt; $( document ).height() - 400 ) { $.ajax( { url: '/Tweet/GetFiveUserTweets', type: 'POST', async: false, // preventing a lot of asynchronous requests success: function ( result ) { // result } } ); } } ); </code></pre> <p>‘async:false’ hangs the browser until request completes and that’s not good.</p> <p>and when remove '<code>async:false'</code>, dozen of simultaneous request made because <strong>mousemove</strong> event....</p> <p>I don’t want to hang the browser. </p> <p>I just want a single asynchronous Ajax request at a time.</p> <p>Can anyone let me know how to do a better coding for this situation?</p> <p>Edit:</p> <p>Actually when user scroll down at bottom, I want to get five next records and append them at bottom. www.twitter.com do this with tweets....</p> <p>what's about:</p> <pre><code>$(window).bind('scroll', function () { if (nearBottomOfPage()) { // load things here ... } }); </code></pre> <p>I think it's better than mousemove...am I right?</p>
javascript jquery
[3, 5]
5,228,214
5,228,215
single quote to double quote , and , double quote to single quote in javascript
<p>I want to change </p> <p>every single quote to double quote and every double quote to single quote </p> <p>in jquery or js.</p> <pre><code>var myString = " tes't tes\"t tes\"t te'st "; console.log(myString); for (i = 0; i &lt; myString.length; i++) { console.log(myString[i]); if (myString[i] == "'") { myString[i] == "\""; continue; } if (myString[i] == "\"") { myString[i] == "'"; continue; } } console.log(myString); </code></pre> <p>But my function is not working well. Please correct me.</p>
javascript jquery
[3, 5]
3,136,766
3,136,767
Session Timeout Add to QueryString
<p>I have an web app in C# and after 20 mins the session times out. I can't change this because other apps use the same config.</p> <p>So I am checking to see if the Session is NULL and if it is. It redirect and adds a QueryString with the Session ID. The problem I am having is when the Session times out the SessionID because NULL. Is there anyway to still get the sessionid after the timeout?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
3,460,510
3,460,511
Javascript function not found
<p>I am having a problem with the jCal plugin. I have no javascript errors when the page is loaded locally however when the page is loaded online the jCal function can not be found. I think the jCal function is called before jCal/jCal.js file is executed. <a href="http://aidnetgc.com/test/volunteer.html" rel="nofollow">http://aidnetgc.com/test/volunteer.html</a></p>
javascript jquery
[3, 5]
5,480,606
5,480,607
sql asp.net send email c#
<p>if you could please help me out... i am try to create o forgot password method.access my database and send an e-mail. if you please help me out since i don't have a lot of experience. thanking you in advance. Login is unique. C# </p> <pre><code>protected void LinkButton1_Click(object sender, EventArgs e) { var sqlCon = new SqlConnection(System.Configuration.ConfigurationManager. ConnectionStrings["ConnectionString"].ConnectionString); SqlCommand cmd = new SqlCommand(); cmd.Connection = sqlCon; cmd.CommandText = "select Password from Person where Login= @Login "; cmd.Connection.Open(); string Password = cmd.ExecuteScalar().ToString(); cmd.Connection.Close(); cmd.Dispose(); SqlCommand cmd1 = new SqlCommand(); cmd1.Connection = sqlCon; cmd1.CommandText = "select e_mail from Person where Login= @Login "; cmd1.Connection.Open(); string e_mail = cmd.ExecuteScalar().ToString(); cmd.Connection.Close(); cmd.Dispose(); if (Login.Text.Equals("@Login")) { Class1 S = new Class1(); S.sendMail(e_mail, "Your Password request", Password); Response.Write("&lt;script&gt;"); } } </code></pre>
c# asp.net
[0, 9]
2,854,674
2,854,675
LinqDataSource Syntax
<p>I have quite a complex LinqDataSource that I'm trying to setup. I've been able to write part of the Linq for it but am unsure how to convert this to LINQDataSource syntax or whether it is even possible. It looks like this.</p> <pre><code>ConfigDetails.Where (cd =&gt; AuthProductOwners .Where (o =&gt; (o.LoginID == @LoginID )) .Select (o =&gt; o.AuthProductOwnerGroups).Contains(cd.AuthProductOwnerGroups)) </code></pre> <p>The table structure is a AuthProductOwnerGroup can have many ConfigDetails and also many AuthProductOwners.</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,518,216
1,518,217
How to implode JavaScript into PHP's return function?
<p>I have a PHP function:</p> <pre><code>function output_errors($errors) { return '&lt;ul&gt;&lt;li&gt;' . implode('&lt;/li&gt;&lt;li&gt;', $errors) . '&lt;/li&gt;&lt;/ul&gt;'; } </code></pre> <p>But instead of <code>&lt;ul&gt;</code> and <code>&lt;li&gt;</code>s I wish to use jQuery to show errors:</p> <pre><code>$(function() { $.pnotify({ title: 'Update Successful!', text: '&lt;p&gt;Error text here!&lt;/p&gt;', }); }); </code></pre> <p>I tried a lot of combinations but it doesn't work.</p>
php javascript
[2, 3]
3,635,505
3,635,506
how can we increase or decrese the size of div on btn click in asp.net?
<p>how can we increase or decrese the size of div on btn click in asp.net?</p> <pre><code> //stylesheet &lt;style&gt;div { width:50px; height:70px; float:left; margin:5px; background:rgb(255,140,0); } &lt;/style&gt; &lt;script src="http://code.jquery.com/jquery-latest.js"&gt;&lt;/script&gt; //div content &lt;body&gt; &lt;div&gt;&lt;/div&gt; &lt;/body&gt; //script which m using for clicking &lt;script&gt;$("div").one('click', function () { $(this).height(30); });&lt;/script&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
3,738,738
3,738,739
Interacting with jQuery plugin objects after their creation
<p>I have a ticker which items are updated using polling. I have written a simple jQuery plugin for the ticker which is invoked like so:</p> <pre><code>$("#cont ul").ticker(); </code></pre> <p>Which turns a ul into a ticker, scrolling through the li. To add new items I have to add lis to the ul, which works fine. However, the OO in me wishes I could have an addItem function on a ticker object. However, I don't want to lose the chainability that jQuery uses.</p> <p>Is there some method which is more obvious than adding ul's to the list but that fit's with the jQuery way of doing things?</p>
javascript jquery
[3, 5]
5,410,069
5,410,070
Is there a way to play the role of Javascript with any other language like C#?
<p>Is there a way to play the role of Javascript with any other language like C#? One way came up in my head is, having silverlight installed, using C# instead of Javascript for all the client side scripting (Though C# is not a scripting language). Is it possible?</p> <p>I am not talking about something like GWT(Java) or Script#(C#). Probably the question can be stated as- "With silverlight installed, can I do everything supported by Javascript(like DOM manipulation etc) with C#?" Hope it's clearer.</p>
c# javascript
[0, 3]
4,577,325
4,577,326
Creating a loop that fades out each article in succession. jQuery
<p>So the idea is to fade each image out from the bottom.. obviously it's going to have to backwardly traverse the array. However, i can't seem to figure it out at the moment. The idea is that it would pause after running the fadeOut() function, I thought set time out would work, but firebug gives me this error: useless setTimeout call (missing quotes around argument?)</p> <p>Line 262. I even went as far as to not use a $.each loop and use a for (i=0 loop</p> <pre><code>&lt;script type="text/javascript"&gt; //Bottom Nav functions $(document).ready(function(){ $('#bottomNav a:eq(0)').click(function(){ var arti = $('#aHolder article'); var amt = arti.length; var i = 0; for (i=0;i&lt;amt;i++){ $('#aHolder article:eq('+i+')').fadeOut(); setTimeout(300); } }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,890,345
4,890,346
Error not being displayed with updatepanel
<p>It appears like something is stopping my errors from displaying normally an in ASP.NET site.</p> <p>Scenario 1 - I have an admin screen that has most of its content inside an updatepanel. When the user's session times out. You click a button and nothing happens. It doesn't redirect you to the home page and it doesn't give you an error message.</p> <p>Scenario 2 - I have some sort of data issue throwing an error - its happening on the staging environment otherwise I'd just debug the code normally. But instead of showing me the error you get the javascript type exclamation mark down the bottom and you need to quickly click on it to bring up a pop up dialog. In IE this happens. In FF there is no error message at all being shown.</p> <p>My error in this instance is Sys.WebForms.PageRequestManagerServerErrorException: Sequence contains no elements. It then refers to a ScriptResource.axd... so based on this error message I'm having trouble working out what the problem is as I can't reproduce this on my dev environment. I believe its usually related to a linq statement referencing something with no elements but am not sure where the error is occurring or why. But am also wondering why this error appears to be being caught and not displayed look good old fashioned exceptions :) </p> <p>So not sure if its an updatepanel issue or a scriptmanager related quirk. I imagine I'm using the wrong keywords to google as I can't find anyone else really complaining about the same thing :( </p> <p>Thanks for any help!</p>
c# asp.net
[0, 9]
2,408,894
2,408,895
String variable out of context for use in HTML output
<p>I'm trying to understand why the variable <code>myUrl</code> is out of context in the example below. What's the best way to handle this situation? Are there alternatives? The code is C# in an ASP.NET page.</p> <pre><code>&lt;% string myUrl = "http://www.website.com"; %&gt; &lt;ul class="footerLinks"&gt; &lt;li&gt;&lt;a href="&lt;%= myUrl %&gt;/index.html"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
c# asp.net
[0, 9]
2,506,045
2,506,046
Downloading a file from server and save it in client
<p>I am currently developing an ASP.net application, where I generate a word document in server and I want to save it in client machine who access that feature with out user interactions. How can I download it and save it in client machine, using Javascript?</p>
c# javascript asp.net
[0, 3, 9]
3,982,598
3,982,599
Change hyperlinks dynamically using jquery
<p>I want to change the param of link dynamically.</p> <p>For e.g. </p> <ol> <li>Link1</li> <li>Link2</li> <li>Link3</li> </ol> <p>by default their url is ?item=text i.e. for link1(href="?item=link1") etc.. but when i click link1 the url of link2 and link3 should be link2(?item=link2&amp;item=link1) link3(?item=link3&amp;item=link1)</p> <p>any idea how to acheive this?</p> <p>Thanks, </p>
javascript jquery
[3, 5]
1,700,475
1,700,476
Problem with blur and click event?
<p>I have a web application with asp.net and at code behind with Jquery.</p> <p>In that there are text boxes and a grid. There is written blur event in jquery page for the text boxes and row click event for the row in table. </p> <p>When click the row then as per row value its details will displays in text boxes. My problem is that when I update the text box value (also that present in grid row) then goes in next text box then every thing will goes fine, blur event fires and data saved and will refresh if click on the grid row. But when i update something in text box and without pressing tab directly click on the grid row then blur event not fired and data not been saved directly click event fired and error comes when grid event calls. Also if I place debug point at the blur event and click event then the control comes in blur event, data will be saved but without firing row click event at that time. </p> <p>What the problem occuring? ow to solves the problem? Any Idea.</p> <p>Thanks in advance.</p>
jquery asp.net
[5, 9]
263,371
263,372
Multiple .live() bound to element
<p>I have a nice tooltip script. Scrip puts element's title attribute into tooltip div. Tooltip follows mouse arrow via mousemove, removes div after mouseout and puts element's title back. It works perfect on static pages, but i have some troubles with ajax. </p> <p><a href="http://jsfiddle.net/b5LRK/3/" rel="nofollow">http://jsfiddle.net/b5LRK/3/</a></p> <p>And i'm tryin to apply .live() to this script. Something like this:</p> <pre><code>$('[title]').live({ mouseover: function(e) { var tip = $(this).attr('title'); $(this).removeAttr('title'); $('body').append('&lt;div id="tooltip"&gt;' + tip + '&lt;div class="tipArrow"&gt;&lt;/div&gt;&lt;/div&gt;'); $('#tooltip').css('top', e.pageY + 25); $('#tooltip').css('left', e.pageX - 15); }, mousemove: function(e) { $('#tooltip').css('top', e.pageY + 25); $('#tooltip').css('left', e.pageX - 15); }, mouseout: function() { $(this).attr('title', $('#tooltip').text()); $('body').children('div#tooltip').remove(); }}); </code></pre> <p>And it's not working! What's the problem?</p>
javascript jquery
[3, 5]
4,425,817
4,425,818
Stop click from working on inner elements
<p>I have a div that covers the screen. Within the div is another div and within that, an image get dynamically placed. When the user clicks on the outer div it closes, and that is fine. When the user clicks on the image or the inner div it closes as well, how can I stop that from happening? I only want it to close if they click on the outer div.</p> <p>This is what I am using; what do I need to do to make this work?</p> <pre><code>$("#black-out").click(function(){ $(this).fadeOut("slow"); }); </code></pre> <p>The HTML:</p> <pre><code>&lt;div id="black-out"&gt;&lt;div id="image-holder"&gt;&lt;/div&gt;&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,328,054
5,328,055
How to open pop up with tool bar
<p>i need to open a page with same window.</p> <p>i used code like</p> <pre><code>window.open('NZFReferenceSelector.aspx?RefId= ' + refID, '_self', parameters, false); </code></pre> <p>the page is open with in same page.</p> <p>but it does not show the tool bar?</p> <p>iam using vs 2010 and javascript need help Thanks ,</p> <p>pooja</p>
javascript asp.net
[3, 9]
3,906,621
3,906,622
combining js scripts from a js newb
<p>I've got a small .js file on my wp site where I have been adding in all of my small js scripts. It works perfectly, but I am stuck trying to figure out how to add in another script. So far jslint does not complain about my current file and says it is ok.</p> <p>my script:</p> <pre><code>jQuery(function ($) { function mycarousel_initCallback(carousel) { jQuery('.jcarousel-control a').bind('click', function() { carousel.scroll(jQuery.jcarousel.intval(jQuery(this).text())); return false; }); jQuery('.jcarousel-scroll select').bind('change', function() { carousel.options.scroll = jQuery.jcarousel.intval(this.options[this.selectedIndex].value); return false; }); // Next Button $('#mycarousel-next').bind('click', function() { carousel.next(); return false; }); // Prev Button $('#mycarousel-prev').bind('click', function() { carousel.prev(); return false; }); }; } </code></pre> <p>The script I want to add in starts like this:</p> <pre><code>jQuery(document).ready(function($) { var gallery = $('#thumbs').galleriffic({ delay: 3000, // in milliseconds }); }); </code></pre> <p>Where I keep getting stuck, is that I am finding a lot of scripts that start with the jQuery(document) part. When I try to add scripts that begin like that then everything breaks.</p> <p>I'm guessing this is a really stupid question, but what do I need to change in the new addon script so that it will play nice with my current file?</p> <p>thank you for your help and time on this one. Trying hard to learn js though it's a slow process here.</p>
jquery javascript
[5, 3]
2,506,014
2,506,015
how to avoid looking css property using jquery or javascript
<p>There is some content in html page and one of div style for that is like below:</p> <pre><code>.class1{ property1:value1; property2:value2; property3:value3; property4:value4; } </code></pre> <p>I want to avoid applying css property property1 into concerned content and rest property property2, property3, property4 are welcomed.</p> <p>I want to avoid applying property1 and don't want to change the css file.</p> <p>Also I don't want to use as below:</p> <pre><code>$('.class1').css('property1','some different value'); </code></pre> <p>I just want to avoid property1 using code. Please tell me how I done using jquery or js. ----------------------Edited------------------------</p> <p>I don't want to generate any inline css on run time. I am looking ui code some thing like as below:</p> <pre><code> $('.ui-resizable').css('position').disable() </code></pre>
javascript jquery
[3, 5]
4,680,375
4,680,376
How to get if a zip code is in australia or not in android?
<p>In my new project I am providing user an edittext where he has to put a zip code, i have to check if this provided zip code is valid for Australia or Not. I am getting so much suggesions, but I need the easiest and simplest one. Moreover it would be the best If I could find a webservice from where I could check this.</p>
java android
[1, 4]
3,596,160
3,596,161
Why this code doesn't work (and how to repair it)?
<p>This question is a consequence of <a href="http://stackoverflow.com/questions/15871307/ultimate-solution-to-defer-javascript-and-jquery-after-page-is-loaded">another question of mine</a>.</p> <p>The code is:</p> <pre><code>&lt;script type='text/javascript'&gt; var scripts = [ "http://www.---.com/include/jquery-1.8.3.min.js", "http://www.---.com/include/functions.js", "http://www.---.com/include/myjs.js", "http://www.---.com/include/plugins/bxslider/bxslider.js" ]; function downloadJSAtOnload() { for( var i=0; i&lt;scripts.length; i++ ) { var element = document.createElement('script'); element.src = scripts[i]; document.body.appendChild(element); } $(document).ready(function(){ $('#mainslide .bxslider').bxSlider({ slideWidth: '960', mode: 'vertical', speed: '500', captions: false, pager: false, controls: false, nextText: 'Next', prevText: 'Prev', auto: true, autoHover: true, pause: 3000 }); }); } if (window.addEventListener) window.addEventListener('load', downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent('onload', downloadJSAtOnload); else window.onload = downloadJSAtOnload; &lt;/script&gt; </code></pre> <p>The error generated is <strong>"Uncaught ReferenceError: $ is not defined "</strong>.</p> <p>The strange is that everything works perfectly (slideshow, lightbox, ...) in lots of browsers and verions. Just in IE8 and Safari 4 an alert is showed to the user.</p>
javascript jquery
[3, 5]
5,926,989
5,926,990
jquery fetch images from url and provide as zip file
<p>I have the URLs of a list of images. Now on click of a link, ineed to to zip the images in all those URL's and provide it as a downloadable file. What i have currently done is,</p> <ol> <li>Pass the URLs to django views</li> <li>Fetch the images and store it to filesystem</li> <li>Zip them and</li> <li>Return a download dialog as response</li> </ol> <p>Now, i am thinking of doing everything at the client side itself.I came across the JS plugin <a href="http://gildas-lormeau.github.com/zip.js/demos/demo1.html" rel="nofollow">Zip.js</a> that can zip files. My only problem is how to fetch those images from the URL's and zip them in memory using JS.Any help is appreciated.I also came across other plugins to zip files,</p> <p><a href="http://www.jquery4u.com/javascript/javascriptjquery-zipfilecompressor-plugins/#.UE8cI2AxznA" rel="nofollow">http://www.jquery4u.com/javascript/javascriptjquery-zipfilecompressor-plugins/#.UE8cI2AxznA</a></p> <p><a href="https://raw.github.com/Stuk/jszip/master/jszip.js" rel="nofollow">https://raw.github.com/Stuk/jszip/master/jszip.js</a></p>
javascript jquery
[3, 5]
4,205,854
4,205,855
Can I add a javascript alert inside a PHP function? If yes, how?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1045845/how-to-call-a-javascript-function-from-php">How to call a JavaScript function from PHP? </a> </p> </blockquote> <p>Can I add a javascript alert inside a PHP function? If yes, how?</p>
php javascript
[2, 3]
5,430,586
5,430,587
Using PHP inside Javascript? To shrink URL
<p>I made a bitly url shrinker, and I currently have a Soundcloud Javascript API that outputs a url link of a song. Im trying to shrink it using my shrinker. The shrinker works using this:</p> <pre><code>&lt;?php echo $bitly-&gt;shorten('http://google.com'); ?&gt; //Equals google.com in short url format </code></pre> <p>The javascript code I'm trying to implement it in is this: Ill go ahead and give you what I tried to do already, that didn't work. </p> <p>Before I edited:</p> <pre><code> container.find('span.player-actions').html( '&lt;a href="' + track.user.permalink_url + '" target="_blank"&gt;Soundcloud&lt;/a&gt; | &lt;a href="' + track.permalink_url + '/download" target="_blank"&gt;Download&lt;/a&gt;' ); </code></pre> <p>After I tried:</p> <pre><code>container.find('span.player-actions').html( '&lt;a href="' + &lt;?php echo $bitly-&gt;shorten('track.user.permalink_url'); ?&gt; + '" target="_blank"&gt;Soundcloud&lt;/a&gt; | &lt;a href="' + track.permalink_url + '/download" target="_blank"&gt;Download&lt;/a&gt;' ); </code></pre> <p>Any suggestions, I'm open to anything. And would love to make this work! Thanks in advanced</p>
php javascript
[2, 3]
5,147,836
5,147,837
PHP equivalent to JavaScript's string split method
<p>I'm working with this on JavaScript:</p> <pre><code>&lt;script type="text/javascript"&gt; var sURL = "http://itunes.apple.com/us/app/accenture-application-for/id415321306?uo=2&amp;mt=8&amp;uo=2"; splitURL = sURL.split('/'); var appID = splitURL[splitURL.length - 1].match(/[0-9]*[0-9]/)[0]; document.write('&lt;br /&gt;&lt;strong&gt;Link Lookup:&lt;/strong&gt; &lt;a href="http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsLookup?id=' + appID + '&amp;country=es" &gt;Lookup&lt;/a&gt;&lt;br /&gt;'); &lt;/script&gt; </code></pre> <p>This script takes the numeric ID and gives me 415321306.</p> <p>So my question is how can I do the same thing but using PHP.</p> <p>Best regards.</p>
php javascript
[2, 3]
383,561
383,562
How to make this code work in jQuery 1.4.x?
<p>The on() method isn't supported in jQuery 1.4.x. Can someone tell me how to fix this so it's compatible?</p> <pre><code>$(document).on({ mouseenter: MyObj.mouseenter, mouseleave: MyObj.mouseleave }, '.class'); </code></pre>
javascript jquery
[3, 5]
5,876,333
5,876,334
Is there a way to __doPostBack to another page using javascript?
<p>I'm writing a suite of admin tools to sit on top of our existing site that will allow a user to quickly administer a number of pages from one convenient jquery ui window.</p> <p>The issue I'm running into is that a lot of the functionality requires <strong>postbacks on specific pages</strong>, while this admin overlay can be accessed from any page. This means that in order for the functionality to work, the postback has to be sent to the correct page (or the page has to be loaded before the postback is triggered).</p> <p>I've looked at <a href="http://stackoverflow.com/questions/863550/causing-a-postback-to-a-different-page-from-a-popup">Causing a PostBack to a different page from a PopUp</a> and several c# posts, but they do not appear to address the specific issue of moving to another page prior to firing the postback using javascript. </p> <p><strong>Possible Solution:</strong> one solution I considered is using cookies transmit information about which postback events need to fire and what parameters to use while using javascript to load the correct page. It's not a great solution, so I was wondering if anyone here could think of a better one.</p>
javascript jquery
[3, 5]
4,701,080
4,701,081
Bundle becomes null when passed to a sub activity
<p>I'm using the standard Android Intent/Bundle method to pass data to a sub activity.</p> <p>The problem is that although the Intent looks good before the activity is kicked off, it shows up as null in the sub activity. I can't find anyone else who has had this problem, so I thought I'd ask for pointers about where to look/how to debug.</p> <p>(Target is Android 2.1)</p> <p>Parent activity snippet:</p> <pre><code>@Override protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Intent i = new Intent(ctx, ArticleView.class); i.putExtra("url", articles.get(position).url.toString()); // The following line correctly logs the URL Log.d(TAG,"Starting article viewer with url " + i.getStringExtra("url")); startActivityForResult(i,ACTIVITY_ARTICLE); } </code></pre> <p>Child activity snippet:</p> <pre><code>@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.article_view); if (icicle != null) { // Never called! } else { // Always called Log.d(TAG,"Icicle is null - no URL passed in"); } } </code></pre> <p>Ignoring the fact that icicle is null and attempting to retrieve state information from it (with getString) results in a hang and:</p> <pre><code>03-14 22:23:03.529: WARN/ActivityManager(52): Activity HistoryRecord{44ddd238 com.t.s/.ArticlesList} being finished, but not in LRU list </code></pre> <p>Any hints greatly appreciated.</p>
java android
[1, 4]
1,264,265
1,264,266
Create object on page_load and pass to JQuery
<p>I have an asp.net page and the JQuery date picker. On page load, I want to look at some config and create an object of dates to not include and then pass that to my JQuery in an external .js file. Is there a way to do this? How?</p> <p>EDIT: I'd like to pass a Class object</p>
jquery asp.net
[5, 9]
1,380,951
1,380,952
How to match external links with javascript (but ignore subdomains)?
<p>I have the following (jquery) selector looking for external links.</p> <p>This works, and ignores all links that include <code>location.hostname</code> <em>(e.g. www.domain.com)</em></p> <p>My question is, how to extend this to also ignore links to subdomains of your site? <em>(e.g. new.domain.com)</em></p> <pre><code>$('a').each(function() { var href = $(this).attr('href'); if(this.hostname &amp;&amp; this.hostname !== location.hostname) { $(this) .removeAttr('target') .attr('rel', 'external') .attr('title', href) .click(function() { window.open($(this).attr('href')); return false; }); } }); </code></pre>
javascript jquery
[3, 5]
2,956,114
2,956,115
Why do I encapsulate a jQuery function within jQuery(function ($) { });
<p>I came across a piece of code which looks like this:</p> <pre><code>jQuery(function($) { $('#saySomething').click(function() { alert('something'); }); }); </code></pre> <p>I don't quite get it. Why can't I simply do this:</p> <pre><code>$('#saySomething').click(function() { alert('saySomething'); }); </code></pre>
javascript jquery
[3, 5]
5,058,511
5,058,512
Simulating AppDomain recycle
<p>I read Phil Haack's article on using the <code>IRegisteredObject</code> interface to be sure that a background thread finishes completion when the AppDomain is brought down, and I implemented it into my code. However, I'm not entirely sure how to simulate a AppDomain crash in order to test it. How can I simulate an AppDomain crash?</p>
c# asp.net
[0, 9]
4,536,798
4,536,799
How to make a "do not ask me again" dialog pop-up box? Android
<p>I am trying to create a "hint" dialog box that informs the user about enabling GPS on their phone will decrease battery life. I want it to pop-up but have a check box that says: "Do not ask me again". </p> <p>How do I go about creating this in Android?</p> <p>Thank you,</p> <p>Zukky.</p> <pre><code>AlertDialog.Builder prompt = new AlertDialog.Builder(this); prompt.setCancelable(false); prompt.setTitle("Warning"); prompt.setMessage ("HINT: Otherwise, it will use network to find" + "your location. It's inaccurate but saves on " + "battery! Switch GPS on for better accuracy " + "but remember it uses more battery!"); </code></pre>
java android
[1, 4]
3,299,806
3,299,807
Javascript/JQuery: return immediately from PARENT function in call to each() via anon function
<p>For example:</p> <pre><code>&gt; function foo() { &gt; jQuery(whatever).each( function() { return; // this just exits the anonymous function - is there a way to return from foo? } ); &gt; &gt; } </code></pre>
javascript jquery
[3, 5]
3,827,978
3,827,979
Delete does not ask for confirmation
<p>When Delete button is clicked, the confirmation box should pop up if the selected node has child nodes. Otherwise, it should not do anything.</p> <p>Right now, when I click on delete, it just deletes without confirming.</p> <p>Here is the code:</p> <pre><code> &lt;asp:Button ID="btn_delete" runat="server" Height="32px" onclick="btn_delete_Click" OnClientClick = "return childnode();" Text="Delete" Visible="False" /&gt; &lt;script type="text/javascript"&gt; function childnode() { var treeViewData = window["&lt;%=nav_tree_items.ClientID%&gt;" + "_Data"]; var selectedNode = document.getElementById(treeViewData.selectedNodeID.value); if (selectedNode.childNodes.length &gt; 0) { return confirm("heloo"); } return false; } &lt;/script&gt; </code></pre>
c# javascript asp.net
[0, 3, 9]
5,605,632
5,605,633
How do I add a reference to a Web Application Project in an Associated Class Library?
<p>I'm working on an internet application that has been set up as a web SITE project (I know...) in Visual Studio. I need to add additional features/functionality so have added a class library to the project and referred to it in the main web site project.</p> <p>The issue now arises because I need to make use of core objects which live inside the App_Code directory in the web site project but this project doesn't appear to expose its DLL like web app/ code library projects do. Because of this I can't add a reference to the web site project in the class library to leverage the common site-wide code/objects.</p> <p>I can't move the stuff out of App_Code so I'm looking for a way to refer to the website project dll from the new class library. Can anyone suggest a workaround? All help v. gratefully received :-)</p>
c# asp.net
[0, 9]
666,243
666,244
jQuery Validation - Using validation on click, not on submit
<p>I'm using (or trying to) <a href="http://docs.jquery.com/Plugins/Validation" rel="nofollow">JQuery Validation</a> with WebForms/html.</p> <p>I have, basically (simplifying the real html, showing only the elements):</p> <pre><code>&lt;input id="txtEmail"/&gt; &lt;input id="txtTicketID"/&gt; &lt;a id="create" href="#"&gt;Create a new ticket&lt;/a&gt; &lt;a id="find" href="#"&gt;Find this ticket&lt;/a&gt; </code></pre> <p>The javascript for validation/action is here:</p> <pre><code>$(function() { $("#aspnetForm").validate({ rules: { txtEmail: { required: true, email: true , messages: { required: "* enter your e-mail", email: "* invalid e-mail" } }, txtTicketID: { required: true, digits: true, messages: { required: "*", digits: "* invalid ticket" } } }, onfocusout: true, onkeyup: true, onsubmit: false, debug: true }); $("#create").click(function() { if ($("#aspnetForm").valid()) { var email = $("#txtEmail").val(); if (email != "") window.location = "CreateTicket.aspx?email=" + email; } }); $("#find").click(function() { if ($("#aspnetForm").valid()) { var email = $("#txtEmail").val(); var ticketID = $("#txtTicketID").val(); if (email != "" &amp;&amp; ticketID != "") window.location = "DetailEditTicket.aspx?email=" + email + "&amp;ticketID=" + ticketID; } }); }); </code></pre> <p>It is not working at all.. the valid() on the links click always return true, even if the fields are blank, or wrong.</p> <p>When I type something, blur, etc, nothing makes validation happen.</p> <p>Do you see what is missing on this?</p>
asp.net javascript jquery
[9, 3, 5]
3,418,040
3,418,041
Preventing MicrosoftAjaxWebForms.debug.js from loading
<p>I've got an ASP.NET web application, and I'm attempting to reduce HTTP calls to the server, so I'd like to not load things like <code>MicrosoftAjaxWebForms.debug.js</code> and <code>MicrosoftAjax.debug.js</code>. </p> <p>Script manager is used to form all of my external javascript files into one, and I'm concerned that this is causing other non-related libraries to be loaded.</p>
asp.net javascript
[9, 3]
4,449,192
4,449,193
jquery tooltip mouseout mouseover
<p>I have a Problem. The following Tooltip working great, but there is a Problem. When i go with the mouse to the right side, the cursor is faster then the tooltip and will hover it. This will hide and show the Cursor for a split Second. </p> <pre><code>http://gabibyte.zxq.net/jquery_tooltips/example.html // !REMEMBER TO INCLUDE JQUERY IN YOUR PAGE - IF YOU DON'T KNOW HOW, JUST INCLUDE THE LINE OF CODE BELOW IN THE &lt;HEAD&gt;...&lt;/HEAD&gt; PART OF YOUR PAGE /* &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"&gt;&lt;/script&gt; */ //----------------------------------------------CONFIGURATION var offset=15; //Distance between tooltip and cursor var fadeInSpeed=600; //Speed of the Fade-IN effect in miliseconds var fadeOutSpeed=200; //Speed of the Fade-OUT effect in miliseconds var clearQueue = true; //If set to false, if you hover over many elements fast, the events will stack up var gotoEnd= true; //If set to false, if you hover over many elements fast, the events will stack up //---------------------------------------------GLOBAL VARIABLES var mouseX,mouseY; $(document).ready(function(){ //-----------------------------------------------MOUSE EVENTS $(document).mousemove(function(e){ mouseX=e.pageX+offset; mouseY=e.pageY;+offset $('.floating').css('top',mouseY); $('.floating').css('left',mouseX); }); //------------------------------------------------HOVER EVENTS $('.hastooltip').hover(function () { var selector ="#"+ $(this).attr('tooltip'); //alert(selector); //$(selector).stop(clearQueue , gotoEnd) $(selector).fadeIn(250,function () {}); },function () { var selector ="#"+ $(this).attr('tooltip'); $(selector).fadeOut(fadeOutSpeed,function () {}); } ); }); </code></pre> <p>Is there any way to say for onmouseout "if hover toolbox do nothing else fadeOut".</p>
javascript jquery
[3, 5]
5,115,389
5,115,390
how do i call this code from an html button and pass it parameters
<p>OK I found this code here at stackoverflow It works nice. But how can I call it in a webview from a button on an html page that also has the event details (date time place)? <a href="http://stackoverflow.com/questions/246249/programmatically-add-custom-event-in-the-iphone-calendar">Programmatically add custom event in the iPhone Calendar</a></p> <pre><code>#import "EventTestViewController.h" #import &lt;EventKit/EventKit.h&gt; @implementation EventTestViewController - (void)viewDidLoad { [super viewDidLoad]; EKEventStore *eventStore = [[EKEventStore alloc] init]; EKEvent *event = [EKEvent eventWithEventStore:eventStore]; event.title = @"EVENT TITLE"; event.startDate = [[NSDate alloc] init]; event.endDate = [[NSDate alloc] initWithTimeInterval:600 sinceDate:event.startDate]; [event setCalendar:[eventStore defaultCalendarForNewEvents]]; NSError *err; [eventStore saveEvent:event span:EKSpanThisEvent error:&amp;err]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end </code></pre>
javascript iphone
[3, 8]
3,593,456
3,593,457
Jquery uncheck radio button not working
<p>This should be the right code but its not working</p> <pre><code>&lt;input type="radio" name="test"&gt;1 &lt;input type="radio" name="test"&gt;2 $('input[name=test]').click(function() { $('input[name=test]').attr(‘checked’,false); }); </code></pre> <p>example here</p> <p><a href="http://jsfiddle.net/8jKJc/16/" rel="nofollow">http://jsfiddle.net/8jKJc/16/</a></p> <p>EDIT:</p> <p>I forgot the line that should say if its checked then uncheck it</p>
javascript jquery
[3, 5]
2,412,020
2,412,021
each() on select not iterating
<p>For some reason I only get to the first option when I alert out below and then it exists my entire function. It never iterates through each option:</p> <pre><code> function SelectAlbumOption(iAlbumID, iAlbumDropdownID) { var dropdownID = '#' + iAlbumDropdownID; $(dropdownID).each(function(index, currentOption) { alert("(currentOption).attr('value'): " + $(currentOption).attr("value")); if($(currentOption).attr("value") == iAlbumID) { alert("matched option"); $(currentOption).attr("selected", "yes"); return false; } }); } </code></pre> <p>right before this function above is called, I add options to that select, so they do exist before this function is called.</p>
javascript jquery
[3, 5]
1,675,926
1,675,927
dynamic image (from db) using Generic Handler
<p>I'm trying to using a Generic Handler to retrieve and display images that are stored in a database.</p> <p>But its just not working. Ive tried verious of the code below, but I cant seem to get it to work.</p> <p>Can anyonne spot what I am doing wrong, or have some suggestions?</p> <pre><code>&lt;%@ WebHandler Language="C#" Class="IconsDb" %&gt; using System; using System.Web; using System.Linq; using System.Data.Entity; public class IconsDb : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.Write("Hello World"); Int32 iconId; if (context.Request.QueryString["id"] != null) iconId = Convert.ToInt32(context.Request.QueryString["id"]); else throw new ArgumentException("No parameter specified"); context.Response.ContentType = "image/gif"; //System.IO.Stream strm = ShowEmpImage(iconId); var db = new UdINaturen.UdINaturenContext(); var GetIcon = (from i in db.subcategoryicons where i.id == iconId select i.picture).FirstOrDefault(); object img = GetIcon; System.IO.MemoryStream memStream= new System.IO.MemoryStream((byte[])Convert.FromBase64String(GetIcon)); System.Drawing.Bitmap bitImage=new System.Drawing.Bitmap((System.Drawing.Bitmap)System.Drawing.Image.FromStream(memStream)); byte[] buffer = memStream.ToArray(); context.Response.ContentType = "image/gif"; //context.Response.OutputStream.Write(buffer, 0, buffer.Length); //context.Response.WriteFile(); context.Response.BinaryWrite(buffer); //context.Response.Flush(); } public bool IsReusable { get { return true; } } } </code></pre>
c# asp.net
[0, 9]
2,455,909
2,455,910
Does Integer.parseInt(String) creates object?
<p>I am using <code>int duration = Integer.parseInt(durationInString)</code> to convert String object to primitive integer value. I am using this in a while loop and the integer conversion happens every second until the end of video duration. For example - if Video is 2 min I will call <code>Integer.parseInt</code> 120 times. I wanted to know if every call to <code>Integer.parseInt</code> creates a object? If so is it a bad idea to have it called continuously?</p> <p>Any help is very much appreciated.</p> <p>Note: I am working on Android application</p> <p>Thanks, SKU </p>
java android
[1, 4]
3,561,300
3,561,301
Client id method javascript
<pre><code> &lt;input type="text" id="txtFirstName" runat="server" class="textReg" onblur="javascript:validate_input(&lt;%=txtFirstName%&gt;,'imgFirstNameS','imgFirstNameE');" /&gt;` </code></pre> <p>I want to send control id to my javascript function </p> <p>like <code>ctl00_ContentPlaceHolder1_txtFirstName</code></p> <p>or </p> <pre><code>function validate_input(control, success, error) { control = document.getElementById('&lt;%='+control+'.ClientID %&gt;'); } </code></pre> <p>is it possible ?</p>
javascript jquery asp.net
[3, 5, 9]
290,412
290,413
How can I make jQuery work even on objects not yet created?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2238616/binding-dynamically-created-elements-in-jquery">Binding dynamically created elements in jQuery</a> </p> </blockquote> <p>Is there a way I can change the following code:</p> <pre><code>$('#city') .focus(function () { $('option[value="99"]', this).remove(); store.setItem($(this).attr('id'), $(this).val()); }) .change(function () { store.setItem($(this).attr('id'), $(this).val()); $(this).attr("title", $("option:selected", this).attr("title")); $('#detailData').html(""); }); </code></pre> <p>So that it works for selects even if they have not yet been created as long as they have the class "update-title". for example:</p> <pre><code>&lt;select class="update-title"&gt; </code></pre> <p>I saw some implementation using live but someone said it was not good to use. Also is there much of an overhead doing this. Would it be better for me to add the code after I am sure the selects have been created with document.ready() ?</p>
javascript jquery
[3, 5]
3,812,867
3,812,868
Activate onchange after changing content with javascript
<p>Why wouldn't onChange function of an input be activated when the value of the input is changed by javascript? For example why when clicking on the button alert wouldn't happen?</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;input type="text" id="myInput" onchange="alert(1)" /&gt; &lt;button onclick = "document.getElementById('myInput').value = 'ads'"&gt;click&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>How can I make the onchange function work then?</p> <p>edit: I now understand event won't be triggered automatically, how can I call it(jquery too) ?</p>
javascript jquery
[3, 5]
536,502
536,503
jQuery event to trigger action when a div is made visible
<p>I'm using jQuery in my site and I would like to trigger certain actions when a certain div is made visible.</p> <p>Is it possible to attach some sort of "isvisible" event handler to arbitrary divs and have certain code run when they the div is made visible?</p> <p>I would like something like the following pseudocode:</p> <pre><code>$(function() { $('#contentDiv').isvisible(function() { alert("do something"); }); }); </code></pre> <p>The alert("do something") code should not fire until the contentDiv is actually made visible.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
638,292
638,293
Understanding $.proxy() in jquery?
<p>From docs i understand that .proxy() would change the scope of the function passed as an argument.Can someone please explain this better ?, why should we do this?</p>
javascript jquery
[3, 5]
1,039,323
1,039,324
Android text to speech issue
<p><a href="http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/TextToSpeechActivity.html" rel="nofollow">http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/TextToSpeechActivity.html</a></p> <p>I was going to add this but how can i add it if my main activity where it will get the text etc already has this <code>implements OnClickListener</code> and then that tutorail has this <code>implements TextToSpeech.OnInitListener</code></p>
java android
[1, 4]
2,841,118
2,841,119
google calendar api asp.net c#
<p>i create a new calendar "test" and i use this code</p> <pre><code> public static CalendarService GetService(string applicationName, string userName, string password) { CalendarService service = new CalendarService(applicationName); service.setUserCredentials(userName, password); return service; } public static void AddEvent(CalendarService service, string title, string contents, string location, DateTime startTime, DateTime endTime) { Google.GData.Calendar.EventEntry entry = new Google.GData.Calendar.EventEntry(); // Set the title and content of the entry. entry.Title.Text = title; entry.Content.Content = contents; // Set a location for the event. Where eventLocation = new Where(); eventLocation.ValueString = location; entry.Locations.Add(eventLocation); When eventTime = new When(startTime, endTime); entry.Times.Add(eventTime); Uri postUri = new Uri("https://www.google.com/calendar/feeds/test/private/full"); // Send the request and receive the response: AtomEntry insertedEntry = service.Insert(postUri, entry); } AddEvent(GetService("regis-test", vUserName, vPassword), "title", "test", "Sibiu", DateTime.Now, DateTime.Now.AddHours(4)); </code></pre> <p>what is wrong ? becouse this code do not add event to the test calendar he add to the default </p>
c# asp.net
[0, 9]
3,435,133
3,435,134
Show a loading GIF BeforeUnload Of a Page
<p>I am working on a application which will work on computer as well as Ipad,Iphone,Tablets and Android phones. I have one requirement of Showing a loading... gif when user moves from one page to other because this will give user a info that page loading/unloading is in process.</p> <p>So i Tried below mentioned code ///below code for showing GIF while DOM is not ready.</p> <pre><code>$(document).ready(function(){ $("#loading").hide();}); </code></pre> <p>//below code for showing GIF when user clicks on some button to do some Server Interaction.</p> <pre><code>$(window).bind('beforeunload',function(){ $("#loading").show();}); </code></pre> <p>where #loading is id of a div which contains my GIF Code. Now this is working greatly on PC browsers but NOT on Ipad,Iphone and android phones. I am Not able to figure out why.</p> <pre><code>&lt;div id="loading"&gt; &lt;img id="loading-image" src="/img/loading.gif" alt="Loading..." /&gt;&lt;/div&gt; </code></pre> <p>This div is for loading the GIF.</p>
javascript jquery
[3, 5]
5,481,444
5,481,445
How to connect between ASP.NET page and javascript
<p>I'm trying to put current time on ASP.NET page. How can i get the control ID from Javascript? I'm using C# ASP.NET </p> <p>On my Form</p> <pre><code>&lt;body onload="updateClock(); setInterval('updateClock()', 1000 )"&gt; &lt;form id="form1" runat="server" &gt; &lt;span id="clock"&gt;&amp;nbsp;&lt;/span&gt; &lt;/form&gt; &lt;/body&gt; </code></pre> <p>Javascript Function</p> <pre><code>function updateClock ( ) { document.getElementById("clock").firstChild.nodeValue = currentTimeString; } </code></pre>
javascript asp.net
[3, 9]
2,738,974
2,738,975
When should I Init my tiles in my Android view?
<p>The dimnensions of my tiles depend of the width annd height of the screen.</p> <p>When should I give them their dimensions?</p> <p>If I init them in OnSizeChanged, then I'll need a boolean to know if it's the first time onSizeChanged occured.</p> <p>Would it be more appropriate to store my tile dimensions in relative values?</p> <p>What would be the proper way to do this?</p> <p>Thanks</p>
java android
[1, 4]
2,718,476
2,718,477
add and remove multiple classes in jquery
<p>hello i'm trying to add and remove multiple classes on a text field by clicking different radio buttons. i'm not able to remove the unwanted classes while switching between different radio buttons. my code for this is:</p> <pre><code>//for 1st radio button if(actionUrl == "search-client-by-id") { $("#req").removeClass("validate[required,custom[onlyLetterNumber],maxSize[20],custom[onlyLetterSp]]").addClass("validate[required,custom[onlyNumberSp]]"); } //for 2nd radio button else if(actionUrl == "search-client-by-name") { $("#req").removeClass("validate[required,custom[onlyNumberSp]]").addClass("validate[required,custom[onlyLetterNumber],maxSize[20],custom[onlyLetterSp]]"); } </code></pre>
javascript jquery
[3, 5]
1,367,433
1,367,434
Define function inside the the module in javascript
<p>I tried to define a function attachPicker can be called like:</p> <pre><code>(function(){ $.fn.tagPicker = function(source){ this.attachPicker(); } })(jQuery); </code></pre> <p>I tried:</p> <pre><code>(function(){ $.fn.tagPicker = function(source){ this.attachPicker(); //define attachPicker $.fn.attachPicker = function(){ //code here } } })(jQuery); (function(){ $.fn.tagPicker = function(source){ this.attachPicker(); //define attachPicker this.attachPicker = function(){ //code here } } })(jQuery); </code></pre> <p>Both threw out </p> <pre><code>Uncaught TypeError: Object [object Object] has no method 'attachPicker' </code></pre> <p>If I did</p> <pre><code>(function(){ $.fn.tagPicker = function(source){ this.attachPicker(); } $.fn.attachPicker() = function(){ //codes here }; })(jQuery); </code></pre> <p>It worked. But I want to define attachPicker inside tagPicker so that it can access the source. Anyone can explain why the ones I tried didn't work and give me any suggestions? Of course I knew I can pass source as argument if defining attachPicker outside. Thanks in advance!</p>
javascript jquery
[3, 5]
3,257,252
3,257,253
$(document).ready(function(){}); vs script at the bottom of page
<p>what is the difference / advantage / disadvantage of writing script at the bottom of the page and writing the script in </p> <pre><code>$(document).ready(function(){}); </code></pre>
javascript jquery
[3, 5]
1,482,415
1,482,416
Creating FTP user dynamically
<p>I need to create FTP users via a C# software, which is run Client-Side, I have no idea where to start or how to do that, I am not even sure if this is possible as this may require to be logged as root?</p> <p>My other option would be to call a PHP script via the C# software, which could call a system() script?</p> <p>This function needs to work on Linux shared hosting (as this is shared I can't do everything I can).</p>
c# php
[0, 2]
2,681,758
2,681,759
Which C# practices should be avoided in C++?
<p>I'm currently teaching myself C++. I'm very proficient at C#, and was wondering which common practices in C# can lead to difficulties in C++, and what a C++ programmer should do instead.</p>
c# c++
[0, 6]
4,243,836
4,243,837
Check if a text file exists in ASP.NET
<p>I need to check if a text file exists on a site on a different domain. The URL could be:</p> <pre><code>http://sub.somedomain.com/blah/atextfile.txt </code></pre> <p>I need to do this from code behind. I am trying to use the <code>HttpWebRequest</code> object, but not sure how to do it.</p> <p><strong>EDIT: I am looking for a light weight way of doing this as I'll be executing this logic every few seconds</strong></p>
c# asp.net
[0, 9]
4,268,500
4,268,501
Set input values according to children of the parent div
<p>given series of DIVs w/unique ID as in: </p> <pre><code>&lt;div id="2988"&gt; &lt;div class="site"&gt;YaHoot.com&lt;/div&gt; &lt;div class="logo"&gt;/images/yahootLogo.jpg&lt;/div&gt; //[and so on] &lt;input type="button" value="YaHoot" onclick="javascript:processMe('2988');" /&gt; &lt;/div&gt; //[followed by bunches more divs repeating that structure] </code></pre> <p>I'm trying to code a click handler that can map a form's hidden fields with the contents of each of the child DIVs. </p> <p>In other words, the form has a hidden field:</p> <pre><code>&lt;input type="hidden" name="logo"&gt; </code></pre> <p>that should be valued with <strong>/images/yahootLogo.jpg</strong> when the given button is clicked.</p> <p>thx</p>
javascript jquery
[3, 5]
1,716,951
1,716,952
Android save/rewrite file to sdcard
<p>I have implemented method which can save audio resource to sd card, but if i use it 2 times with equal resource i see in Music Player 2 equal files... How to overwrite file? Or it is problem with player scanning?</p> <pre><code> public Uri saveToSdCard(String name, int audioResourceId) { String path = "/sdcard/media/audio/ringtones/"; String resourceEntryName = activity.getApplicationContext().getResources().getResourceEntryName(audioResourceId); String filename = resourceEntryName + ".ogg"; byte[] buffer = null; try { InputStream inputStream = activity.getBaseContext().getResources().openRawResource(audioResourceId); int size = inputStream.available(); buffer = new byte[size]; inputStream.read(buffer); inputStream.close(); } catch (IOException e) { Toast.makeText(activity, R.string.oops_message, Toast.LENGTH_LONG).show(); } boolean exists = (new File(path)).exists(); if (!exists) { new File(path).mkdirs(); } FileOutputStream save; try { save = new FileOutputStream(path + filename); save.write(buffer); save.flush(); save.close(); } catch (FileNotFoundException e) { Toast.makeText(activity, R.string.ex_message, Toast.LENGTH_SHORT).show(); } catch (IOException e) { Toast.makeText(activity, R.string.ex_message, Toast.LENGTH_SHORT).show(); } File mediaFile = new File(path, filename); ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, mediaFile.getAbsolutePath()); values.put(MediaStore.MediaColumns.TITLE, resourceEntryName); values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/*"); values.put(MediaStore.Audio.Media.ARTIST, name); values.put(MediaStore.Audio.Media.IS_RINGTONE, true); values.put(MediaStore.Audio.Media.IS_NOTIFICATION, true); values.put(MediaStore.Audio.Media.IS_ALARM, true); values.put(MediaStore.Audio.Media.IS_MUSIC, false); Uri uri = MediaStore.Audio.Media.getContentUriForPath(mediaFile.getAbsolutePath()); Uri auri = activity.getContentResolver().insert(uri, values); activity.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, auri)); return auri; } </code></pre>
java android
[1, 4]
2,344,274
2,344,275
Pagination jQuery next and previous control with keyboard - .trigger('click') doesn't work
<p>I am working on pagination.</p> <p>To help a user to change pages with keyboard short-keys, instead of clicking a mouse, I came up with a jQuery solution that catches user keyboard events with <code>CTRL + →</code> and <code>CTRL+ ←</code></p> <pre><code>$(document).keydown(function(event) { if (event.ctrlKey) { // if ctrl is being held var keycode = event.keyCode ? event.keyCode : event.which; if(keycode === 39) { // for rightwards arrow (for leftwards arrow keycode === 37) window.open($('#pagination li.next a').attr('href'), '_parent'); // open the next link } } }); </code></pre> <p>My question is why it doesn't work with regular <code>.trigger('click')</code>, like this:</p> <pre><code>$('#pagination li.next a').trigger('click'); </code></pre>
javascript jquery
[3, 5]
1,916,131
1,916,132
How do I save an Image from an url?
<p>How do I take an image from an url and save it locally?</p> <p><a href="http://someurl.com/imagename.jpg" rel="nofollow">http://someurl.com/imagename.jpg</a> -> c:\apppath\imgfolder</p> <p>ASP.NET C#</p> <p>I am not very good with IO stuff, hope someone can help me out :)</p>
c# asp.net
[0, 9]
2,889,952
2,889,953
How can get data from mysql server from apps written by JQueryMobile and Phonegap?
<p>I have create Android apps using JqueryMobile and PhoneGap.<br> How can I send request to mysql server and get back the results?<br> I have researched for few days but still no idea<br> Please help to solve</p>
jquery android
[5, 4]
3,725,256
3,725,257
Compare two objects and find the differences
<p>what is the best way to compare two objects and find the differences?</p> <pre><code>Customer a = new Customer(); Customer b = new Customer(); </code></pre>
c# asp.net
[0, 9]
1,798,356
1,798,357
how to get dropdown selecteditem in server side when I have set options using javascript
<p>I have set options on dropdownlist using javascript and cant able to get selectedItem. Any idea?</p>
c# javascript asp.net
[0, 3, 9]
2,309,435
2,309,436
jquery reset the css value of an animation?
<p>I have a created a snippet of code that basically animates an h2 onto an image on hover and then off the right on hover off, so i've initially set the h2 to be left: -200px off the page on load, then on hover to animate to left: 10px inside the .image and then on hover off to animate to left: 500px to zoom off. Now when I hover the image again the h2 is being animated in from the right, how can I reset the h2 to be -200px as soon as the hover off has happened or can you suggest a better way for me to achieve this effect?</p> <p>My attempt can be found here <a href="http://jsfiddle.net/kyllle/GPve7/" rel="nofollow">http://jsfiddle.net/kyllle/GPve7/</a> </p> <p>Thanks</p>
javascript jquery
[3, 5]
146,612
146,613
String manipulation - getting value after the last position of a char
<p>How I can get the value after last char(. ; + _ etc.): e.g.</p> <blockquote> <p>string.name+org.com</p> </blockquote> <p>I want to get "com". Is there any function in jQuery?</p>
javascript jquery
[3, 5]
2,696,753
2,696,754
insert an element at a certain time of the day
<p>what is the best way to do something , like inserting an element at a certain time of the day ? should I use setTimeout() os is there a better way to do it ?</p>
javascript jquery
[3, 5]
4,458,003
4,458,004
What's a good Javascript tutorial library?
<p>I'm looking for something that will allow me to walk a new user through a a web app one step at a time with different hints on what to click and look at. Does something like this exist?</p>
javascript jquery
[3, 5]
2,056,373
2,056,374
upload an view image
<p>Problem is i set the image url clicking lnkFV link button. but image not viewed on the page.<br /> source</p> <pre><code>&lt;tr&gt; &lt;td style="width: 160px; height: 15px"&gt; &lt;asp:Label ID="Label4" runat="server" Text="Style Front View"&gt; &lt;/asp:Label&gt; &lt;/td&gt; &lt;td style="width: 222px; height: 15px"&gt; &lt;asp:FileUpload id="filFrontView" runat="server"&gt; &lt;/asp:FileUpload&gt; &lt;/td&gt; &lt;td style="width: 72px; height: 15px"&gt; &lt;asp:LinkButton id="lnkFV" runat="server" OnClick="lnkFV_Click"&gt; View image&lt;/asp:LinkButton&gt; &lt;/td&gt; &lt;td colspan="3" rowspan="1"&gt; &lt;asp:Image id="Image1" runat="server"&gt; &lt;/asp:Image&gt;&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>asp code</p> <pre><code>protected void lnkFV_Click(object sender, EventArgs e) { // new Help().Perform("Do you really want to proceed"); try { file = Path.GetFileName(filFrontView.PostedFile.FileName); // file = Path.GetFileName(filFrontView.PostedFile.FileName); tempF = "F:\\Visual Studio 2005\\User\\temp\\" + file; temp = "~\\temp\\" + file; filFrontView.SaveAs(Server.MapPath(temp)); // filFrontView.SaveAs(temp); string filePath = MapPath(temp); Image1.ImageUrl = tempF; } catch (Exception ee) { } } </code></pre>
c# asp.net
[0, 9]
4,706,898
4,706,899
Jquery - Dynamic button, can I clean this up?
<p>I created a button that will randomly appear on the screen (per my boss's request) that when clicked will open an email in order to provide feedback.</p> <p>My goal is to make this script do everything, mainly so I don't have to access the ASP markup or CSS files for each website. Just throw the script in the header and place the image in the folder.</p> <p>I created the script to:</p> <ul> <li>Create a div that contains the button</li> <li>set the CSS for the elements of that div (there will be a little image next to some text)</li> <li>appear to the user at random</li> </ul> <p>The script I came up with works fine, however, I was wondering if there was anyway I can clean this up at all. (I'm kind of new to writing my own Jquery scripts and I'm trying to learn how to be as organized as possible.)</p> <p>Jquery:</p> <pre><code>$(function () { var fbContainer = $('&lt;div id="feedback"&gt;&lt;img src="image.gif" /&gt; &lt;a href="mailto:feedback@mywebaddress.com"&gt;Feedback&lt;/a&gt;&lt;/div&gt;') .css({ 'display': 'none', }); $('#header').append(fbContainer); $('#feedback a').css({ 'font-family': 'arial', 'float': 'left', 'text-decoration': 'none', 'color':'#000000' }); $('#feedback img').css({ 'float': 'left', 'margin': '3px 5px 0 0'; }); var randofactor = .5; var randomizer = Math.random(); if (randomizer &lt; randofactor) { fbContainer.css('display', 'block'); } }); </code></pre> <p>Thanks for any assistance</p>
javascript jquery
[3, 5]