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
2,044,062
2,044,063
Calling JavaScript in a WebBrowser control from C#
<p>For example: 1) In webBrowser1 page index.html is loaded. 2) This page has the following code:</p> <pre><code>... &lt;a id="activity_text" href="#" onclick="activity_editor.show();return false;"&gt;now status&lt;/a&gt; ... </code></pre> <p>3) As I can in the program way to change "now status"?</p> <p>I tried so:</p> <pre><code>HtmlElement collH1 = document.GetElementById("activity_text"); collH1.InnerText = "new status"; </code></pre> <p>But this way works only in the control webBrowser1. If then to come to look through IE/Opera/FF that has varied of nothing...</p>
c# javascript
[0, 3]
5,373,545
5,373,546
Get system ip code not working in server
<p>This code works on my system not in server please help me to fix this error. am not sure what is error..</p> <p>This is my partial code...</p> <pre><code>private IPAddress getMyCurrentIP() { IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName()); if (host.AddressList.Length == 1) myCurrentIP = host.AddressList[0].ToString(); else { foreach (IPAddress address in host.AddressList) { if (address.AddressFamily == AddressFamily.InterNetwork) { if (IsLocal(address)) return address; } } } return null; } public bool IsLocal(IPAddress address) { if (address == null) throw new ArgumentNullException("address"); byte[] addr = address.GetAddressBytes(); return addr[0] == 10 || (addr[0] == 192 &amp;&amp; addr[1] == 168) || (addr[0] == 172 &amp;&amp; addr[1] &gt;= 16 &amp;&amp; addr[1] &lt;= 31); } </code></pre> <p>please help me to fix this error...</p>
c# asp.net
[0, 9]
3,786,920
3,786,921
how to get dynamically created textarea's value in POST array?
<p>I am creating few textareas on-the-fly by replacing the content and adding that content in textarea. Please review the code below:</p> <pre><code> &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function(){ $("#content").find(".editable").each(function(count){ var content = $(this).html(); $(this).html(""); var txtArea = document.createElement('textarea'); txtArea.setAttribute('cols', '80'); txtArea.setAttribute('name', "content[]"); txtArea.setAttribute('rows', '10'); txtArea.innerHTML(content); this.appendChild(txtArea); }) }); &lt;/script&gt; </code></pre> <p>Now when I post this form to a php page I don't get values of textareas that were created in the POST array</p> <p>Please provide guidance and do let me know if I can do any thing to make my question more clear...</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
5,482,594
5,482,595
Adding WebUserControl To Gridview in asp.net
<p>I want to add a webusercontol which contains a textbox and a label to the gridview control. I am binding a gridview with a datatable dynamically.</p> <p>Here is my code:</p> <pre><code>@ Register Src="CompareBox.ascx" TagName="CompareBox" TagPrefix="objCompareBox" %&gt;&lt;br&gt; &lt;asp:GridView ID="grdfoneBoxContainer" runat="server"&gt; &lt;Columns&gt;&lt;br&gt; &lt;asp:TemplateField HeaderText="User control"&gt; &lt;br&gt; &lt;ItemTemplate&gt;&lt;br&gt; &lt;objCompareBox:CompareBox ID="CompareBoxCol1" runat="server"/&gt;&lt;br&gt; &lt;/ItemTemplate&gt;&lt;br&gt; &lt;/asp:TemplateField&gt;&lt;br&gt; &lt;/Columns&gt;&lt;br&gt; &lt;/asp:GridView&gt;&lt;br&gt; DataTable dt = new DataTable(); dt.Columns.Add("uc1"); dt.Columns.Add("uc2"); dt.Columns.Add("uc3"); dt.Columns.Add("uc4"); CompareBox objCompareBox = new CompareBox(); objCompareBox.txt= "World"; objCompareBox.lbl = "Hello"; dt.Rows.Add(objCompareBox, objCompareBox, objCompareBox, objCompareBox); dt.Rows.Add(objCompareBox, objCompareBox, objCompareBox, objCompareBox); dt.Rows.Add(objCompareBox, objCompareBox, objCompareBox, objCompareBox); dt.Rows.Add(objCompareBox, objCompareBox, objCompareBox, objCompareBox); grdfoneBoxContainer.DataSource = dt; grdfoneBoxContainer.DataBind(); </code></pre> <p>txt &amp; lbl are two properties that are declared in WebUserControl but it's giving object reference error . </p> <p>Thanks,</p>
c# asp.net
[0, 9]
643,518
643,519
select items in a checkbox list based on their text
<p>i have a check box list in my asp.net page ...i need to select the check box based on their text...am getting these string values form the database and storing it in a array.....the below code works fine for a single text ..What should i do in case of array..how should i pass the array values in the if loop</p> <pre><code> for (int i = 0; i &lt; chkbx.Items.Count; i++) { if (chkbx.Text == "Dress" ) { chkbx.Items[i].Selected = true; } } </code></pre>
c# asp.net
[0, 9]
2,177,678
2,177,679
How to echo or print to test the if else condition in ASP.NET
<p>i am trying to do a simple time calculating program in ASP.NET , where people enter amount and annual interest and payment per month , need to get time in months when the debt is paid of along with interest, and i want to test if the monthly payment amount is smaller than the monthly interest amount using if else condition but it doesn't seem to be working , if i put monthly payment smaller than monthly interest amount then the program hangs.</p> <p>My code:</p> <pre><code> protected void btnCalculate_Click(object sender, EventArgs e) { if (IsValid) { int BorrowAmount = Convert.ToInt32(txtBorrow.Text); double InterestRate = Convert.ToDouble(txtRate.Text); int MonthlyPay = Convert.ToInt32(txtMAmount.Text); double Rammount = BorrowAmount; double monthlyIntRate = InterestRate / 12; //LblNoMonths.Text = Convert.ToString(monthlyIntRate); //LblNoMonths.Text = Convert.ToString(monthlyIntRate); double firstmonthlyIntRateAmt = ((monthlyIntRate / 100) * Rammount); if (MonthlyPay &gt;= firstmonthlyIntRateAmt) { int month = 0; while (Rammount &gt;= MonthlyPay) { month++; double monthlyIntRateAmt = ((monthlyIntRate / 100) * Rammount); Rammount = Rammount - (MonthlyPay - monthlyIntRateAmt); } LblNoMonths.Text = Convert.ToString(month); } else { LblNoMonths.Text ="Monthly payment is less than the monthly interest rate!!"; } } } </code></pre> <p>The code inside else condition seem to have no effect</p> <p>LblNoMonths.Text =@"Monthly payment is less than the monthly interest rate!!";</p> <p>am i doing anything wrong , please any help would be greatly appreciated and Thanking you all in advance</p>
c# asp.net
[0, 9]
5,315,155
5,315,156
How to close a popup window in a parent window?
<p>I need to close a popup window which has been loaded by a parent window.</p> <p>This popup window is a <code>Documentviewer</code> window in my webapp.</p> <p>I need to close this viewer by clicking a logout button which is in master page.</p> <p>My code:</p> <pre><code>public string MySession //server side code { get { if (Session["RegID"] != null) { return Session["RegID"].ToString(); } else { return ""; } } } //client side code $(window).load(function() { Start(); }); function Start() { timedCount(); var t=setTimeout("Start()",10000); } function timedCount() { /*var out="&lt;%=Session["RegID"]%&gt;";*/ var out='&lt;%=MySession%&gt;'; if(out!="") { alert(out); }else { window.close(); } } </code></pre> <p>Server code is executed at very first time only.</p> <p>My target is to close the popup if it is opened when user logs out.</p>
c# javascript asp.net
[0, 3, 9]
4,849,012
4,849,013
Exchange rate of variable currency in a variable Date in C#
<p>Hi Anyone knows any free Web service which can give me ability to convert my variable currency of into different currency in a variable date. I have tested this web service (http://www.webservicex.net/CurrencyConvertor.asmx) but it is not giving me option for previous date. Please guide me!</p> <p>Kind Regards Syed Sana ul Haq Fazli </p>
c# asp.net
[0, 9]
3,315,391
3,315,392
I need help starting out with programming
<p>A couple of days ago, I began learning c++. I downloaded visual studio, looked at tutorials, and wrote some simple programs. I was doing good until I got the pointers. Whats the point of "pointing" to a variable when you can just reference the actual variable. It was really confusing me.</p> <p>So I began looking online at other languages. I debated java, python, ruby, perl, c#, Visual basic, and I couldn't decide. I wanted to make something with a GUI, so everywhere I went, I got pointed to c#. I began looking at that, and it seems fine, but there is no way of working with "unlimited" sized variables.</p> <p>So before I go too far into c#, is java a better choice? How about python? What language would be the best for general-purpose programming? </p> <p>Thanks</p>
c# java python
[0, 1, 7]
4,114,757
4,114,758
Google annotated timeline
<p>I want to use Google Annotated Time Line to generate a graph using values generated from a PHP script, so far I have:</p> <p></p> <pre><code> google.load('visualization', '1', {'packages':['annotatedtimeline']}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('date', 'Date'); data.addColumn('number', 'Data'); data.addRows([ [new Date($y1, 1, 1), $value_y1_1], [new Date($y1, 2, 1), $value_y1_2], [new Date($y1, 3, 1), $value_y1_3], ]); var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div1')); chart.draw(data, {displayAnnotations: true}); } &lt;/script&gt; </code></pre> <p>I want to add more monthly data points, from $y1 to $y80, with the corresponding $value. I used a for loop but got "undefined variable" error. Suggestions?</p> <p>Thanks!</p>
php javascript
[2, 3]
393,953
393,954
Android, Strings, Quotes
<p>i want to create an android app which basically shows some quotes and those quotes are able to be shared to social platforms(e.g facebook and twitter). How do I go about doing that? Thanks in advance..</p>
java android
[1, 4]
4,890,246
4,890,247
Why cant i combine javascript and php in my code?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/168214/pass-a-php-string-to-a-javascript-variable-and-escape-newlines">Pass a PHP string to a Javascript variable (and escape newlines)</a> </p> </blockquote> <p>I am quite new to the concepts of Javascript/jQuery and PHP. I have been using PHP implemented in Appserv for two weeks now to get data from a modbus device and store it in a csv file. Now i want to plot the data using jQplot. I am trying to write a simple program to first see if i can implement php and javascript code together in html. This is a code that i have written in html and uses both javascript and php. </p> <pre><code>&lt;!doctype html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Demo&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h2&gt;This is a script&lt;/h2&gt; &lt;script type="text/javascript"&gt; var out = &lt;?php echo "Hello"?&gt;; //var out = "Hello" document.write(out); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When i run this code in the browser ( I use google chrome with windows 7) I only get the heading "This is a script". However if i remove the line with the php code and uncomment the next line</p> <pre><code>var out = "Hello"; </code></pre> <p>then the code prints the output with "Hello" like its supposed to. Why is this?</p>
php javascript
[2, 3]
5,112,569
5,112,570
How do I handle screen orientation changes when a dialog is open?
<p>I have an android app which is already handling changes for orientation, i.e. there is a <code>android:configChanges="orientation"</code> in the manifest and an <code>onConfigurationChange()</code> handler in the activity that switches to the appropriate layout and preps it. I have a landscape / portrait version of the layout.</p> <p>The problem I face is that the activity has a dialog which could be open when the user rotates the device orientation. I also have a landscape / portrait version of the dialog.</p> <p>Should I go about changing the layout of the dialog on the fly or perhaps locking the activity's rotation until the user dismisses the dialog. </p> <p>The latter option of locking the app appeals to me since it saves having to do anything special in the dialog. I am supposing that I might disable the orientation when a dialog opens, such as </p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR); </code></pre> <p>and then when it dismisses</p> <pre><code>setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); </code></pre> <p>Would that be a sensible thing to do? If the screen orientation did change while it was locked, would it immediately sense the orientation change when it was unlocked?</p> <p>Are there alternatives?</p>
java android
[1, 4]
2,832,442
2,832,443
jquery click event ONLY when wrapped element clicked
<p>I have the following html:</p> <pre><code>&lt;ul class="treeList2"&gt; &lt;li class="topLevel marked checked"&gt;&lt;div class="tlWrap clearfix"&gt;&lt;input type="checkbox" checked="checked" class="checkbox"&gt;&lt;strong&gt;Level name here blah blah &lt;span&gt;(3)&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;/li&gt; </code></pre> <p>...</p> <pre><code>&lt;script type="text/javascript"&gt; /*&lt;![CDATA[*/ $(function(){ $('.treeList2 li.topLevel .tlWrap').click(function(){ alert(this); }); }); /*]]&gt;*/ &lt;/script&gt; </code></pre> <p>The problem is that this fires when I click the checkbox (which i don't want). <strong>I Only want to alert(this) when the 'div' is clicked</strong> (I do this so that I can change the div background). thanks</p>
javascript jquery
[3, 5]
5,681,809
5,681,810
Select ListItem in ListBox based on Text from TextBox
<p>I am trying to select an item in a ListBox based on text entered in a textbox using jquery. If the length of the text entered in the textbox is greater than 1 I would like to loop through the items in the ListBox and compare the value of each item and if it matches the numbers entered in the textbox I need to select/highlight it in the ListBox. Here is what I am doing but doesn't seem to work. The ListBox ListItem's are populated at runtime from the database.</p> <p>Asp.Net</p> <pre><code>&lt;asp:TextBox ID="txtMediaCode" runat="server" MaxLength="2" Width="40px" /&gt; &lt;asp:ListBox ID="lsMediaCodes" runat="server" Width="296px" /&gt; </code></pre> <p>Jquery</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $('#txtMediaCode').keyup(function () { if ($('#txtMediaCode').length &gt; 1) { $('#lsMediaCodes').each(function (i, option) { if ($(option).val() == $('#txtMediaCode').val()) { $(option).attr('selected', 'selected'); } }); } }); }); &lt;/script&gt; </code></pre> <p>Does anyone have any suggestions?</p>
jquery asp.net
[5, 9]
2,953,031
2,953,032
What type of data can be stored in cookies?
<p>I am learning ASP.net using C# and I would like to know if we can store data other than strings, in cookies, like date/time or decimal or double.</p>
c# asp.net
[0, 9]
4,576,751
4,576,752
Tracking mouse movements
<p>This should be typically easy, I want to perform tracking of mouse movements. I'm capable of capturing the XY co-ords. </p> <p>However, as far as I'm aware, this will vary according to the browser size, right ? </p> <p>If so, can anyone recommend other things to track to ensure my results are accurate? </p> <p>P.s I'm using the following Jquery example</p> <pre><code>$("html").mousemove(function(e){ var pageCoords = "( " + e.pageX + ", " + e.pageY + " )"; var clientCoords = "( " + e.clientX + ", " + e.clientY + " )"; $("span:first").text("( e.pageX, e.pageY ) - " + pageCoords); $("span:last").text("( e.clientX, e.clientY ) - " + clientCoords); }); </code></pre>
javascript jquery
[3, 5]
5,056,966
5,056,967
What's the difference between jQuery.bind() and jQuery.on()?
<p>And why is .on() now preferred in jQuery 1.7?</p>
javascript jquery
[3, 5]
5,275,116
5,275,117
How to pass multiple checkboxes to PHP through JQUERY
<p>I HAVE modified my code, i used firebug console.log to detect weather the the php gets the array passed or not. and firebug displays this - rescheck[]=2&amp;rescheck=1&amp;rescheck=3</p> <p>I think php gets the array if THATS what an array in php supposed to be like.</p> <p>SO guys, if thats correct how to insert that array in database? or how to loop it? the foreach loop ive made didnt work.</p> <p>JQUERY CODE:</p> <pre><code>$('#res-button').click(function (){ var room_id=$('[name=rescheck[]]:checked').serialize().replace(/%5B%5D/g,'[]'); alert(room_id); $.ajax({ type: "POST", url: "reservation-valid.php", data: {name_r:name_r, email_r:email_r,contact_r:contact_r,prop_id:p_id,cvalue:room_id}, success: function(data) { console.log(data); } }); }); &lt;input type="checkbox" name="rescheck[]" value="&lt;?php echo $roomid; ?&gt;" /&gt; </code></pre> <p>PHP CODE:</p> <pre><code>$c_array=$_POST['cvalue']; echo $c_array; //foreach($c_array as $ch) //{ //$sql=mysql_query("INSERT INTO reservation VALUES('','$prop_id','$ch','$name_r','$contact_r','$email_r','')"); //} </code></pre> <p>I think I managed my jquery code to be right, but I don't know how to fetch that with PHP. </p>
php jquery
[2, 5]
5,847,952
5,847,953
Count length of an array and create the same amount of HTML elements with JS/jQuery
<p>Is it possible to query the length of an array and then use JS/jQuery to create the same amount of new HTML elements client side?</p> <p>The code I have for the array is:</p> <pre><code>var psC1 = [ 'item1', 'item2', 'item3' ]; alert(psC1.length); </code></pre> <p>Which will alert that there's 3 items in the array. I now want to create three iframes on the page, and index the array into the src attribute of each element. </p> <p>The code I'd use to insert the src of the iframes using the array would be:</p> <pre><code> $('.test-iframe').each(function() { $(this).attr('src', psC1[$(this).index()]); }); </code></pre> <p>What I'm struggling with is after counting the array, is creating three iframes with JS/jQuery.</p>
javascript jquery
[3, 5]
3,444,764
3,444,765
how to render a .htm page into .aspx page
<p>i have aspx page which has to render .htm page how can it be done</p> <p>if possible then i want added feature that is i want to call a JavaScript after that .htm page is rendered</p> <p>pls help</p>
javascript asp.net
[3, 9]
5,886,373
5,886,374
understand inherit abstract method in java
<p>I'm new to Java but not to programming. I'm reading the book "Beginning Android Games" and there is an <a href="http://code.google.com/p/beginning-android-games/source/browse/trunk/ch06-mrnom/src/com/badlogic/androidgames/framework/impl/AndroidGame.java" rel="nofollow">abstract class</a> that gets instantiate <a href="http://code.google.com/p/beginning-android-games/source/browse/trunk/ch06-mrnom/src/com/badlogic/androidgames/framework/impl/AndroidFastRenderView.java" rel="nofollow">here</a> (line 10) and i cant understand how can you instantiate an abstract class ?.</p> <p>the class is abstract because it inherits an abstract method from class Game (implements Game).</p>
java android
[1, 4]
797,166
797,167
Can't find the way to move an image (or others clickable objects)
<pre><code> public class FirstTest extends Activity { public FirstTest() { // TODO Auto-generated constructor stub } RelativeLayout currentLayout; static int[] Deck = { R.drawable.img1, R.drawable.img2, R.drawable.img3, R.drawable.img4 }; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); currentLayout = new RelativeLayout(this); for (int i = 0; i &lt; Deck.length; i++) { ImageButton img = new ImageButton(this); img.setPadding(0, 0, 0, 0); img.setImageResource(Deck[i]); img.setAdjustViewBounds(true); img.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub // BUT HOW MOVE THIS BUTTON???? } }); currentLayout.addView(img); } setContentView(currentLayout); } } </code></pre> <p>Maybe it's trivial for others, but I just found width and height property modifiers. After trying a lot of examples I gave up.</p> <p>How can I move something? Why can't I find x y properties?</p>
java android
[1, 4]
981,521
981,522
DNS setup Impact the AD authentication in C#
<p>Since I saw lot of posts about the exception which is shown below, And most of guys were stuck with it painfully.</p> <pre><code>Exception Message: "The server is not operational" Source: "System.DirectoryServices" </code></pre> <p>Recently It happened on me. But finally I figure it out .I thought I should share my experience here so that in future it could be helpful for someone else who has the same problem as me. </p> <p>The program I was working with is using AD authentication. And it works fine in my computer which belongs to the AD Domain. The code is below.</p> <pre><code> public static bool IsAuthenticated(string srvr, string usr, string pwd) { bool authenticated = false; try { DirectoryEntry deRoot = new DirectoryEntry(srvr); DirectoryEntry entry = new DirectoryEntry(srvr, usr, pwd); object nativeObject = entry.NativeObject;//this will cause exception Until setting the right DNS address. authenticated = true; } catch (DirectoryServicesCOMException cex) { //not authenticated; reason why is in cex HttpContext.Current.Response.Write(cex.Message); } catch (Exception ex) { //not authenticated due to some other exception [this is optional] HttpContext.Current.Response.Write(ex.Message); } return authenticated; } </code></pre> <p>One day as our IT environment requirement changed, My computer IP is switched from 10.50.70.64 to 169.254.135.249. Because my net adapter IP and DNS always set to <code>Obtain address automatically</code>.In this case , I can log in my computer using the AD account successfully. But the program run with a big fat exception. So I doubted if there is something wrong with my Net Adapter settings. Finally I found If I set the right DNS address of our IT environment. The Exception was gone. I don't know why. So I also hope someone can explain more about it. Thanks.</p>
c# asp.net
[0, 9]
5,037,935
5,037,936
How do I check if attribute is empty?
<p>I have a few select menus that include blank options. When both are blank (usually on the first page load), I would like to show some hidden div.</p> <p>This is what I have:</p> <pre><code> $('.variant_options select').each(function() { if ($(this).attr('value') === '') { // some code here to show hidden div console.log("No options chosen"); } }); </code></pre> <p>This doesn't seem to work.</p> <p><strong>Edit 1</strong></p> <p>For what it's worth, I have tried something like this:</p> <pre><code> if (!$(this).attr('value')) </code></pre> <p>And that has seem to KINDA work, but it breaks functionality elsewhere.</p>
javascript jquery
[3, 5]
946,164
946,165
"Syntax error, unrecognized expression" error whilst using jQuery. What am I doing wrong?
<p>I have <a href="http://google.com/search?q=Syntax+error,+unrecognized+expression" rel="nofollow">Googled this exception</a>, and it seems to mostly boil down to people using the old <code>option[@select]</code> style attribute selector.</p> <p>My problem, however, is a little different.</p> <p>When I get the error, there is no line number being attributed to it.</p> <p>I think it has something to do with the hashes I am using for my page.</p> <p>I have tried a lot of <code>console.log()</code>, etc, but haven't been able to figure it out.</p> <h3>Neccessary links</h3> <ul> <li><a href="http://airsolar.com.au/~new/air-solar-in-you-area" rel="nofollow">Site</a></li> <li><a href="http://airsolar.com.au/~new/assets/js/common.js" rel="nofollow">JavaScript</a></li> </ul> <p>Click on one of the entries on the left, allow it to load, and then refresh your browser and observe the console.</p> <p>It is happening in Firefox and Safari.</p> <p>What am I doing wrong?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
4,660,230
4,660,231
JavaScript alert not working in Android WebView
<p>In my application I am using WebView and in that I am using JavaScript alert( ) method but its not working, no pop-up appears.</p> <p>in my manifest file I have added </p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET"&gt;&lt;/uses-permission&gt; </code></pre> <p>and in activity file I have added </p> <pre><code>mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); mWebView.loadUrl("file:///android_asset/demo.html"); </code></pre> <p>In layout xml file I have added</p> <pre><code>&lt;WebView android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; </code></pre> <p>Any clue how to enable full JavaScript in WebView.</p> <hr> <p><strong>Update</strong></p> <p>Thanks mark<br> the alert() method in the html file are working now :) .</p> <p>Now there are two issues in WebView : 1: I am using a in the html file that i am loading in WebView , and trying to write in Hindi language font in it, but when i try to write Hindi text it displays as symbols ( rectangle symbols like [] ) .</p> <p>when i do the same in firefox browser on desktop it works fine. any clue how to give support for multiple language in textarea in WebView ?</p> <p>2: When I am clicking submit and trying to open the value of text in alert() method in another java script it doesn't work , does it mean even after using WebChromeClient its applicable only for current loaded html page and not java scripts called from that page ? </p>
javascript android
[3, 4]
2,715,596
2,715,597
jQuery: Issue Using Bind & Click Methods
<p>Any idea why this click event isn't working? (I'm sure the answer is obvious - I'm just not seeing it).</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('h1').bind('click', function(){ alert('clicked'); }); )}; &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;This is a test.&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>EDIT: @Stefan: thanks for catching this typo. I need to remember to have firebug open next time. Thanks for suggesting jsfiddle.net. Looks like a cool site.</p>
javascript jquery
[3, 5]
1,530,106
1,530,107
Calling Javascript on a loaded site
<p>How would I call a function in Javascript on a loaded site in a Windows Form Application web browser? For those that have used Chrome, I'm looking to call Javascript like you can with the Javascript console.</p>
c# javascript
[0, 3]
3,219,991
3,219,992
jQuery hide/reveal image banner
<p>I am hoping someone can provide assistance with a jQuery issue I have. I have been asked to produce a banner which hides/reveals part of an image or div. I am a designer who's skills are limited to HTML and CSS and have no great experience in coding jQuery.</p> <p>The overall banner is 100% in width split into two equal 50% portions, both images have an overlay caption which doubles as a link.</p> <p>Upon clicking the linked caption, 75% of the image is then shown, overlaying 25% of the other image, this will be the same for both sides of the banner.</p> <p>The mark up I have for the banner is:</p> <pre><code> &lt;div class="home-banner-left"&gt; &lt;img src="home-left.jpg" /&gt; &lt;div class="home-overlay-left"&gt; &lt;h1&gt; &lt;a href="page.html"&gt;This is a link&lt;/a&gt; &lt;/h1&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="home-banner-right"&gt; &lt;img src="home-right.jpg" /&gt; &lt;div class="home-overlay-right"&gt; &lt;h1&gt; &lt;a href="page2.html"&gt;This is a link&lt;/a&gt; &lt;/h1&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Any help would be greatly appreciated. Please ask if further information is needed.</p>
javascript jquery
[3, 5]
5,975,926
5,975,927
PHP code to open new resized window
<p>I am not very well versed in PHP code, but I have an overall goal I hope someone can help me with. I have this code snippet from my site:</p> <pre><code>$show = false; if($this-&gt;_general['post_ci_linkedin_show']) { $url = urlencode(get_permalink($post-&gt;ID)); $title = urlencode($post-&gt;post_title); $source = urlencode(get_bloginfo('url')); $surl = $this-&gt;_general['post_ci_linkedin_url']; $surl = str_replace('[%url]', $url, $surl); $surl = str_replace('[%title]', $title, $surl); $surl = str_replace('[%source]', $source, $surl); $out .= '&lt;a class="icon" href="'.$surl.'" rel="LinkedIn"&gt;&lt;img class="unitPng" src="'.get_bloginfo('template_url').'/img/icons/community/comm_LinkedIn.png" /&gt;&lt;/a&gt;'; $show = true; } </code></pre> <p>Which produces:</p> <pre><code>src="http://www.websitename.com/subpage/mypage" </code></pre> <p>It produces other things obviously, like rel="blah" and such, but this is the part I want to tweak.</p> <p>I want to change the PHP code snippet above so that the end result is:</p> <pre><code>href="javascript:void window.open('http://www.websitename.com/subpage/mypage','', 'height=700,width=500');" </code></pre> <p>I am just not sure of which parts of this code to change to get this result, I have tried just pasting it around the <code>.$surl.</code> but it gave me an error on my whole page.</p> <p>Thanks!</p>
php javascript
[2, 3]
2,243,768
2,243,769
split the message into array
<pre><code>RadikalGenc.aspx?phonenumber=5552451245&amp;message=ISTAN-ALL-123;Emly,Foz,Praia,Sol,Luna,Trabalha string number = Request.QueryString["phonenumber"].ToString(); string textMessage = Request.QueryString["message"].ToString(); </code></pre> <p>I need the textMessage splitted int array Like this:</p> <p>ISTAN-ALL-123 -> <em>Presents Form name</em> <strong>The list below, presents the fiels name</strong></p> <ol> <li>Emly </li> <li>Foz </li> <li>Praia </li> <li>Sol </li> <li>Luna </li> <li>Trabalha</li> </ol> <p>how can do that?</p>
c# asp.net
[0, 9]
1,159,408
1,159,409
how to get click event of asp linkbutton which is created using literal?
<p>I dynamically created linkbutton using literal in csharp. i want its click event.</p> <pre><code>for (int i = 0; i &lt; dataset.Tables[0].Rows.Count; i++) { Literal literal = new Literal(); literal.Text = @" &lt;asp:LinkButton runat='server' ID='addtocart' Text='' OnClick='addtocart_Click'&gt;&lt;img src='images/cart.gif' alt='' title='' border='0' class='left_bt' /&gt;&lt;/asp:LinkButton&gt;"; div.Controls.AddAt(0, lit); } </code></pre> <p>i try to make event like </p> <pre><code>protected void addtocart_Click(object sender, EventArgs e) { } </code></pre> <p>but not working.....! please tell me how its click event will generate.</p> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
2,270,336
2,270,337
Trying to fetch values on gridview
<p>I am trying to fetch values on a GridView with the following code:</p> <pre><code>protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = GridView1.SelectedRow; string Username = row.Cells[3].Text; string Password = row.Cells[4].Text; string Email = row.Cells[5].Text; string ID_Inscricao = row.Cells[1].Text; SqlConnection sqlConn = new SqlConnection( ConfigurationManager.ConnectionStrings["FormacaoConnectionString"].ToString()); SqlCommand sqlComm = new SqlCommand(); sqlComm = sqlConn.CreateCommand(); sqlComm.Parameters.Add("@Username", SqlDbType.Text); sqlComm.Parameters.Add("@Password", SqlDbType.Text); sqlComm.Parameters.Add("@Email", SqlDbType.Text); sqlComm.Parameters.Add("@ID_Inscricao", SqlDbType.Text); sqlComm.Parameters["@Username"].Value = Username; sqlComm.Parameters["@Password"].Value = Password; sqlComm.Parameters["@Email"].Value = Email; sqlComm.Parameters["@ID_Inscricao"].Value = ID_Inscricao; string sql = "INSERT INTO Utilizadores " + "(Username, Password, Email,ID_Inscricao) " + "VALUES (@Username, @Password, @Email, @ID_Inscricao)"; sqlComm.CommandText = sql; sqlConn.Open(); sqlComm.ExecuteNonQuery(); sqlConn.Close(); } </code></pre> <p>So, the problem is I can't get the values from the GridView, but instead get a "NullReferenceException was unhandled by user code". Can anybody tell me what I'm doing wrong?</p> <p>Best regards</p>
c# asp.net
[0, 9]
1,515,170
1,515,171
detect java not installed and provide a link from Javascript
<p>I have this panorama viewer that makes use of java, </p> <p>but when trying to acces from firefox and java not installed, it warns that some plugin is needed but it doesn't specify whitch one or where to download if from...</p> <p>So, can i, from javascript, detect if user hasn't installed java and provide him with a download link?</p>
java javascript jquery
[1, 3, 5]
2,473,344
2,473,345
Jquery .html, Firefox encodes qoutes in attributes
<p>I have a hotfix app which generates HTML slides. The modules are built in Jquery with the background as inline CSS (the best solution i could come up with since they are unique per instance). </p> <p>The problem is that firefox converts the quotes in the style attribute into:</p> <pre><code>&lt;div style="background-image: url(&amp;quot;bigspace-template.jpg&amp;quot;);" class="nuiOpenspace t1 skin1"&gt; </code></pre> <p>The webkit browsers have no issues with this.</p> <p>demo: <a href="http://www.greenpeace.cc/p3/nui/" rel="nofollow">http://www.greenpeace.cc/p3/nui/</a></p> <p>the script: <a href="http://greenpeace.cc/p3/nui/js/nui.builder.js" rel="nofollow">http://greenpeace.cc/p3/nui/js/nui.builder.js</a></p> <p>They only way i have been able to get the background attribute is by:</p> <pre><code>// Build function, shortened openspace.build = function(){ // ... var bgstr = 'background-image: url('+ this.val_image + ')'; $o = $('&lt;div class="nuiOpenspace"&gt;&lt;/div&gt;').attr('style', bgstr); // ... } </code></pre> <p>This is then output appended to the document:</p> <pre><code>function Sandbox(){ var $sandbox = $("#sandbox"); this.fill = function(o) { $sandbox.empty(); $sandbox.append(o); }; // ... } </code></pre> <p>I then get the HTML from the dom, convert to string and then output it in a textarea:</p> <pre><code>function Source(){ this.print = function(o, c_val){ //var parsed_html = this.parse(o, c_val); //var pretty_html = ""; //pretty_html = style_html( parsed_html ); //console.info(x.replaceAll('&amp;qout;', 'x')); $code.text( style_html($("#sandbox").html()) ); }; } var source = new Source(); </code></pre> <p>I´ve tried search and replace but firefox keeps changing to / adding &quot;. Any ideas?</p>
javascript jquery
[3, 5]
3,778,984
3,778,985
Java Generics: Why does an explicit cast cause a compiler error, but variable assignment does not
<p>This block compiles properly:</p> <pre><code>ArrayList&lt;Baz&gt; list = savedInstanceState.getParcelableArrayList("foo"); bar(list); </code></pre> <p>But this block errors stating that <code>ArrayList&lt;Parcelable&gt;</code> can not be cast to <code>ArrayList&lt;Baz&gt;</code>:</p> <pre><code>bar((ArrayList&lt;Baz&gt;)savedInstanceState.getParcelableArrayList("foo")) </code></pre> <p>Where bar is of the form:</p> <pre><code>private void bar(ArrayList&lt;Baz&gt; food) { } </code></pre> <p>And <code>Baz</code> is a class that implements the <code>Parcelable</code> interface</p> <p>Is there a way that the direct cast can be done rather than having to perform an implicit cast and create an unnecessary variable?</p>
java android
[1, 4]
4,403,609
4,403,610
Jquery dialog to open multiple windows
<p>I'm trying to make system of multiple dialogs in one page using jquery dialog... </p> <p>Functions looks like... </p> <pre><code> function open_w(id){ $('.opened').dialog('close'); $(id).addClass('opened'); $(id).dialog({position: 'center', modal:true, width: '750px' }); }; function close_w(){ $('.opened').dialog('close'); $('.opened').removeClass('opened'); }; </code></pre> <p>As you see passing the ID opens me that windows, but before open close me old windows.. When i open it fist time everything is good.. But Next time it's doesn't want open</p> <p>Where is mistake?</p>
javascript jquery
[3, 5]
3,930,873
3,930,874
javascript error
<pre><code>var a=asdf; var b=asdfs; //var a = new String("asdf"); if (a.equals(b)) { $("#package").show(); } else { $("#package").hide(); } }); </code></pre>
javascript jquery
[3, 5]
4,793,196
4,793,197
TableRow with two TextView in separate line
<p>I have the following code:</p> <pre><code>TextView name = new TextView(this); name.setText(venues.get(j).name); name.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); TextView address = new TextView(this); address.setText(venues.get(j).getFullAddress()); address.setLayoutParams(new LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); /* Add Button to row. */ tr.addView(name); tr.addView(address); </code></pre> <p>And now it gives me a layout like this:</p> <p><img src="http://i.stack.imgur.com/0nCnA.png" alt="enter image description here"></p> <p>I want the TextView to be in separate lines. How do I do this?</p>
java android
[1, 4]
3,004,202
3,004,203
Import ordering of js file
<p>A library is imported on a jsp file : </p> <pre><code>&lt;script type="text/javascript" src="mylibrary.js"&gt;&lt;/script&gt; </code></pre> <p>Code is then executed further in the .jsp which requires this library : </p> <pre><code>&lt;script type="text/javascript"&gt; //various calls take place to myLibrary.js &lt;script&gt; </code></pre> <p>I want to extract the javascript functions/function calls into an external .js file. So replace : </p> <pre><code>&lt;script type="text/javascript"&gt; //various calls take place to myLibrary.js &lt;script&gt; </code></pre> <p>with : </p> <pre><code>&lt;script type="text/javascript" src="newfile.js"&gt;&lt;/script&gt; </code></pre> <p>Where 'newfile.js' contains the functions/function calls.</p> <p>Does this mean I will need to import "mylibrary.js" within "newfile.js" ?</p> <p>What is the import ordering of javascript/jquery ?</p>
javascript jquery
[3, 5]
1,142,438
1,142,439
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]
4,723,087
4,723,088
jQuery Tooltip not working with detach(), appendTo, etc?
<p>I'm trying to use this jQuery Tools <a href="http://flowplayer.org/tools/tooltip/index.html" rel="nofollow">ToolTip widget</a>.</p> <p>It works great in a situation like this:</p> <pre><code> ... &lt;a id="A1"&gt;trigger&lt;/a&gt; &lt;script&gt; $(document).ready(function () { $("#trigger").tooltip({ effect: 'slide' }); }); &lt;/script&gt; ... </code></pre> <p>But this will not work and it's what i want to do:</p> <pre><code>$("&lt;a id='trigger'&gt;trigger&lt;/a&gt;").appendTo("body"); //console.log(myTrigger); $("#trigger").tooltip({ effect: 'slide' }); $("#trigger").tooltip().show(); </code></pre> <p><strong>Can i dynamically add the trigger element so i can place the tooltip wherever i want? If so, how?</strong></p>
javascript jquery
[3, 5]
3,510,902
3,510,903
How to retrieve already shorted URLs from Bitly API
<p>I have thousands of Long URLs that were shortened with the Bitly API. I know wish to store those shortened URLS in a database. Does any one knows how to retrieve the already shortened Bitly URL from a long URL?</p>
c# asp.net
[0, 9]
2,670,593
2,670,594
What is the difference between .length and [0] to check if an element with an ID exists
<p>I have seen two ways to check if an element with a specific ID exists on the page and I was wondering why the second way works.</p> <p>One way I have seen is the following and I think I understand it:</p> <pre><code>if ( $('#elementID').length &gt; 0 ) { //Do something } else { //Do something else } </code></pre> <p>Another way I have seen this done that I do not quite understand is the following:</p> <pre><code>if ( $('#elementID')[0] ) { //Do something } else { //Do something else } </code></pre> <p>What does the [0] mean? I normally see [...] used for array's so is this returning an array?</p> <p>Thank you.</p>
javascript jquery
[3, 5]
4,868,666
4,868,667
PHP to Python Code Differences - Arrays, Foreach Loops
<p>I hope this question is phrased appropriately to the policies of this site.</p> <p>I am trying to convert a piece of Python Code to PHP code. I have gotten almost every function translated except I cannot figure out how Arrays and Foreach loops are different in PHP vs Python. </p> <pre><code>qstid = dbinputsurveyid+'X'+str(question.gid)+'X'+str(question.qid) index=columns.index(qstid) for i,a in enumerate(data[index]): if a!=None and a!='': answer=int(data[index][i]) answerCodes=list(answersCode[question.qid]) answerindex = answerCodes.index(str(answer)) answerorder = answersOrder[question.qid][a] addAnswers(db, data[0][i], question.sid, question.gid, question.qid, question.type, answers[question.qid][answerindex], None,answerorder, None, None,None) </code></pre> <p>From some of the reading I have done. I think enumerate in python is the equivalent to a foreach loop in PHP. But im not sure how "i" and "a" come into play in the code above. They dont seem to be defined like you would in PHP. Any help or insight is appreciated.</p>
php python
[2, 7]
437,610
437,611
Problem refresh in asp.net
<p>I create Button. Add event Click. in event function AddToDataBase.</p> <p>I press Button, event work, run function - data good add to database.</p> <p>more I press F5 event wirk and function AddToDataBase start working.</p> <p><strong>It is not correct. how to fix it?</strong></p>
c# asp.net
[0, 9]
3,442,039
3,442,040
Getting error: String reference not set to an instance of a String. Parameter name: s (asp.net c#)
<p>I am using this code to truncate datetime from my database into its year and time components. The variables YearOfRelease and Runtime contain datetime of the format "dd/MM/yyyy hh:mm:ss" It was working fine previously but its now giving the error: </p> <p><strong>String reference not set to an instance of a String. Parameter name: s</strong></p> <p>It could only be something wrong in the DateTime.ParseExact function, could anyone please let me know why 'null' is suddenly causing this problem when previously it was working perfectly?</p> <pre><code> DateTime dt2 = new DateTime(); dt = DateTime.ParseExact(YearOfRelease, "dd/MM/yyyy hh:mm:ss", null); Year = dt.Year.ToString(); dt2 = DateTime.ParseExact(RunTime, "dd/MM/yyyy hh:mm:ss", null); string hour = dt2.Hour.ToString(); string min = dt2.Minute.ToString(); Time = hour + ":" + min; </code></pre>
c# asp.net
[0, 9]
3,865,973
3,865,974
What is the optimal way to share code between Activities with different base classes?
<p>I have the following problem:<br> I have an abstract <em>Activity</em> class, lets call it <em>MyAbstractActivity</em>, that contains some code I'd like to reuse (for example: a standard service binder, common menu items, common initialization code, etc. etc.). Normally I would just use it to subclass my concrete activities and be done with it.</p> <p>However, I occasionally need to use another supertype, such as a <em>ListActivity</em> or a <em>MapActivity</em>.</p> <h2>So the question is: how do I avoid duplicating that support code within an Activity, if I have to use another base class?</h2> <p>I have thought up of a solution based on the decorator pattern, like this one:<br> <a href="http://i.stack.imgur.com/1t906.png" rel="nofollow">LINK TO DIAGRAM</a>.</p> <p>However, I see a problem with this approach: What to do with protected methods (like <em>onCreate()</em>)? Should I introduce an additional "bridge" class that makes them public for the purpose of the decorator, similarly to the way presented below (starting to look a bit byzantine...)?<br> <a href="http://i.stack.imgur.com/2mVao.png" rel="nofollow">LINK TO DIAGRAM</a><br> Any other way?</p> <p>I hope I made myself relatively clear. Thanks in advance for any feedback!</p> <p>PS. Using static utility classes is not a good solution in my opinion, since it introduces a possibility of hard-to-identify programming bugs.</p>
java android
[1, 4]
124,580
124,581
how to load jquery and other javascript file
<p>This is my first time using lightbox which uses jquery framework. But when I paste jQuery and Lightbox javascript files into my html page, my current javascript code doesn't work properly. Is the way I set them up wrong? Thank you. This is the order I put my js files </p> <p>the error I got is:<br> Uncaught TypeError: Object [object Object] has no method 'dispatchEvent' prototype.js:5734<br> Edit:</p> <pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="random.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/jquery-1.7.2.min.js"&gt;&lt;/script&gt; &lt;script src="load-poll.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/lightbox.js"&gt;&lt;/script&gt; </code></pre> <p>And this is the beginning of my own js file as the page loads:</p> <pre><code>var POLL_WIDTH = 200; document.observe("dom:loaded", function() { if ($("favChar")){ fetchPoll("favChar"); }else if ($("favVoice")){ fetchPoll("favVoice"); }else if ($("CMTvote")){ fetchPoll("CMTvote"); }else if ($("BLdesign")){ fetchPoll("BLdesign"); } }); </code></pre>
javascript jquery
[3, 5]
3,162,588
3,162,589
TelephonyManager.getDeviceId() returns a constant value?
<p>I'm generating a key for obfuscate information. </p> <p>That key must change between devices so for the generation I was using:</p> <ul> <li><code>Secure.getString(getContentResolver(), Secure.ANDROID_ID)</code></li> <li><code>TelephonyManager.getSimSerialNumber()</code></li> <li><code>TelephonyManager.getDeviceId()</code></li> <li>A random persistent String generated if all of the options above are <code>null</code></li> </ul> <p>But testing I realised that since <strong>TelephonyManager.getSimSerialNumber()</strong> changes with the SIM in the device (and in airplane mode always return null) the key also changes and the obfuscated data cant be recovered.</p> <p>My question is: Does <strong>TelephonyManager.getDeviceId()</strong> return always the same value (null or a value but always the same result)?</p> <p>Note: I tested and it returns a valid value for me even in "Airplane mode"</p>
java android
[1, 4]
1,233,312
1,233,313
Passing parameters to jQuery function via link
<p>I have a jQuery function:</p> <pre><code>$(function(){ function InitDialog(c,b){ /* some code */ } $('a[name=dialog]').click(function(e) { InitDialog(caption, bodyText); fadeInCommon(e,this); }); }); </code></pre> <p>And also I have a link defined in html code like below:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="#dialog" name="someInformation" }"&gt;something&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>My question is how can I pass the parameters (caption, bodyText) to Init() function via link? I've heard about some method like below:</p> <pre><code>&lt;li&gt;&lt;a href="#dialog" name="someInformation" onClick="return {height: 100, width:200};"}"&gt;something&lt;/a&gt;&lt;/li&gt; </code></pre> <p>But I don't understand how can I get and parse it? Thanks</p>
javascript jquery
[3, 5]
2,136,928
2,136,929
position of div in particular div
<p>i have one card window div in which</p> <pre><code> &lt;div id="cards_window" class="popup_window ui-dialog ui-corner-all" title="Cards"&gt; &lt;div id="cards_title"&gt; Cards &lt;div id="cards_window_close" class="ui-button ui-icon ui-icon-circle-close popup_close"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id="cards"&gt; &lt;div id="cards_pending"&gt;&lt;h3&gt;Cards Pending&lt;/h3&gt;&lt;/div&gt; &lt;div id="cards_received"&gt;&lt;h3&gt;Cards Received&lt;/h3&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>i am rendering in this the my all cards instances at particular positions and i want pending card to be in position in pending div and recievend in the received div for that what i should do but i am getting the div scattereed in the complete cards div.</p>
javascript jquery
[3, 5]
1,868,291
1,868,292
How can I scroll to the div automatically when I click the button?
<p>I Have a button at the top, 4 tables in the middle and a div (id="MasterDiv") on the bottom of a page. How can I scroll to the div automatically when I click the button? Thanks</p>
javascript jquery
[3, 5]
2,053,530
2,053,531
How to append elements into dom in one go
<p>How do I append elements into the dom in one go? As you can see from the code below I'm appending stuff into a root element(tr_next) inside a loop.</p> <pre><code>$('.abc').each(function(){ //create element code here var tr_next = $("&lt;tr&gt;"); var td_contact_fname = $("&lt;td&gt;").attr({"width" : "190px" , "align" : "center"}); td_contact_fname.appendTo(tr_next); td_contact_lname.appendTo(tr_next); td_month.appendTo(tr_next); td_day.appendTo(tr_next); td_email.appendTo(tr_next); }); </code></pre> <p>I've watched this video at vimeo: <a href="http://vimeo.com/44182484" rel="nofollow">How browsers work internally</a> and they said that when appending stuff into the dom you should do it in one go because the browser needs to perform a lot of repainting(or something like that) which affects performance.</p>
javascript jquery
[3, 5]
2,534,154
2,534,155
jQuery cannot see a dynamic element?
<p>I've a simple code as following:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;div id="div1"&gt; &lt;input class="input1" type="text" value="click me 1" /&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; $('.input1').click( function() { alert('clicked'); }); $('#div1').append('&lt;input class="input1" type="text" value="click me 2" /&gt;'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I found that the 2nd textbox, which was appended to the "#div1", didn't get the click respond which is associated to the class "input1". </p> <p>what am I missing? please advise me, thank you very much.</p>
javascript jquery
[3, 5]
1,932,644
1,932,645
what is the best way to make sure javascript is running when page is fully loaded?
<p>I am trying to run my javascript in my asp.net webform page but I am not sure it runs properly because all the elements are not loaded yet. How can I make sure my script is at the very bottom of the page with using jquery? So it can run when the page is loaded?</p>
javascript jquery asp.net
[3, 5, 9]
2,239,035
2,239,036
How to send clientid of asp.net control via JavaScript
<p>I am trying to send the control id on button click in my following asp.net code:</p> <pre><code> &lt;asp:TextBox ID="empid" runat="server" CssClass="input_box" onFocus="if (this.value == this.title) this.value='';" onBlur="if (this.value == '')this.value = this.title;" value="Enter employee ID" title="Enter employee ID" onClick="changecol(this)"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="abc" runat="server" Text="xxx" CssClass="submit_button" onclick="abc_Click" OnClientClick="return checkEmpid('&lt;%=empid.ClientID%&gt;')"/&gt; </code></pre> <p>and Javascript is:</p> <pre><code>function checkEmpid(id){ var idValue = document.getElementById(id).value; alert(idValue); return false; } </code></pre> <p>In alert I am getting null while when I use following code:</p> <pre><code>&lt;asp:TextBox ID="empid" runat="server" CssClass="input_box" onFocus="if (this.value == this.title) this.value='';" onBlur="if (this.value == '')this.value = this.title;" value="Enter employee ID" title="Enter employee ID" onClick="changecol(this)"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="abc" runat="server" Text="xxx" CssClass="submit_button" onclick="abc_Click" OnClientClick="return checkEmpid()"/&gt; function checkEmpid(){ var idValue = document.getElementById('&lt;%=empid.ClientID%&gt;').value; alert(idValue); return false; } </code></pre> <p>In alert I got value entered in text box. Please help me in solving this problem I want to send clientid of control as parameter for JS.</p> <p>Thanks in advance.</p>
javascript asp.net
[3, 9]
1,623,004
1,623,005
how to do fadeout in jquery asp.net
<p>I have the below ASP.NET code. When I click on the button, for one or two times at the beginning, the text inside the div <strong>div1</strong> was disappearing for a moment, and was displayed again. But then, when I try it now, it never disappears. The text inside the div just stays.</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script type="text/javascript" src="jquery-1.8.3.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready( function () { $("#div1").css("color", "red"); $("#btn").click(function () { $("#div1").fadeOut("slow"); }); }); &lt;/script&gt; </code></pre> <p></p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div class="ab" id="divTest" runat="server"&gt;test&lt;/div&gt; &lt;asp:Button ID="btn" runat="server" Text="GET" /&gt; &lt;div id="div1" runat="server"&gt; &lt;div&gt;test new &lt;/div&gt; &lt;div id="divTestArea1"&gt; &lt;b&gt;Bold text&lt;/b&gt; &lt;i&gt;Italic text&lt;/i&gt; &lt;div id="divTestArea2"&gt; &lt;b&gt;Bold text 2&lt;/b&gt; &lt;i&gt;Italic text 2&lt;/i&gt; &lt;div&gt; &lt;b&gt;Bold text 3&lt;/b&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p> </p>
jquery asp.net
[5, 9]
546,634
546,635
How to disable the onmousedown function using jQuery?
<p>HTML: &lt;<code>td class="ewPointer" onmousedown="ew_Sort(event,'sampple.asp?order=brgy%5Fid&amp;amp;ordertype=ASC',1);"&gt;</code></p> <p>I just want to disable the onmousedown function and replace it with my jquery function.</p> <p>I used this code but didn't work.</p> <pre><code>$('.ewPointer').live('click',function(e) {e.preventDefault(); }); </code></pre> <p>Is there a way?</p> <p>Thanks</p> <p>(I'm using that source page in my ajax function.)</p>
javascript jquery
[3, 5]
4,602,798
4,602,799
How to use jquery with variable assigned
<p>How can I use a variable in jQuery. as you see in script snippet, I assign a variable "divname" with value, and when i use 'Jquery" to fade out. it is not working. What I really need is, when image is hover, the description will be show up as fading in, when mouse is gone, the the description should be gone. thanks in advance. </p> <p>Script snippet</p> <pre><code> $j('.img_nofade').hover(function(){ $j(this).animate({opacity: .5}, 300); var i = $j(this).attr('titlename'); var divname = "'#titleID" + i + "'"; //alert (divname); $j(divname).fadeIn(); }, function(){ $j(this).animate({opacity: 1}, 300); $j(divname).fadeOut(); } ); </code></pre> <p>HTML code</p> <pre><code> &lt;img class="img_nofade' src="image-1.gif" titleid='1" /&gt; &lt;div id="titleID1"&gt;my image title 1 &lt;/div&gt; &lt;img class="img_nofade' src="image-2.gif" titleid='2" /&gt; &lt;div id="titleID2"&gt;my image title 2 &lt;/div&gt; &lt;img class="img_nofade' src="image-3.gif" titleid='3" /&gt; &lt;div id="titleID3"&gt;my image title 3 &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,562,845
5,562,846
how to prevent dublicate record on run time
<p>This code cause double record... i checked my insert code for all tables and it works fine...</p> <p>and this is insert code:</p> <pre><code> StoreDO store = new StoreDO(); List&lt;BrandDO&gt; brandList = new BrandBL().SelectBrands(); StoreBL storeBL = new StoreBL(); store.StoreName = txtStoreName.Text; store.StorePhone = txtStorePhone.Text; store.StoreAddress = txtStoreAddress.Text; store.CityID = int.Parse(ddlCity.SelectedValue); store.CountyID = int.Parse(ddlCounty.SelectedValue); store.IsActive = chkIsActive.Checked; int storeID = storeBL.InsertStore(store); ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1"); for (int i = 0; i &lt; brandList.Count; i++) { string brandName = brandList[i].BrandName.ToString() + brandList[i].BrandID.ToString(); StoreBrandBL storeBrandBL = new StoreBrandBL(); CheckBox chkBrand = (CheckBox)contentPlaceHolder.FindControl(brandName); if (chkBrand != null) { if (chkBrand.Checked) { StoreBrandDO storeBrandDO = new StoreBrandDO(); storeBrandDO.StoreID = storeID; storeBrandDO.BrandID = brandList[i].BrandID; storeBrandDO.IsActive = true; storeBrandBL.InsertStoreBrand(storeBrandDO); } } } </code></pre> <p>thank you...</p>
c# asp.net
[0, 9]
1,317,505
1,317,506
How to define day is sunday and Normal day. using switch case by date?
<p>I have an error in this code. Please help me solve it.</p> <pre><code>function holiday($today) { $year = substr($today, 0, 4); switch($today) { case $year.'-01-01': $holiday = 'New Year'; break; case $today: $today11 = new DateTime($today); $R= $today11-&gt;format('l') . PHP_EOL; $Sunday='0'; if($R == 0) { $holiday = 'Sunday'; } else { $holiday = 'Normal Day'; } } return $holiday; } echo $tday= holiday($today); </code></pre>
php javascript
[2, 3]
5,107,179
5,107,180
How can I get jsFiddle to work in Chrome?
<p>I don't know why, but jsFiddle isn't working in Chrome. It worked fine until a few days ago, but now, when I open the console I receive this error:</p> <pre><code>Uncaught TypeError: Cannot call method 'get' of null </code></pre> <p>Is there or bug and what I need to do to make it work?</p>
javascript jquery
[3, 5]
4,198,169
4,198,170
Signed/unsigned situation when converting c# to java
<p>I'm currently converting the following piece of code to java from c#:</p> <pre><code> public static byte MakeCS(byte[] arr) { byte cs = 0; for (int i = 0; i &lt; arr.Length; i++) { cs += arr[i]; } return cs; } </code></pre> <p>My naive conversation is to just change the arr.Length to arr.length ;)</p> <p>However this gives me incorrect checksums since java has signed bytes and c# has unsigned ones (I tried changing the c# code to sbyte and it worked fine).</p> <p>What is the correct way to handkle the situation? I know I can "convert" a java byte to unsigned by bitand'ing it with 0xFF, but I'm not sure where to do this!</p> <p>Thanks!</p>
c# java
[0, 1]
3,705,813
3,705,814
Jquery table sorter not working and disable all other javascript
<p>I have added Jquery table sorter to my head.</p> <p>When I add the following to my javascript:</p> <pre><code> $("table").tablesorter(); </code></pre> <p>All of my other Jquery gets disabled and the table sorter does either work. </p>
javascript jquery
[3, 5]
4,896,560
4,896,561
jQuery: How to count table columns?
<p>Using jQuery, how would you figure out how many columns are in a table?</p> <pre><code>&lt;script&gt; alert($('table').columnCount()); &lt;/script&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt;spans one column&lt;/td&gt; &lt;td colspan="2"&gt;spans two columns&lt;/td&gt; &lt;td colspan="3"&gt;spans three columns&lt;/td&gt; &lt;tr&gt; &lt;/table&gt; </code></pre> <p>The total number of columns in this example is 6. How could I determine this using jQuery?</p>
javascript jquery
[3, 5]
4,858,696
4,858,697
Unable to add window in Android
<p>In my dev console, I get the following error:</p> <p><code>android.view.WindowManager$BadTokenException: Unable to add window -- token android.os.BinderProxy@405126b8 is not valid; is your activity running?</code></p> <p>It's the follow line: <code>alertDialog = new AlertDialog.Builder(Main.this).create();</code></p> <p>Here is my code:</p> <pre><code>@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splashscreen); alertDialog = new AlertDialog.Builder(Main.this).create(); LoadData(); } </code></pre> <p>I dont no whats wrong.</p>
java android
[1, 4]
1,150,942
1,150,943
Get datetime in javascript/jquery with "31/12/2010 03:55 AM" format
<p>Please advice, how can i get date time in "31/12/2010 03:55 AM" format using either javascript or jquery</p> <p>Also i would like to compare 2 date times and need to find the greator of the 2 how can do that too?</p> <p>Thanks Amit</p>
javascript jquery
[3, 5]
2,656,480
2,656,481
mix javascript and php
<p>i have file: <strong>file.php</strong></p> <p>in this file is:</p> <pre><code>&lt;script type="text/javascript"&gt; //.... var sumJS = 10; &lt;?php $sumPHP = sumJS ?&gt; &lt;/script&gt; &lt;?php echo "Sum = " . $sumPHP ?&gt; </code></pre> <p>How can i assign sumJS for $sumPHP ?</p> <p>if i would like make this conversely then i make:</p> <pre><code>$sumPHP = 10; &lt;script type="text/javascript"&gt; var sumJS; sumJS = &lt;?php echo $sumPHP ?&gt;; alert(sumJS); &lt;/script&gt; </code></pre> <p>but how can i make this for my problem?</p>
php javascript jquery
[2, 3, 5]
2,731,998
2,731,999
get value from ajax request to a hidden field
<p>I want to store the value returned from a webservice to a hidden field in jquery</p> <pre><code> $.ajax({ type: "POST", url: "/AutoComplete.asmx/CompareGroupName", data: { Text: text }, dataType: "json", onfocusout: function (element) { $(element).valid(); $(element).filter('.valid').qtip('destroy'); }, success: function (data) { response($.map(data.d, function (item) { return { value: item.igroup_id } $('#hdnGroupNameCheck').val = item.igroup_id; })) }, complete: function (xhr) { if (xhr.status == 200) { alert("Group Name already exist"); } else alert("Group Name does not exist"); } }); </code></pre> <p>I am getting Group already exists and Group does not exist and webservice is running fine. But how to get the id in the hidden field and display the same message through code behind in asp.net.</p> <p>Thanks</p>
jquery asp.net
[5, 9]
3,323,172
3,323,173
javascript function save to cookies
<p>For now, i have a function macs, and i need to implement this function to save inside a cookie and have it stored in mysql..</p> <p>So how am i supposed to have this function together?</p> <pre><code> &lt;script language="JavaScript"&gt; function getMacAddress(){ document.macaddressapplet.setSep( "-" ); return (document.macaddressapplet.getMacAddress()); } function setCookie(c_name,value,expiredays) { var exdate=new Date(); exdate.setDate(exdate.getDate()+expiredays); document.cookie=c_name+ "=" +escape(value)+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString()); } setCookie('cookie_name','getMacAddress()','1'); &lt;/script&gt; &lt;body&gt; &lt;?php //Defaults to 1 $javascript_cookie = isset($_COOKIE["cookie_name"]) ? $_COOKIE["cookie_name"] : 1; echo "$javascript_cookie"; // db insert query $dbhost = 'localhost'; $dbuser = 'root'; $dbname = 'registration'; mysql_connect($dbhost, $dbuser) or die("Could not connect database"); mysql_select_db($dbname); $sql_query = mysql_query("SELECT * from user WHERE UserID ='".$_POST['newUserID']."'"); $sql = "INSERT INTO test(mac) VALUES ('".$javascript_cookie."')"; mysql_query($sql); ?&gt; </code></pre>
php javascript
[2, 3]
3,003,255
3,003,256
Can't get data from textbox
<p>I'm trying to get data from textbox but it says undefined id or something like that. Here is my code. I didn't understand what the problem is. Text1, Text2 and Text3 are my id of textboxes.</p> <pre><code> SqlCommandBuilder thisBuilder = new SqlCommandBuilder(thisAdapter); DataSet thisDataSet = new DataSet(); thisAdapter.Fill(thisDataSet, "Odunc"); DataRow thisRow = thisDataSet.Tables["Odunc"].NewRow(); thisRow["Book_Name"] = "" + Text1.Text; thisRow["Reader_Name"] = "" + Text2.Text; thisRow["Expiration_Date"] = "" + Text3.Text; thisDataSet.Tables["Odunc"].Rows.Add(thisRow); thisAdapter.Update(thisDataSet, "Odunc"); </code></pre> <p>asp part</p> <pre><code> &lt;table style="width:100%;"&gt; &lt;tr&gt; &lt;td class="style1"&gt; Name of Reader&lt;/td&gt; &lt;td&gt; &lt;input id="Text1" name="Text1" type="text" /&gt;&lt;/td&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="style1"&gt; Name of Book&lt;/td&gt; &lt;td&gt; &lt;input id="Text2" name="Text2" type="text" /&gt;&lt;/td&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="style1"&gt; Expiration Date&lt;/td&gt; &lt;td&gt; &lt;input id="Text3" name="Text3" type="text" /&gt;&lt;/td&gt; &lt;td&gt; &amp;nbsp;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
c# asp.net
[0, 9]
3,819,107
3,819,108
Pass variable into php web form from android app
<p>I have the following php snippet. I am working on an android program and need to somehow pass in the 'pid'. How can I do this so that it will return the form with the given pid? Can I do this without passing in a parameter using a POST request?</p> <pre><code>&lt;?php if(isset($_GET['resp']) == "success") { echo '&lt;div class="success-box" style="font-size: 16px; padding: 20px;"&gt;Success&lt;/div&gt;'; } else { require_once('connect.php'); $pid = $_SESSION['pid']; $qry1 = mysql_query("SELECT * FROM table WHERE pid = '$pid'"); if(mysql_num_rows($qry1) &gt; 0) { $result = mysql_fetch_array($qry1); ... ?&gt; </code></pre>
php android
[2, 4]
1,949,622
1,949,623
Why doesn't the following jquery script work?
<p>I have a simple single page setup. Under a root folder, I have 3 subfolders (js, css, and images). In the root folder, I have an index.html page with the following content:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script language="javascript" src="js/jquery-1.3.2.min.js"&gt;&lt;/script&gt; &lt;script language="javascript" src="js/myscript.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a onclick="doSomething()" href="#" class="doSomething"&gt;Click!&lt;/a&gt; &lt;/body&gt; &lt;html&gt; </code></pre> <p>myscript.js contains the following code:</p> <pre><code>$('a.doSomething').click(function(){ //Do Something here! alert('You did sometihng, woo hoo!'); }); </code></pre> <p>When I click the link, nothing happens. What am I missing?</p>
javascript jquery
[3, 5]
5,305,551
5,305,552
Pass variable between events
<p>I have an edit button that, when clicked, triggers the first event below. It(edit form) also have a cancel link that, when clicked, triggers the second event below. How do I ensure that the <code>PrevContent</code> value is accessible within the cancel event? The user may click on any number of corresponding edit links at one time.</p> <pre><code>$('.js-profile-edit').live('click',function(){ var TrBlock = $(this).closest('tr'); var PrevContent = TrBlock.html(); var colspan = TrBlock.parent().prev().find('a:first').first().data('span'); $.ajax({ url : $(this).attr('href'), type : 'GET', success : function(response){ TrBlock.html('&lt;td colspan="'+colspan+'"&gt;'+response+'&lt;/td&gt;'); }, error : function(jqXHR, textStatus, errorThrown){ uiAlert({message : 'Something Broke. Try again later'}) } }); return false; }); $('.js-profile-edit-cancel').live('click',function(){ $(this).closest('tr').html(PrevContent); return false; }); </code></pre>
javascript jquery
[3, 5]
5,484,853
5,484,854
jQuery setInterval() undefined function error
<p>Hi I am relatively new to javascript and jQuery and while trying to create a function the runs in intervals of 100 milliseconds I encountered a problem.I seem to get in the console of firebug and error witch says that clasing() is not defined.This is my code:</p> <pre><code>$(document).ready(function() { var prev = $("img.selected").prev(); var curent = $("img.selected"); var next = $("img.selected").next().length ? $("img.selected").next() : $("img:first"); $("img").not(":first").css("display","none"); function clasing() { curent.removeClass("selected"); next.addClass("selected"); } setInterval("clasing()",100); }); </code></pre> <p>What am I doing wrong here?Thank you</p>
javascript jquery
[3, 5]
994,100
994,101
How to display response message after redirecting to otherpage?
<p>I am using ASP.NET and C#.In register page after click on submit i am storing all the details in database and redirecting to login page.So in login page i need to display message like successfully registered.</p> <p>Can someone tell me is it possible?</p> <p>Thanks.</p>
c# javascript asp.net
[0, 3, 9]
543,541
543,542
dropdown value changed by javascript is not coming in codebehind
<p>I have a dropdown list whose value is changed based on other controls in the UI using javascript.</p> <p>I used the following code to change the dropdown list, <code>document.getElementById("ddlchkStsID").options[2].selected = true; document.getElementById("ddlchkStsID").value = "3";</code></p> <p>But in the code-behind, the <code>ddlchkStsID.SelectedValue</code> is still coming as first option's value.</p> <p>This the control in aspx page.</p> <pre><code>&lt;asp:DropDownList ID="ddlchkStsID" runat="server" TabIndex="10" CssClass="meta"&gt; &lt;asp:ListItem Text="TBD" Value="1" /&gt; &lt;asp:ListItem Text="Yes" Value="2" /&gt; &lt;asp:ListItem Text="No" Value="3" /&gt; &lt;/asp:DropDownList&gt; </code></pre> <p>Could someone help me how to get the changed value in the code-behind.</p> <p>thanks in advance :)</p>
javascript asp.net
[3, 9]
771,997
771,998
ClientId is different in localhost and the webserver
<p>I am facing a new kind of problem.</p> <p>I am using the jQuery to fill the state dropdown on the change of country dropdown and the code of the jquery is on a js file so i bind the static client id like ct100_ddlCountry, this is working properly on the localhost but when i host this website to web server it not working because the client generating on the server is _ct100_ddlCountry.</p> <p>Please tell me something if anyone has an idea about this. I am new to this kind of problem. </p> <p>Thanks to all.</p>
asp.net jquery
[9, 5]
5,399,915
5,399,916
Question about dean edwards packer
<p>In jquery I use to save all my selectors in a variable. Then the browser only have to do doom travel once wich speeds up the site a bit...</p> <p>I am also using Dean Edwards packer for my scripts.</p> <p><strong>My question is: Is this realy needed or will Dean Edwards packer do this for me? I mean will Dean Edwards packer save the selectors in to variables for me...</strong></p> <p>Will this:</p> <pre><code>$('#my_div').click(function() { //stuff }); </code></pre> <p>Be like this after Dean Edwards packer:</p> <pre><code>var $my_div = $('#my_div'); $my_div.click(function() { //stuff }); </code></pre>
javascript jquery
[3, 5]
1,384,360
1,384,361
how to read iPhone address book ABThumbnailImage.data data? (is it encrypted?)
<p>I'm trying to make my own adress book, all is working except the images, I can't find a way of "decrypt" or make my php (web based app) read the string</p> <p>in wich format is data saved, I just can read ����</p> <p>Thanks</p> <p>EDIT:</p> <p>well, it seems this is more difficult than I could expect</p> <p>sample code</p> <pre><code>$db = 'AddressBookImages.sqlitedb'; $result = shell_exec("sqlite3 ".$db." 'SELECT data FROM ABThumbnailImage WHERE record_id = 405'"); echo "&lt;br&gt;"; echo 'Image: '.$result; Result = Image: ÿØÿà ÿØÿà </code></pre>
php iphone
[2, 8]
5,702,445
5,702,446
android: call javascript from java problem
<p>I want to know if there is way to call javascript from java on android? In my program, I interact java and javascript together. I am using java to receive response(json data) from TCP server and save them into a file. In webview I am using javascript jQuery getJSON() function to retrieve that file and using jQuery plot chart library to draw chart. Now, there is no relationship between java and javascript. Every time when I update data and file, I still need to click a button in webview to trigger the draw function. I want the programmes to be smart and handy. Is that a way to call or execute javascript from java. I know one way:</p> <pre><code>Button update = (Button)findViewById(R.id.update); update.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub wv.loadUrl("javascript:document.write('hello')"); } }); </code></pre> <p>But the problem is I already do a index page by loadurl().</p> <pre><code>final WebView wv = (WebView) findViewById(R.id.webkankan); wv.getSettings().setJavaScriptEnabled(true); wv.loadUrl("file:///android_asset/index.html"); </code></pre> <p>When I trigger this click event, all contents were gone only a string "hello" there. Another thing is why I need to change webview's type to final to avoid eclipse error. Does this is the problem to trigger my main problem? If so, how can I fix it? Thanks for you patience. Cheers!</p>
java javascript android
[1, 3, 4]
449,834
449,835
Show/hide views with checkbox
<p>I want to show or hide some elements (textviews and edittexts) with checkbox. I set their visibility to gone in layout file. Showing them when user checks the box works, but the when user unchecks it, they don't hide. (android 1.5 and 1.6)</p> <p>My code:</p> <pre><code>cb=(CheckBox)findViewById(R.id.cek); cb.setOnClickListener(new OnClickListener() { // checkbox listener public void onClick(View v) { // Perform action on clicks, depending on whether it's now checked if (((CheckBox) v).isChecked()) { tv1.setVisibility(0); //visible==0 et3.setVisibility(0); } else if (((CheckBox) v).isChecked() == false) { tv1.setVisibility(2); //gone=2 et3.setVisibility(2); } } }); </code></pre>
java android
[1, 4]
3,529,529
3,529,530
Trapping ctrl+n key combination in chrome
<p>Is there any way to trap <kbd>ctrl</kbd>+<kbd>n</kbd> key in chrome (by using javascript, jquery or any plugin)? I need to assign <kbd>ctrl</kbd>+<kbd>n</kbd>+<kbd>enter</kbd> key to particular task, but as soon as I press <kbd>ctrl</kbd>+<kbd>n</kbd>, chrome opens a new window. I am able to trap <kbd>ctrl</kbd>+<kbd>n</kbd> in firefox by using: </p> <pre><code>event.preventDefault() </code></pre> <p>but its not working in chrome.</p>
javascript jquery
[3, 5]
4,456,579
4,456,580
How can we split the word into characters in android/java..?? and assign particular id to each character
<p>I want to separate the word into characters like "ABCD" into A.B.C.D. and after that If we assume A=1 , B=2 ,...... and Z= 26, then i want to assign this sequence to each character and make a sum of that to achieved the output. How this can be done..??</p>
java android
[1, 4]
3,355,735
3,355,736
'Refire' jQuery every second?
<p>The following code adds a class to the last div:</p> <pre><code>$(".mydivs:last").addClass('added'); </code></pre> <p>This works on page load but the divs are in an animation, so the order changes. Is there a way to make the code run every second, so the class is added to the last div each time? </p> <p>For me I dont think it matters that eventually every div will have the new class. </p> <p>Thanks </p>
javascript jquery
[3, 5]
2,394,162
2,394,163
Cannot retrieve QueryString Value From URl
<p>I have pass Url on Anchor tag Given below:</p> <pre><code>mail.Body += string.Format("&lt;a href=\"http://www.abc.co.in/Download.aspx?period={0}&amp;ProductName={1}\"&gt;Demo Download&lt;/a&gt;", DateTime.Now, productName); </code></pre> <p>And trying to retrieve this value on pageload of download.aspx page but it shows <code>null</code> value on it. My code is: </p> <pre><code> string PName = Request.QueryString["ProductName"] as string; </code></pre>
c# asp.net
[0, 9]
5,903,267
5,903,268
jQuery,PHP-upload text file,doc/docx,ppt/pptx,pdf
<p>How can I upload <strong>txt, doc/docx, ppt/pptx, pdf</strong> and restrict all other file types while uploading file using php and jquery? Can i do it with jQuery also?</p> <p>I have tried this.</p> <pre><code>$allowedExts = array("doc", "docx", "pdf", "txt"); $extension = end(explode(".", $_FILES["file"]["name"])); if (($_FILES["file"]["type"] == "application/msword") || ($_FILES["file"]["type"] == "application/pdf") || ($_FILES["file"]["type"] == "application/txt") &amp;&amp; in_array($extension, $allowedExts)){} </code></pre> <p>I need it in JQuery or a better way in PHP. </p>
php jquery
[2, 5]
1,056,753
1,056,754
Can I change the HTML of the selected text?
<p>Can we change the HTML or its attributes of the selected part of the web page using javascript?</p> <p>For example, There is a random web page:(A part of it is shown)</p> <p><img src="http://i.stack.imgur.com/9Qa8S.png" alt="enter image description here"></p> <p>with HTML as</p> <pre><code>...&lt;p&gt;Sample paragraph&lt;/p&gt;.. </code></pre> <p>It is possible to get the HTML of the selected text which has already been answered <a href="http://stackoverflow.com/questions/5643635/how-to-get-selected-html-text-with-javascript">here</a>.</p> <p>But, is it possible for me change the html of the selected text? Like, add a class or id attribute to the paragraph tag.</p>
javascript jquery
[3, 5]
1,305,612
1,305,613
Jquery event capture change in margin-left
<p>I have a situation in here I have a div that was margin: auto to get it to be centered.</p> <p>That works fine, but when I resize the window I want it to stop centering when a certain margin-left is reached.</p> <p>The ideia is that I have a floating object to the left, and I dont want it to be overlapped.</p> <p>Anybody as a suggestion?</p> <p>Thanks</p> <p><strong>EDIT</strong>: Code Addded</p> <pre><code>&lt;nav id="servicos_nav"&gt; &lt;div id="full"&gt; ... &lt;/div&gt; &lt;div id="minimized"&gt; ... &lt;/div&gt; &lt;/nav&gt; &lt;section id="content"&gt; … PHP generated code … &lt;/section&gt; </code></pre> <p>The nav is absoluted possitioned because it was some effects, changind minimized by full with animations.</p> <p>Section content as width of 860px and margin auto. But there is and element in the nav that always as 140px width and I dont want that minimizing the window causes the content to overlap with that element. </p> <p><strong>SolutionEdit</strong>: My solution based on the awnser (the static width was just easier :-) ):</p> <pre><code>window.onresize = function(event) { if(window.innerWidth &lt;= 1142) { $("#content").css("margin-left","140px"); } else { $("#content").removeAttr("style"); } }; </code></pre>
javascript jquery
[3, 5]
499,682
499,683
jQuery looping animation from the beginning
<p>I would like this animation to repeat from the very beginning each time (#slide1).</p> <p>I tried the setTimeout method but could not get it to work. I am using a simple line by line since the timing difference and (lack of knowledge). Thanks for your help.</p> <p><a href="http://jsfiddle.net/q9EZg/6/" rel="nofollow">http://jsfiddle.net/q9EZg/6/</a></p> <pre><code>$(document).ready(function () { $("#slide1").fadeIn(2000, function () { $("#slide1").delay(4000).fadeOut(2000); $("#slide2").delay(6000).fadeIn(1000, function () { $("#slide3").fadeIn(1000, function () { $("#slide4").fadeIn(1000, function () { $("#slide5").fadeIn(1000, function () { $("#slide6").fadeIn(1000, function () { $("#slide7").fadeIn(1000, function () { $("#slide8").fadeIn(1000, function () { $("#slide9").fadeIn(1000, function () { $("div").delay(2000).fadeOut(1000, function () {}); }); }); }); }); }); }); }); }); }); }); &lt;div id="slide1"&gt;Slide 1&lt;/div&gt; &lt;div id="slide2"&gt;Slide 2&lt;/div&gt; &lt;div id="slide3"&gt;Slide 3&lt;/div&gt; &lt;div id="slide4"&gt;Slide 4&lt;/div&gt; &lt;div id="slide5"&gt;Slide 5&lt;/div&gt; &lt;div id="slide6"&gt;Slide 6&lt;/div&gt; &lt;div id="slide7"&gt;Slide 7&lt;/div&gt; &lt;div id="slide8"&gt;Slide 8&lt;/div&gt; &lt;div id="slide9"&gt;Slide 9&lt;/div&gt; &lt;div id="slide10"&gt;Slide 10&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
4,643,286
4,643,287
Implementing a Generic View Table Content ASP Page
<p>Am trying to build a web page that returns all columns in any table (audit tables) a user selects. Suppose I have 4 audit tables in my database namely <code>CustomerAudit</code>, <code>VendorAudit</code>, <code>InvoiceAudit</code> and <code>PaymentAudit</code> each with a different table structure. </p> <p>On a webpage, probably using a dropdownlist, a user should be able to select any of the four and the content of the selected table appears in a grid below the dropdownlist.</p> <p>The table list in the dropdownlist could change. But when it changes, user should be able to view the content in the gridview.</p> <p>How can I achieve this? The project implements a 3-tier EF, DTO, BL (WCF), UI (Web forms).</p> <p>Regards</p>
c# asp.net
[0, 9]
942,076
942,077
How to load a Javascript file within another Javascript file and execute file 2 before file 1?
<p>I have written a jQuery plugin, say <code>jquery.plugin.js</code>. I want to use this plugin on a large number of sites. </p> <p>What I want to do is to write a piece of js code at the top of <code>jquery.plugin.js</code> which will load the <code>jquery.main.js</code> and execute it so that <code>$</code> is available to be used in <code>jquery.plugin.js</code>.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,739,226
3,739,227
jQuery extension: why does it not work on all matching elements?
<p>I have an extension going like:</p> <pre><code>$.fn.crazything = function() { var self = $(this); // do some crazy stuff return self; } </code></pre> <p>And when I call it like:</p> <pre><code>$("div.crazydiv").crazything(); </code></pre> <p>It works, but only on the first matching div. If I have more than one div on the page, I need to do:</p> <pre><code>$("div.crazydiv").each(function(i) { $(this).crazything (); }); </code></pre> <p>Why is this, and how can I rewrite my extension to work on multiple divs?</p>
javascript jquery
[3, 5]
5,785,023
5,785,024
ArrayList to String - VS2008 - C#
<pre><code> ArrayList filters = new ArrayList(); filters.Add(new string[] { "Name", "Equals", "John" }); ObjectDataSource1.SelectParameters.Add("AppliedFilters", string.Join(",",(string[])filters.ToArray(typeof(string)))); </code></pre> <p>Am trying to add a parameter to my object data source which is bound to my select method which should accept a string[]. But as the SelectParameters.Add takes in (string,string) or the other 3 overloads which do not seem to function for me correctly. </p> <p>The select method accepts a string param though i prefer it accept a string[] or arraylist, but for now I can live with accepting a string which i should convert back to string[]</p> <p>Resolution: followed this article <a href="http://stackoverflow.com/questions/235166/how-do-i-set-up-objectdatasource-select-parameters-at-runtime">link text</a></p> <p><strong>Closed</strong> as duplicate of the question referenced above.</p>
c# asp.net
[0, 9]
3,230,384
3,230,385
How to find a sibling element's value using jQuery upon click
<p>I'm trying to find the value of the userid and password in the below HTML using the following jQuery code, but it doesn't return any value. What am I doing wrong?</p> <pre><code>&lt;div id='mainpane'&gt; &lt;form id='login' method='post' action='#'&gt; &lt;p&gt;User Id:&lt;input id='userid' type='text' name='userid'&gt;&lt;/input&gt;&lt;/p&gt; &lt;p&gt;Password:&lt;input id='password' type='text' name='password'&gt;&lt;/input&gt;&lt;/p&gt; &lt;p&gt;&lt;input id='submit' type='submit' name='Submit' value='Submit'&gt;&lt;/input&gt;&lt;/p&gt; &lt;/form&gt; &lt;div id="message"&gt;&lt;/div&gt; &lt;p&gt;Not a member? &lt;a href="user-signup.html"&gt;Signup&lt;/a&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Here's the jQuery code:</p> <pre><code>$(document).ready(function() { $('#login').delegate('input#submit','click',function(){ alert('user id is: '+$(this).parent().parent().find('#userid').html()); var request = $.ajax({ type:"POST", url:"/login", data: {userid:$('#userid').text(), password:$('#password').text} }); }); </code></pre> <p>The alert comes back with an empty data. Appreciate any pointers on what am I doing wrong.</p> <p>Thanks, Kalyan.</p>
javascript jquery
[3, 5]
404,760
404,761
InternalSubStringWithChecks Exception
<p>We're getting this InternalSubStringWithChecks exception with our application's healthMonitoring. </p> <p>This exception is like the <a href="http://forums.asp.net/t/1019434.aspx" rel="nofollow">Padding is invalid</a> and cannot be removed exception where it's being recorded and we're getting a notification email but the end user is unaware that an actual error has happened. Though we don't want our event log filled up with this rubbish! </p> <p>The stack trace is: </p> <pre><code>Event message: System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy) at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously) </code></pre> <p>I can't find any useful info on what causes this and how to fix it via Google. Has anyone else encountered/fixed this? </p>
c# asp.net
[0, 9]
2,027,716
2,027,717
Prevent an element from losing focus
<p>We have a lot of <code>input</code>s in a document.<br> We want to open a dialog that generates text and puts that in the currently focused input.</p> <p>The problem is that, when I click a button or anything else to open the dialog that input loses focus. I can't determine which input has to get the generated text.</p> <pre><code>$("#button").click(function(){ // something should goes here to prevent stealing inputs focus }); </code></pre> <p>Is there any solution to prevent stealing focus by that special button?</p>
javascript jquery
[3, 5]
1,442,458
1,442,459
JQuery Offset and ScrollTop Problems
<p>I'm trying to fix a elements position based on the scroll position within the window.</p> <p>I thought it would be as easy as getting the offset of the element where the fixed element should become fixed and then when the window.scrollTop is equal to it add CSS but it is weird.</p> <p>It seems as though the offset of the element is larger than the scrollTop largest numeral.</p> <p>Is there any other way of getting this to work?</p> <p>I want it to have the same functionality as this with regards to the footer on scroll; </p> <p><a href="http://be.blackberry.com/" rel="nofollow">http://be.blackberry.com/</a></p> <p>But I don't want to clone the element, I want to detect when it gets to near the bottom of the page and then change the position on the bottom of the element.</p> <p>Thanks in advance.</p> <p>B</p>
javascript jquery
[3, 5]