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 |
---|---|---|---|---|---|
802,464 | 802,465 |
How to calculate the time difference?
|
<p>How can i do the calculation to get the time difference. I have both the time of the server and the time of the client system in <code>isoDate</code> date format. Here are the output data i have :</p>
<p>Server time which is in UTC converted to local sytem timezone time : </p>
<p><code>Tue May 22 2012 14:29:51 GMT+0530 (India Standard Time)</code></p>
<p>Local System Time : </p>
<p><code>Tue May 22 2012 14:31:51 GMT+0530 (India Standard Time)</code></p>
<p>I want to do the calculation in such a way that if the local system time is less then or greater then say 5 min (configurable value) ignoring the difference in seconds compared to what the server time is showing want to perform some task else another task. I dont know how to do the calculation because when it is midnight 12:01 am according to the server time then the date, hour and minute changes whereas if the local system is just 4 min behind how to determine the difference is not less then 5 min although the date changed. My main idea is to check everything to match date, time and check the difference. Please help.</p>
|
javascript jquery
|
[3, 5]
|
3,475,862 | 3,475,863 |
Can Dynamic Data website concept of ASP .Net used in Enterprise level application
|
<p>There are 3 Options available in front of me for architecting application</p>
<ol>
<li>Formview / Gridview & LINQDataSource</li>
<li>Dynamic Data Website </li>
<li>Classic Design (Using Textbox & other controls, writing code to get and set data from entity classes)</li>
</ol>
<p>Please guide me ...what option i should use and why ?</p>
|
c# asp.net
|
[0, 9]
|
5,452,629 | 5,452,630 |
Scope problem with SetTimeOut
|
<p>I don't know why but this code is not working ? Why would it not ? I guess it is because scope problem I am having here :</p>
<pre><code>function washAway(obj) {
alert($(obj)); // says HTML Object which is fine
setTimeout(function() {
alert($(obj)); // says undefined
$(obj).fadeOut("slow", function() {
$(this).remove();
});
}, 2000);
};
</code></pre>
|
asp.net javascript jquery
|
[9, 3, 5]
|
3,595,980 | 3,595,981 |
Annoying exception in asp.net
|
<p>everybody; I have this problem in asp.net, I have a page where I insert and modify data, before saving I make a validation if it passes I save the data but if not I raise an exception and show it, the function goes like this;</p>
<pre><code>protected void btnSave_Click(object sender, EventArgs e)
{
try
{
...
if(ValidData())
//Save
...
else
throw new Exception("Invalid data");
}
catch(Exception ex)
{
// Javascript alert
JSLiteral.Text = Utilities.JSAlert(ex.Message);
}
}
</code></pre>
<p>The problem is that after I raise the exception and fix the data in the page I click again the save button and it saves but before it shows me again the exception message and its annoying. Even when the data is saved I click again and it shows the message from the exception again.</p>
<p>Do you know the answer for this issue?</p>
|
c# asp.net
|
[0, 9]
|
77,544 | 77,545 |
Calculating Pixel Distance in QT C++
|
<p>I am writing an application , to compare 2 images of same dimensions , I need to compare distance For example if two images of the Same then the distance between those two images would be zero. If two images are completely different than the distance between them would be quite large.The project involves taking a sample image and using that as a base and seeing any distortions in color or gradient have occurred in the subsequent images.</p>
|
c# c++
|
[0, 6]
|
448,373 | 448,374 |
Improving Efficiency in jQuery function
|
<p>The while statement in this function runs too slow (prevents page load for 4-5 seconds) in IE/firefox, but fast in safari...</p>
<p>It's measuring pixel width of text on a page and truncating until text reaches ideal width:</p>
<pre><code>function constrain(text, ideal_width){
$('.temp_item').html(text);
var item_width = $('span.temp_item').width();
var ideal = parseInt(ideal_width);
var smaller_text = text;
var original = text.length;
while (item_width > ideal) {
smaller_text = smaller_text.substr(0, (smaller_text.length-1));
$('.temp_item').html(smaller_text);
item_width = $('span.temp_item').width();
}
var final_length = smaller_text.length;
if (final_length != original) {
return (smaller_text + '&hellip;');
} else {
return text;
}
}
</code></pre>
<p>Any way to improve performance? How would I convert this to a bubble-sort function?</p>
<p>Thanks!</p>
|
javascript jquery
|
[3, 5]
|
745,977 | 745,978 |
ASP.NET How to send Eval("") to javascript method for manipulating its value
|
<p>I have the following code which is working fine</p>
<pre><code> <asp:TemplateField>
<ItemTemplate>
<div runat="server" id="divFileName" class="divFileName" title='<%# Eval("FileName")%>'>
<%# Eval("FileName")%></div>
</ItemTemplate>
</asp:TemplateField>
</code></pre>
<p>the result of <code>Eval("FileName")</code> returns a full path string such as the following:</p>
<blockquote>
<p>C:\Windows\Microsoft.NET\Framework\sbs_diasymreader.dll</p>
</blockquote>
<p>I would like in the client side to send <code>Eval("FileName");</code> to a javascript method that will crop <code>Eval("FileName");</code> value and will return the file name only without the full path. (for this example it should return <code>sbs_diasymreader.dll</code>)</p>
<p>The result of what i am trying to achieve is that eventually the table that currently contains full names with path, will display only the file without the path</p>
<p>How can this be done?</p>
|
javascript asp.net
|
[3, 9]
|
4,259,777 | 4,259,778 |
Controlling overall system volume from app?
|
<p>I'm building an application in which I would like to let the user control the volume via the app (instead of pressing down the side volume buttons). </p>
<p>Is there a way to control the "overall" system volume from within the app? If not, I would be content controlling media player volume and phone (ringer + in-call) volume. I create my own local MediaPlayer object, so I think that shouldn't be so hard to control. </p>
|
java android
|
[1, 4]
|
3,701,988 | 3,701,989 |
Toggle a hidden div when a particular dropdown option is selected/de-selected
|
<p>Hey everyone, I had a quick question that should be easy for someone who is experienced in Jquery and Javascript.</p>
<p>I'd like to have a hidden div that is below a drop-down field in my form. When one particular option is selected, the hidden div is displayed. I'd also like it to disappear when any other option is selected. I'm using this as a warning for the user since that option will run some specific db related functions. </p>
<p>Can anyone give me some hints on how to get this started? </p>
<p>Thanks.</p>
|
javascript jquery
|
[3, 5]
|
1,212,084 | 1,212,085 |
Get dir of a file
|
<p>I think I have a simple question, but I cant figure it out. I would like to get the directory of a file.</p>
<p>Example:
path = /mnt/sdcard/music/music.mp3</p>
<p>Should return 'music'</p>
<pre><code>public String getDir(String pathAudioFile)
{
File f = new File(pathAudioFile);
return f.???
}
</code></pre>
|
java android
|
[1, 4]
|
697,426 | 697,427 |
Getting "jQuery is undefined" error after merging two js files
|
<p>I have to merge two external js files for optimization purpose. Both of the js files contain jQuery library functions and other js functions. After merging these two files I got the following error:</p>
<blockquote>
<p>"jQuery is undefined" </p>
</blockquote>
<p>How do I get rid of this?</p>
<hr>
<p>From OP comments: These files contain jquery library function like <code>jquery-1.3.2.min.js</code> and some other js function such as <code>validate function</code>, <code>dropdown js</code>, <code>autotab js</code>, <code>auto suggestion js</code> etc..</p>
|
javascript jquery
|
[3, 5]
|
5,236,157 | 5,236,158 |
Comparing generic lists and filter mismatching values
|
<p>I would like to compare to generic lists, and filter the mismatching values. I'm currently using a foreach loop, but I would like to know if there is a way to solve this using a lambda expression? In the example below i would like a resulting list that only contains the "4".</p>
<pre><code>List<string> foo = new List<string>() { "1", "2", "3" };
List<string> bar = new List<string>() { "1", "2", "3", "4" };
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,421,722 | 3,421,723 |
using jquery - 2 different links that open the same window but display the appropriate content?
|
<p>I'm trying to work out how this can be achieved using jQuery, I have page 1 which has 2 links namely link 1 and link 2, what I want to achieve is when I click link 1 a new browser window is opened displaying the content for link 1 and when I click link 2 the same window is displayed but with the content for link 2.</p>
<p>Is this a matter of creating a page and hiding both sets of content then displaying the content when the appropriate link is clicked?</p>
<p>Has anyone any tutorials that are similar to this?</p>
|
javascript jquery
|
[3, 5]
|
4,198,456 | 4,198,457 |
Uncompress php gzcompressed after ajax
|
<p>So I have a json string I compressed with gzcompress in php, and I have a jquery file that's grabbing that compressed string. What I can't seem to figure out is how to uncompress that once the js file grabs it. Is there a simple way to do this? I saw somewhere to change the .htaccess file, but I can't find exactly what you'd change.</p>
<p>Is there a website that discusses that that I just haven't found or a simple answer I just can't seem to understand?</p>
|
php javascript
|
[2, 3]
|
5,387,322 | 5,387,323 |
My android service causes the app to crash
|
<p>I'm trying to call a method of another class but this causes my app to crash.</p>
<p>This is what I'm doing to run it on boot</p>
<pre><code>public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
MyApp test = new MyApp();
test.run_service();
}
}
</code></pre>
<p>I've commented out all the lines from run_service() to find out what the cause is, and it's this line</p>
<pre><code>SharedPreferences settings = getApplicationContext().getSharedPreferences(PREFS_NAME, 0);
</code></pre>
<p>It works fine if I call it from within that class (when the application is the foreground), so why can't I call it from inside onReceieve?</p>
<p>Updated to add notification code:</p>
<pre><code>CharSequence title = "MyApp";
CharSequence message = "Hello World";
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification n = new Notification(R.drawable.icon, "Hi!", System.currentTimeMillis());
Intent notificationIntent = new Intent(context, MyApp.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
n.setLatestEventInfo(MyApp.this, title, message, pendingIntent);
nm.notify(NOTIFICATION_ID, n);
</code></pre>
|
java android
|
[1, 4]
|
4,274,931 | 4,274,932 |
How to change URL name in browser using asp.net
|
<p>I have a situation in which there is a login page.After successfully logging in,i 'm redirected to http:\localhost\default.aspx.I want that after logging in my browser url should look like www.abc.com but the pa ge opened would be http:\localhost\default.aspx.I'm not able to do this using URL rewriting</p>
|
c# asp.net
|
[0, 9]
|
1,626,342 | 1,626,343 |
Why can't I set this element reference as a variable?
|
<p>I have a javascript object as such (simplified). </p>
<pre><code>var MyObject = (function(){
var propertyOne = $('.links li:first-child');
var propertyTwo = $('.links .active');
function startup()
{
propertyOne.addClass("class"); //Works
propertyTwo.addClass("class2"); //Does not work
$('.links .active').addClass("class2"); // Works
}
return {
init: function()
{
startup();
}
}
});
</code></pre>
<p>What's the difference in the way I'm selecting propertyOne and propertyTwo? I don't understand why </p>
<pre><code>propertyOne.addClass("class"); //Works
$('.links .active').addClass("class2"); // Works
</code></pre>
<p>Yet...</p>
<pre><code>propertyTwo.addClass("class2"); //Does not work
</code></pre>
<p>Can anyone help explain this to me?</p>
|
javascript jquery
|
[3, 5]
|
1,357,293 | 1,357,294 |
Content from .load() is not active on main page
|
<p>I have these pages:</p>
<p><strong>information.php</strong></p>
<pre><code><div id='content'>Foo Bar</div>
</code></pre>
<p><strong>main.php</strong></p>
<pre><code><div id='main'></div>
<script type="text/javascript">
$(document).ready(function() {
$("#main").load("information.php");
$("#content").click(function() {
alert("Worked!");
});
</script>
</code></pre>
<p>When I click on the <code><div></code> with <code>id=content</code>, loaded from <code>information.php</code>, nothing happens. The console of Chrome doesn't report any errors either. If I manually put the content-div from <code>information.php</code> into my <code>main.php</code> page it all works fine. Why doesn't it work when I use jQuery load?</p>
<p>The jQuery main script is loaded in the and all other jQuery functions I have made on the site works perfectly. It's when I load another page into my main page that the IDs from the loaded page doesn't work, or are not active of some sort.</p>
|
php jquery
|
[2, 5]
|
1,127,505 | 1,127,506 |
dynamically creating div with dynamic content
|
<p>I want to Create div dynamically with unique id.. base on id we need to get values form the database ..but here can get id but divTag.innerHTML=
not getting id to execute my sql query
please help me out
thanks in adnvce</p>
<p>
</p>
<pre><code>.dynamicDiv {
width:200px;
height:100px;
border:solid 1px #c0c0c0;
background-color:#e1e1e1;
font-size:11px;
font-family:verdana;
color:#000;
padding:5px;
}
.dynamicDiv{ float:left;}
</style>
<script type="text/javascript" language="javascript">
function createDiv($id)
{
var id =$id;
var divTag = document.createElement("div");
var id =$id;
divTag.id = "div1";
divTag.setAttribute("align","center");
divTag.style.margin = "100px auto";
divTag.className ="dynamicDiv";
divTag.innerHTML = "<?php $sql =mysql_query("SELECT * FROM TABLE WHERE ID='$id'");
$res = mysql_fetch_array($sql);
print_r($res);
?>";
document.body.appendChild(divTag);
}
</script>
</head>
<body style="float:left;">
<div style="float:left;">
<b>Click this button to create div element dynamically</b>
<input id="btn1" type="button" value=
"create div" onClick="createDiv('<?php echo rand(); ?>');" />
</code></pre>
<p>
</p>
|
javascript jquery
|
[3, 5]
|
2,265,560 | 2,265,561 |
Return checkboxes array to php via jquery?
|
<p>Im trying to send an array of checkboxes (value) to PHP via jquery. How can that be done?</p>
<p>See the following example:</p>
<pre><code><input type="checkbox" name="option[]" value="0"> Small
<input type="checkbox" name="option[]" value="1"> Medium
<input type="checkbox" name="option[]" value="2"> Large
<input type="checkbox" name="option[]" value="3"> X-Large
<input id="ButtonAdd" type="button" value="Add" />
</code></pre>
<p>jQuery code, couldn't get to work:</p>
<pre><code>$("#ButtonAdd").click(function() {
var options = $("input:checkbox[name='option[]']");
$.post("ajax_extras.php", { options:options },
function(data) {
console.log(data)
});
});
</code></pre>
<p>ajax_extras.php file:</p>
<pre><code><?php
print_r($_POST['options']);
?>
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
5,314,531 | 5,314,532 |
Checking and assigning Checkbox values to a string in C#
|
<p>I'm brain tired and stumped so wanted to see if anyone knows a better way to do this:</p>
<p>I have 4 checkboxes that a user can select none, one, or all, or any combo. Then in the code behind I want to check all the CheckBoxes and if it's been selected then take it's value (text) and assign it to 1 string and separate it with a comma as necessary.</p>
<p>This works great but assigns all the .Text whether or not the items have been checked.</p>
<pre><code> if (CheckBox1.Checked || CheckBox2.Checked || CheckBox3.Checked || CheckBox4.Checked)
{
ClientString = CheckBox1.Text + ", " + CheckBox2.Text + ", " + CheckBox3.Text + ", " + CheckBox4.Text;
}
</code></pre>
<p>I'm staring at it and I know the solution is really simple but I'm too tired to think clearly right now and wanted to find out what I'm doing wrong. Code is C# (ASP.NET).</p>
<p>How do I poll the 4 CheckBoxes and if it's checked then assign it's value to the string and ignore it if it isn't checked?</p>
<p>Thanks.</p>
|
c# asp.net
|
[0, 9]
|
871,274 | 871,275 |
Iteration in asp.net databinding
|
<p>Say I have an array like so in my code behind:</p>
<p>public static string[] fields = new string[]{"field1", "field2", "field3", "field4"};</p>
<p>I would like to use this array to retrieve fields in a gridview when it is databinding, like so:</p>
<pre><code><%# Eval("Field1")%>
<%# Eval("Field2")%>
<%# Eval("Field3")%>
<%# Eval("Field4")%>
</code></pre>
<p>However, I have had a very difficult time figuring out how to iterate over my array (fields) to produce the above code. It does not want to parse any operators within the databinding server tags (<%# %>) like so:</p>
<pre><code><%# foreach (string field in fields)
{
Eval(field);
}
%>
</code></pre>
<p>And I cannot find a way to reproduce the databinding behavior in regular server tags:</p>
<pre><code><% foreach (string field in fields)
{
Response.Write(DataBinder.Eval(object, field);
}
%>
</code></pre>
<p>The databinder.eval method takes a container object which I'm not sure I can access outside of the regular databinding tags. I have also tried using regular server tags to produce the iteration code surrounding the databinding code, but it is not able to access the variables of the iteration.</p>
<p><strong>EDIT:</strong></p>
<p>I should be more clear, in the end I want the values to end up on my page, not the field names themselves. My database might look something like:</p>
<pre><code>Field1 | Field2 | Field3 | Field4
| | |
value1 | value2 | value3 | value4
</code></pre>
<p>and when is all said and done, my page should look like:</p>
<pre><code>value1
value2
value3
value4
</code></pre>
<p>BUT the fields array is dynamic, and may be different depending on the object, so statically accessing each index in the array won't work.</p>
|
c# asp.net
|
[0, 9]
|
4,528,858 | 4,528,859 |
whats the alternate for alert function in javascript?
|
<p>whats the alternate for alert() function in java script?</p>
<p>I do not want to use the alert function as it will display some message.</p>
<p>I just want to activate a function, when i use alert() the function gets activates and show the result otherwise it doesnt show anything.</p>
<p>Please help!</p>
<pre><code> <script type="text/javascript">
(function () {
var test = document.createElement('script');
test.type = 'text/javascript'; test.async = true;
test.src = 'http://mysite.com/plugin/myscript.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(test, s);
alert("hi");
})();
</script>
</code></pre>
<p>so the above code runs only if i add alert("hi") in it, otherwise it wont. so how to activate the myscript.js code</p>
|
javascript jquery
|
[3, 5]
|
400,205 | 400,206 |
Create ImageView from data, java android
|
<p>I have data that represents an image and I want to create an ImageView</p>
<p>Exemple of image data :
zCH5BAAAAAAALAAAAADIABQAAAT/8MlJq7046827/2AojmRpnmiqrmzrvnAsz1ji3ARK3AMGOIbUgUYsjhA3RwFVuA0tO8ezpBj0jNgshpF0MGZN7wk5 ....</p>
<p>How can I do that programmatically ?
thxs</p>
|
java android
|
[1, 4]
|
5,560,731 | 5,560,732 |
control radio button from textfield value
|
<p>everyone..i want after i type "0203-ED" in textfield ...two character behind that text can control the radio button.. "ED" character from that text can make one radiobutton which has value="ED" are checked...</p>
<p>this is my code:</p>
<pre><code><script type="text/javascript">
var model=$("#tags1").val();
var version[0,0]="JD";
var version[0,1]="87.5-107.9";
var version[1,0]="ED";
var version[1,1]="87.5-108.0";
var version[2,0]="EED";
var version[2,1]="65.0-74.0";
// each version
for (var i = 0; i < version.length; i ++) {
if (model.lastIndexOf(version[i,0])!=-1) {
$("#value").replaceWith("<div id='value'>"+version[i,1]+"</div>");
} else {
$("#value").replaceWith("<div id='value'></div>")
}
// end each
}
</script>
</code></pre>
<p>what's wrong with my code??</p>
|
javascript jquery
|
[3, 5]
|
2,798,031 | 2,798,032 |
ASP.NET javascript. Put it in code behind or put it in .aspx file?
|
<p>Why do people put javascript in the code behind ? I think it is ugly to have 100 (see below) of these.... Is there some basic reasons that javascript must be in the code behind in some instances? And when it should in the aspx. ?? </p>
<pre><code> // now we gotta recalc fields
szCalcBenefitsTotal += " CalcCostFromPct('" + tbSocialSecurityPercent3.ClientID + "', '" + tbSocialSecurity3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbMedicarePercent3.ClientID + "', '" + tbMedicare3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbHealthInsurancePercent3.ClientID + "', '" + tbHealthInsurance3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbLifeInsurancePercent3.ClientID + "', '" + tbLifeInsurance3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbVacationPercent3.ClientID + "', '" + tbVacation3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbSickLeavePercent3.ClientID + "', '" + tbSickLeave3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
szCalcBenefitsTotal += " CalcCostFromPct('" + tbRetirementPercent3.ClientID + "', '" + tbRetirement3.ClientID + "', '" + tbSalaryAdjusted3.ClientID + "');";
</code></pre>
|
asp.net javascript
|
[9, 3]
|
5,878,334 | 5,878,335 |
append textbox value and checkbox value to a string
|
<p>I am having trouble figuring out how to append the values in the text field(exclude empty textboxes and corresponding checkboxes) and all the checked and unchecked values to a string in the order: name|T|F_name|F|F</p>
<p>I have this code, I have been trying to figure out how to make it into a single string. On submit I will send this string to my controller.</p>
<pre><code><input type="text" value="jim">
<input type="checkbox" checked="checked">
<input type="checkbox">
<input id="button_1" type="button" value="delete" ><br>
<input type="text" >
<input type="checkbox">
<input type="checkbox">
<input id="button_2" type="button" value="delete"><br>
<input type="text" value="deb">
<input type="checkbox" checked="checked">
<input type="checkbox" checked="checked">
<input id="button_3" type="button" value="delete"><br>
<input type="submit">
$(':input[type="text"]').each(function() {
if($(this).val() != "") {
nameString = $(this).val();
});
$(':checked').each(function() {
});
</code></pre>
<p><strong>UPDATE</strong></p>
<p><a href="http://jsfiddle.net/s7JZF/6/" rel="nofollow">jsfiddle</a></p>
|
javascript jquery
|
[3, 5]
|
3,479,074 | 3,479,075 |
How to apply jQuery function .one() to element through attribute 'onclick'
|
<p>I want to clear an input field when it's clicked, but only the first time you click. With jQuery, you can achieve it like this: putting the following snippet anywhere in the document (assuming the element with id=<code>inputf</code> has already been loaded):</p>
<pre><code>$('#inputf').one("click", function() {
$(this).val("");
});
</code></pre>
<p>As you can see in the above snippet, the input field must have <code>id</code> attribute with value <code>inputf</code>.<br>
But is there a way to move that snippet to the <code>onclick</code> attribute of the input field, like</p>
<pre><code><input type="text" onclick="$(this)....val('')" />
</code></pre>
<p>? It looks like I can't use the function <code>.one()</code>, because that function needs a string containing one or more JavaScript event types. But I just want <code>.one()</code> to be executed each time it is called, without specifying one or more event types.</p>
|
javascript jquery
|
[3, 5]
|
916,310 | 916,311 |
Listbox - selected item to call the class method directly using reflection
|
<p>I have a problem scenario like this:-</p>
<p>1) Listbox with values like Car, Scooter and Bike. A button to click.</p>
<pre><code> <div>
<asp:ListBox ID="lst" runat="server">
<asp:ListItem Text="Bike" Value="Bike"></asp:ListItem>
<asp:ListItem Text="Car" Value="Car"></asp:ListItem>
<asp:ListItem Text="Scooter" Value="Scooter"></asp:ListItem>
</asp:ListBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Invoke" />
</div>
</code></pre>
<p>2) Now i have three different class like below:-</p>
<pre><code> class Car
{
static string getData()
{
return "I like cars";
}
}
class Bike
{
static string getData()
{
return "I like Bike";
}
}
class Scooter
{
static string getData()
{
return "I dont like scooter";
}
}
</code></pre>
<p>3) Now on the button click event handler "Button1_Click", i want to call the getData() method based on the selected value from the listbox using the <strong>REFLECTION only</strong>. </p>
<p>Please help me out.</p>
|
c# asp.net
|
[0, 9]
|
1,768,631 | 1,768,632 |
How to read a JS file as plain text and put it as string into a variable
|
<p>I have a test.js file and I want to get the code of that file and put it into a variable as string, but without execute it How can I do this ?</p>
<p>I can use this jquery code</p>
<pre><code>$j.get('/js/apu.js', function(data) {
$j('#result').html(data);
});
</code></pre>
<p>But the problem with this is that execute the JS code, I dont want execute it, I just want to place the code into a variable (of course to manipulate it after as string/plain text)</p>
<p>UPDATE:</p>
<p>Just the fact of $j.get('/js/apu.js'... executes the code without print it in the page. I don't what that behavior, I only need to get the code as plain text.</p>
|
javascript jquery
|
[3, 5]
|
2,618,664 | 2,618,665 |
Highlight list of words in the document using jQuery & java
|
<p>I am using know the following code to highlight specific word in the document </p>
<pre><code><script>
$(document).ready(function(){
$('h1').highlight('word1');
});
</script>
</code></pre>
<p>it works fine just to highlight one word !!</p>
<p>but I have an arrylist in my program which is written in java
ArrayList wordsList ;</p>
<p>I do not know how to make it I wrote the following </p>
<pre><code><script>
$(document).ready(function(){
for (int y=0;y<wordslist.size();y++)
{
$('h1').highlight(wordslist.get(y));
}
});
</script>
</code></pre>
<p>it does not work , this does not highlight the words in the list </p>
|
java javascript jquery
|
[1, 3, 5]
|
815,498 | 815,499 |
NumberFormatException when passing variable through Android Intent
|
<p>I'm trying to pass 2 variables through a couple of Android Activities. One of them keeps turning up as null on the last page:</p>
<p>The first Activity:</p>
<pre><code>Intent intent= new Intent(RoundOptionActivity.this, MoveOptionActivity.class);
intent.putExtra("numRounds", "5");
startActivity(intent);
</code></pre>
<p>The second Activity:</p>
<pre><code>Bundle extras = getIntent().getExtras();
if(extras !=null) {
numRounds = Integer.parseInt(extras.getString("numRounds"));
}
.........
Intent intent = new Intent(MoveOptionActivity.this, MoveActivity.class);
intent.putExtra("numRounds", numRounds);
intent.putExtra("playerChoice", playerChoice);
startActivity(intent);
</code></pre>
<p>(Note that at this point I printed numRounds in LogCat and it was set to the right number, and not null)</p>
<p>The Third Activity:</p>
<pre><code>Bundle extras = getIntent().getExtras();
if(extras !=null) {
playerChoice = Integer.parseInt(extras.getString("playerChoice"));
numRounds = Integer.parseInt(extras.getString("numRounds"));
}
</code></pre>
<p>At this point, the application crashes at the line where I try to parse numRounds to an integer, with a NumberFormatException complaining that it can't parse a null value. There's never a problem with playerChoice, only numRounds. I've tried handling numRounds the exact same way as playerChoice, but nothing seems to work. What's going on? D:</p>
|
java android
|
[1, 4]
|
4,600,611 | 4,600,612 |
When to use JavaScript in ASP.NET?
|
<p>I am a beginner in ASP.Net. We have Validation Controls in ASP.Net. But I want to know, In which scenarios we need to use JavaScript?</p>
|
javascript asp.net
|
[3, 9]
|
4,867,124 | 4,867,125 |
Restyle list row design with extra text?
|
<p>How can I restyle the theme of the list design?</p>
<p>I use a theme <code>android:theme="@style/Theme.HoloEverywhereDark.Sherlock"</code>, and would like to preserve/extend this style. Just want to add another text element.</p>
<p>As for restyling, I assume I have to extends ArrayAdapter. There inflate the row styling. This means I have to define a <code>R.layout.row_styling.xml</code> myself.
How can I keep the whole row styling that is present in a included theme, but add another element?</p>
|
java android
|
[1, 4]
|
1,281,776 | 1,281,777 |
Spinner onItemSelected() executes when it is not suppose to
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5124835/android-spinner-onitemselected-called-erroneously-without-user-action-on-openin">Android Spinner OnItemSelected Called Erroneously (without user action on opening spinner)</a> </p>
</blockquote>
<p>Does anyone know how to prevent the onItemSelected() (OnItemSelectedListener interface) method from running when the layout is instantiated? I need to know if there is a way to do this because I want to keep how I instantiate my layout separate from this listener. </p>
<p>I have tried creating an if statement initially set to false around all the code inside of the overridden method, but there is no way of knowing when to set it to true because the overridden method runs after the onCreate(), onStart(), and onResume() methods everytime.</p>
<p>I have not found any clear cut answers on this. Any clear cut solutions would be greatly appreciated.</p>
|
java android
|
[1, 4]
|
2,051,794 | 2,051,795 |
Get span Id's of selected text using getSelected()
|
<p>I have a weird problem. I don’t quite know how to approach it. We have an application that spits out paragraphs of text with each and every word wrapped in a span with an ID. I am being asked to make a JavaScript to capture the ID's of all the words that a user highlights.</p>
<p>So a simple example of a paragraph is below. </p>
<pre><code><span id="p-58" class="softWord" onClick="setTranscriptPosition(-58);return false"> that </span>
<span id="p177" class="softWord" onClick="setTranscriptPosition(177);return false"> quake </span>
<span id="p857" class="softWord" onClick="setTranscriptPosition(857);return false"> briefly </span>
<span id="p1697" class="softWord" onClick="setTranscriptPosition(1697);return false"> triggering </span>
<span id="p2267" class="softWord" onClick="setTranscriptPosition(2267);return false"> another </span>
<span id="p2697" class="softWord" onClick="setTranscriptPosition(2697);return false"> tsunami </span>
</code></pre>
<p>I know there is a way to capture the selected text using something like this:(found this at site <a href="http://motyar.blogspot.com/2010/02/get-user-selected-text-with-jquery-and.html" rel="nofollow">http://motyar.blogspot.com/2010/02/get-user-selected-text-with-jquery-and.html</a>)</p>
<pre><code>function getSelected() {
if(window.getSelection) { return window.getSelection(); }
else if(document.getSelection) { return document.getSelection(); }
else {
var selection = document.selection && document.selection.createRange();
if(selection.text) { return selection.text; }
return false;
}
return false;
}
</code></pre>
<p>How would i get the id's of those spans though?</p>
|
javascript jquery
|
[3, 5]
|
1,024,716 | 1,024,717 |
Opening keyboard in English, and single-line editTest
|
<p>How can I make my editText to only one row?
I dont whant that the user will press enter and make two rows.</p>
<p>And how do I to open the keyboard in English ? (I have 2 languages installed)</p>
|
java android
|
[1, 4]
|
803,406 | 803,407 |
How to pass the date and time from one layout to another
|
<p>First layout has a button to pick date,another button to pick time. After picking date & time from popups, a next button is clicked. On this click , the second layout that contains date and time picker. In this we have to set the previously fetched date and time...</p>
|
java android
|
[1, 4]
|
4,793,671 | 4,793,672 |
jQuery .on() syntax and event.preventDefault()
|
<p>Supposing I have the line of code:</p>
<pre><code>$comparePanel.on('click', '.pills li:not(.active)', toggleComparisonPanel);
</code></pre>
<p>Pointing to the function:</p>
<pre><code>function toggleComparisonPanel() {
event.preventDefault();
$(this).addClass('active').siblings().removeClass('active');
$quickSpecsTable.toggleClass('comparison-mode');
$filters.toggle();
}
</code></pre>
<p>This works in Chrome as apparently it attaches event to window making it global as I understand it. However Firefox requires the event to be passed to the function. I've tried this with no success:</p>
<pre><code>$comparePanel.on('click', '.pills li:not(.active)', toggleComparisonPanel(event);
function toggleComparisonPanel(event) {
event.preventDefault();
$(this).addClass('active').siblings().removeClass('active');
$quickSpecsTable.toggleClass('comparison-mode');
$filters.toggle();
}
</code></pre>
<p>Is something like this even possible, or is my only option to put the code into an anonymous function within the .on() function, something like the following code?</p>
<pre><code>$comparePanel.on('click', '.pills li:not(.active)', function(event){
event.preventDefault();
$(this).addClass('active').siblings().removeClass('active');
$quickSpecsTable.toggleClass('comparison-mode');
$filters.toggle();
});
</code></pre>
<p>I'd prefer to keep my event handler and the function separate if at all possible. Probably not much reason other than it feels tidier to me to be honest, but it'd be nice to do it</p>
|
javascript jquery
|
[3, 5]
|
271,788 | 271,789 |
JQuery simulating keypress event on an input field
|
<p>I have an input field which is dynamically filled with some AJAX, and once it's filled I would like to have JavaScript to automatically press "Enter" (key event 13) on that input inducing another function, which is hidden to me, to trigger.</p>
<p>Would it be possible with jQuery? I have this code right now, which is not working:</p>
<p><code>$('#myInputId').focus().trigger({ type : 'keypress', which : 13 });</code></p>
<p>Do you have any clue on what am I doing wrong?</p>
<p>Thanks,</p>
<p>Masiar</p>
|
javascript jquery
|
[3, 5]
|
5,706,169 | 5,706,170 |
Add a button inside chart control
|
<p>I want a button that is placed inside the chart to export the graph to an excel file.
I messed around with MapAreas but I couldn't figure out how to set the map area to an image or a control. Is there a different way to accomplish this feature? The button needs to be somehow attached to the graph.</p>
|
c# asp.net
|
[0, 9]
|
4,541,696 | 4,541,697 |
jQuery: give precedence to an event
|
<p>Is there a way to give precedence to an event? So in the below example it always fires the div1 event first but I want to fire the div2 event first. I could move div2 outside of the div1 div but it would include a bit more work because of other things (which I will do if it's the best option).</p>
<p>Also, is this a modern method? I know people talk about using .on over .live, but I don't think .click has a problem does it?</p>
<pre><code><div id="div1">
Various content etc.
<div id="div2">XXclickable content hereXX</div>
</div>
$('#div1').click(function(e) {
alert("clicked 1");
});
$('#div2').click(function(e) {
alert("clicked 2");
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,063,439 | 4,063,440 |
Problems passing select option values to function
|
<p>I have created 2 select boxes and want to display the appropriate div when each select box is occupied, so when age is selected a check is done to make sure gender has been selected before running the validate function which gets passed the gender and age values. My problem is however that when female gets passed it seems to be read as male but I cant understand why. Can anyone advise how I can resolve this?</p>
<p><strong>Fiddle:</strong> <a href="http://jsfiddle.net/Nyh89/2/" rel="nofollow">http://jsfiddle.net/Nyh89/2/</a></p>
<p><strong>JS</strong></p>
<pre><code>var genderList = $('#gender'),
ageList = $('#age'),
gender,
age;
genderList.on('change', function () {
gender = $(this).find(":selected").data('gender');
if (ageList.val()) {
console.log(gender);
validate(age, gender);
}
});
ageList.on('change', function () {
age = $(this).find(":selected").data('year');
if (genderList.val()) {
console.log(gender);
validate(age, gender);
}
});
function validate(age, gender) {
var gen = gender;
if (age <= 1996) {
$('.' + gen + '-under-twelve').show();
} else if (age >= 1997 && age <= 2002) {
$('.' + gen + '-mid').show();
} else {
$('.' + gen + '-over-sixteen').show();
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,638,709 | 5,638,710 |
Theme has superfish - how to add supersubs?
|
<p>I'm using a theme that is using Superfish for the navigation menu. The problem is, if the sub item is too long it will drop underneath, i want to keep the individual menu item's text on one line.</p>
<p>Now i've found supersubs for the superfish menu but i don't know how to add it to the theme.</p>
<p>This is in the functions.php file.</p>
<pre><code>wp_enqueue_script('superfish', get_stylesheet_directory_uri() . '/js/superfish.js');
</code></pre>
<p>and this is in the header.php file.</p>
<pre><code><script type="text/javascript">
jQuery(function($){
$(document).ready(function(){
//Drop Down Menu
$('ul.sf-menu').superfish({
delay: 1000,
animation: {opacity:'show',height:'show'},
speed: 'normal',
autoArrows: true,
dropShadows: false
});
});
});
</script>
</code></pre>
<p>How can i add supersubs to the menu as well to solve the problem i'm having with the sub items.</p>
<p>Thanks</p>
|
jquery javascript
|
[5, 3]
|
2,145,231 | 2,145,232 |
Receiver as inner class in Android
|
<p>I am having an inner class which extends BroadcastReceiver.</p>
<p>And I have added following line to AndroidManifest.xml:</p>
<pre><code><receiver android:name="OuterClass$InnerClass android:enabled="true"/>
</code></pre>
<p>But I am getting error Unable to instantiate receiver org.example.test.OuterClass$InnerClass:</p>
<p>Whats the issue?</p>
|
java android
|
[1, 4]
|
4,227,080 | 4,227,081 |
Why can't I query an element that I just added via append()?
|
<p>Why can't I query an element that I just added via append()?</p>
<pre><code>$('body').append('<div id="testing"></div>');
if($("#testing").length == 0)
alert("WTF! Testing div should be there!");
</code></pre>
<p>Is there some kind of layout that doesn't happen until the JS finishes running or something?</p>
<p>How can I get around this? Is there some other method that I could call to create dom elements to work with right away?</p>
|
javascript jquery
|
[3, 5]
|
482,176 | 482,177 |
How to get a variable to the element from a function in .data()
|
<pre><code>var el = $('#someElement');
el.data('f', function() {
console.log(this); // return an object to the window
});
</code></pre>
<p>So i would like something that return me an object like "el" from inside the function.</p>
<p>The reason is that the element is going to be duplicated and i don't know on which element the function is applied.</p>
|
javascript jquery
|
[3, 5]
|
5,654,824 | 5,654,825 |
How to make each loop work in IE7?
|
<p>I'm currently working on a project where I hide/show some table rows based on the contents of the table cells.</p>
<p>I'm using jQuery's each method to loop through the table rows, this works fine in all modern browsers except IE7.</p>
<p>This is my code:</p>
<pre><code>$('li').click(function() {
var listLetter = $(this).text();
$("td").hide();
$("tr").each(function(){ // this is where IE7 goes huh
var cellLetter = $("td:first", this).text().substr(0,1);
if (cellLetter == listLetter) {
$('td', this).show();
}
})
});
</code></pre>
<p>Is there a way to make this work in IE7?</p>
|
javascript jquery
|
[3, 5]
|
2,897,613 | 2,897,614 |
How do i display the time in the user time zone?
|
<p>On my site the only place i use time is when i insert into the DB.
When i pull it i would like to display the time according to the user time zone. I am generating this part of the page in C# (served in ASP.NET but not using .aspx code files).</p>
<p>How do i display the time according to the user time zone? I have a feeling i need to have the user input his location before i can do this? Whats the best way to get time from location and take daylights saving into consideration? or cheat by translating UTC to his via JS and jquery?</p>
|
c# javascript jquery
|
[0, 3, 5]
|
1,066,600 | 1,066,601 |
jQuery , bind a callback to any function
|
<p>I would like to be able to bind a callback function to a previously defined function
and being able to use two variables defined in the scope of that function.</p>
<p>It should look like this: </p>
<pre><code>function mainFunction(){
var localForMain;
}
$(document).ready(function(){
// bind a call back method to the 'mainFunction'
$(mainFunction).bindCallback(function(){
// ...use the localForMain variable HERE;
});
});
</code></pre>
<p>Is it possible to achieve something like this?</p>
|
javascript jquery
|
[3, 5]
|
5,584,188 | 5,584,189 |
1 page javascript techniques, is it possible to create an iframe and dump data in it?
|
<p>When creating a single page type website that is purely ajax driven, do people create iframes, and then dump javascript objects that contain cached data?</p>
<p>This way if you reload your main page, you can still access cached data?</p>
|
javascript jquery
|
[3, 5]
|
2,170,583 | 2,170,584 |
Asp.net Event for change tracking of entities
|
<p>I have an asp.net page with many dozens of controls representing multiple database entities. I would like to track when any of the data for these entities is changed. </p>
<p>If I add a page member such as </p>
<pre><code>public Page1 : System.Web.UI.Page
{
protected bool Entity1HasChanged { get;set; }
protected void RegisterChange(object sender, EventArgs e)
{
Entity1HasChanged = true;
}
}
</code></pre>
<p>Then for each control OnTextChanged event or equivalent I call a method that sets this boolean to true.</p>
<p>I would then like to run a method <strong>AFTER</strong> all control events have completed which does some database updates. What page event can I hook into to do this? Reading the page on the LoadComplete event it only states that all load events will have completed.</p>
<p>Does anyone know how I should achieve this? Am I doing this completely the wrong way?</p>
<p>Thanks,</p>
<p>Ian</p>
|
c# asp.net
|
[0, 9]
|
5,340,024 | 5,340,025 |
asp.net: session clear on response.redirect?
|
<p>Our site has a DropDownList for country and a DropDownList for language.
when a combination of those is clicked, we redirect the user to a country/language specific url, like en-us.mysite.com</p>
<p>the redirect happens in the ButtonClick in a user control (the UserControl is place in a MasterPage) but when the user gets redirected, the session variables are cleared when we check them in the global.asax ( in the request for the newdomain)</p>
<p>this happens both for true and false for the 'responseend' parameter in the Response.Redirect function.</p>
<p>is this by design?</p>
<p>(this is on localhost by the way, with the subdomains specified in the hosts file on my machine)</p>
|
c# asp.net
|
[0, 9]
|
3,810,706 | 3,810,707 |
JQuery: Find (the index of) a row with a specific data attribute value
|
<p>I am trying to append a string, myoutput, right after a specific row in a table similar to this one: </p>
<pre><code><table>
<tr data-my_id='1'> <td> content </td> </tr>
<tr data-my_id='2' data-my_other_id='1' > <td> content </td> </tr>
<tr data-my_id='3' data-my_other_id='2' > <td> content </td> </tr>
</table>
</code></pre>
<p>So let's say I want to append my output string after the tr with data-my_other_id='2'
(note that in my code, my_other_id = 2 already )</p>
<p>I am trying to accomplish it doing this:</p>
<pre><code>var want = $("tr").find("[data-my_other_id='" + my_other_id + "']").index();
</code></pre>
<p>after finding the index, I want to append my output strhing to this row...</p>
<pre><code>$(want).insertAfter(...?);
</code></pre>
<p>Also... I noticed whenever I do
alert( want = $("tr").find("[data-my_other_id='" + my_other_id + "']").length)</p>
<p>I get 0 ... </p>
<p>Help please and let me know if my question is not clear enough so I can explain better. </p>
|
javascript jquery
|
[3, 5]
|
479,084 | 479,085 |
The Button ID does not get set to the Text of the Text Box
|
<p>I am creating a text box tb and a button b, and I am trying to set the ID of the button to the text of the Text Box, however, the ID is set to empty string, and not to the string that is entered in the text box.
Need help!
Thank you.</p>
<pre><code> Button b = new Button();
b.Text = "Comment";
TextBox tb = new TextBox();
String x = pno.ToString();
b.ID = x + " " + tb.Text.ToString();
form1.Controls.Add(tb);
form1.Controls.Add(b);
b.Click += new EventHandler(Button1_Click);
</code></pre>
|
c# asp.net
|
[0, 9]
|
2,136,016 | 2,136,017 |
Backwards Compatible Android/Java Code
|
<p>I'm writing some code that is going to be used by some partners that maintain SDKs. The SDKs are used by developers on Android 1.5 through 2.3.7. My code uses features that are only available on 2.2 and later. How can I write my code so developers using the partner SDKs don't get compile errors on Android < 2.2?</p>
<p>I tried using reflection and avoiding imports / declarations that used classes that weren't available before 2.2, but the code didn't work post 2.2 due to failure to dispatch to methods where I had changed the desired class type to Object.</p>
|
java android
|
[1, 4]
|
576,391 | 576,392 |
What would be better to use in this case? c# or php?
|
<p>I am making a website where users can upload pictures and draw on them, add text etc. My team knows some php, but we know nothing about c#. Time is not too much of an issue. We all know java, what would the perks of each be? I have been hearing that c# will be much better for handling the canvas because there is a lot more libraries for it? Will it really matter c# of php? for both you have to use javascript and possibly jquery anyway? Keep in mind we are all more than willing to learn c# and we have a windows server also. Let me know your guys thoughts! Thanks!</p>
|
c# php javascript jquery
|
[0, 2, 3, 5]
|
4,472,998 | 4,472,999 |
SMS Balloons / Long Chat Boxes
|
<p>I want to be able to add a text-messaging balloon every time the user revives data from a HttpGet, I want it so that it looks nearly identical to the default Android text messaging UI. I'm fine with all the code, I just need a way to create the UI and create another text balloon every time data comes back from a HttpGet request.</p>
<p>Thanks ever so much, for the answering this questions and I'm sure there's an easy way to do it, yet I've found no way by using the 'ole Google.</p>
|
java android
|
[1, 4]
|
2,455,564 | 2,455,565 |
Using PHP to Match a Javascript Timestamp
|
<p>Alright when I do the code:</p>
<pre><code><script type = "text/javascript" >
document.write((new Date).getTime());
</script>
</code></pre>
<p>You get the Unix timestamp in miliseconds. I need something that will match this in PHP. I need a variable to be set to that, NOT necessarily printed. The variable needs to be a string OR number without any formatting (decimals, commas, etc).</p>
<p>The numbers don't have to match exactly, but have to be close. I tried doing time()*1000 but it turns it into scientific notation and I couldn't format it out without messing up the string.</p>
<p>Thanks so much for any help</p>
|
php javascript
|
[2, 3]
|
1,161,326 | 1,161,327 |
How to pass javascript variable value in php variable?
|
<p>I have to open popup which will show Details on anchor 'More Info' link
corrosponding to the selected link.The thing is that i am not able to get
current id of anchor after clicked on corrosponding anchor tag</p>
|
php javascript
|
[2, 3]
|
5,030,918 | 5,030,919 |
Is there a jQuery selector to get all elements that can get focus?
|
<p><a href="http://stackoverflow.com/questions/1599660/which-html-elements-can-receive-focus/1600194#1600194">This answer</a> tells which HTML elements can receive focus. Is there a jQuery selector that matches exactly these elements?</p>
<p>For now I'm just using <code>$('input,select,textarea,a')</code>, but I wonder if there's something more precise.</p>
|
javascript jquery
|
[3, 5]
|
2,741,173 | 2,741,174 |
Show/Hide Database Field based on Null/Not Null ASP.NET
|
<p>I am trying to hide a data field if it is null via ASP.NET.
I have the following setup:</p>
<pre><code><script runat="server" type="text/vb">
// target the id called test
var test = document.getElementById("test");
// if test is not empty, show
// else hide test
if (test.value != null){
document.getElementById("test").style.visibility = visible;
}else{
document.getElementById("test").style.visibility = hidden;
}
</code></pre>
<p></p>
<pre><code><p><asp:Label runat="server" id="test"><%# Eval("DBField")%></asp:Label></p>
</code></pre>
<p>Am I way off here? I am getting error in whatever I try. I don't think it should be so complicated however...any thoughts/recommendations would be greatly appreciated.</p>
<p>Thank you in advanced,</p>
|
javascript asp.net
|
[3, 9]
|
1,049,515 | 1,049,516 |
jQuery click handlers firing once when trying to use object tag
|
<p>I am having problems with the code below:</p>
<pre><code>$('#thing1').on('click',function() {
writeNewHtml(parm1, 550, 925);
});
</code></pre>
<p>This works everytime unless I am trying to use an object tag like below:</p>
<pre><code>function writeNewHtml(parm1, height, width) {
$('#div').html("object/embed tag");
}
</code></pre>
<p>So my question is, is there any reason as to when using the object tag it writes the inner html only once, but if I use any other tag it works as expected?</p>
|
javascript jquery
|
[3, 5]
|
5,107,886 | 5,107,887 |
Enum values in a list
|
<p>I've a enum class like,</p>
<pre><code>public enum USERTYPE
{
Permanant=1,
Temporary=2,
}
</code></pre>
<p>in my business object I just declare this enum as</p>
<pre><code>private List<USERTYPE> userType=new List<USERTYPE>;
</code></pre>
<p>and in the get/set method, I tried like</p>
<pre><code>public List<USERTYPE> UserType
{
get
{
return userType;
}
set
{
userType= value;
}
}
</code></pre>
<p>here it returns the no of rows as 0, how can I get all the values in the Enum here, can anyone help me here...</p>
|
c# asp.net
|
[0, 9]
|
3,797,484 | 3,797,485 |
Can you re-use child layouts?
|
<p>Say I have a (programatically created) parent LinearLayout parent1 and I add a (programatically created) childA layout with <code>parent1.addView(childA);</code> then I set up childA in some complex way - perhaps it has its own children within it. Now can I subsequently somehow un-link it from parent1 without damaging any of the information within childA so that I can re-use it using parent2.addView(childA)?</p>
|
java android
|
[1, 4]
|
1,032,457 | 1,032,458 |
Use jQuery to hide a div until multiple check boxes are selected
|
<p>I need to use jQuery to hide a div until all five check boxes below are selected. I know how to do this for a single check box but not for multiple check boxes.</p>
<p>This is what I have so far.</p>
<pre><code><input type=checkbox id="cb1" name="cb1">
<input type=checkbox id="cb2" name="cb2">
<input type=checkbox id="cb3" name="cb3">
<input type=checkbox id="cb4" name="cb4">
<input type=checkbox id="cb5" name="cb5">
<div id="hidden">some stuff</div>
</code></pre>
<p>jQuery below only hides/shows div if one check box is unselected/selected.</p>
<pre><code>('#hidden').hide();
$('#cb1').click(function() {
if($('#cb1').is(':checked'))
{
$('#hidden').show();
}
else
{
$('#hidden').hide();
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,445,143 | 2,445,144 |
Getting null for input type file field on jQuery .click()
|
<p>I'm trying to upload a file using jQuery .click().I'm getting only file name when I do request.getParameter() in my controller. Further I cant read that file with only file name.
But when I use action to my form I will get the object of the file. But I don't want to use action to my form.</p>
<p>My html is -</p>
<pre><code>$(document).ready(function(){
$('#submitId').click(function(){
var url=$("#urlId").val();
var xsl=$("#xslId").val();
alert(xsl);
$.post('add.htm', {
url:url,
xsl:xsl
},function(data){
alert("done");
});
});
});
<form:form commandName="domTool" enctype="multipart/form-data"
method="POST" >
URL :
<form:input path="url" id="urlId"/>
Xsl File :
<form:input type="file" id="xslId" path="file" />
<input type="button" value="Submit" id="submitId"/>
</form:form>
</code></pre>
<p>And my java code is -</p>
<pre><code>@RequestMapping("add")
public String add(@ModelAttribute("tool") DomTool domTool,HttpServletRequest request,HttpServletResponse response) throws JDOMException, IOException{
System.out.println("file---------- "+tool.getFile());
System.out.println("Url---------- "+domTool.getUrl());
return "success";
}
</code></pre>
<p>I'm getting value of url but I'm getting null for domTool.getUrl().</p>
<p>Please anyone help.</p>
<p>Thank you.</p>
|
java jquery
|
[1, 5]
|
4,212,119 | 4,212,120 |
Dropdown list value when enabling and disabling through javascript
|
<p>I am using a asp.net Drop down list control which is disabled using javascipt, when I am trying to retrieving the value server side the default value is being set on postback.</p>
<p>It is a Web Project and Iam using VS2008.</p>
|
javascript asp.net
|
[3, 9]
|
3,181,349 | 3,181,350 |
How we can show doted navigation for next and previous screens in android?
|
<p><img src="http://i.stack.imgur.com/xxIJ1.png" alt="enter image description here"></p>
<p>I want to show dots for next and previous and for go to specific screen in android by click on that dots.
Can use the image like dots to do this?
and can i know the code for this?</p>
|
java android
|
[1, 4]
|
715,840 | 715,841 |
Not able to access Data inside Javascript Array
|
<p>HI , </p>
<pre><code> var jsonObj = [] ;
for (var i = 0; i < data.jobs.length; i++) {
jsonObj.push({id: data.jobs[i].Dater, optionValue: data.jobs[i].INCPU});
}
alert(jsonObj);
</code></pre>
<p>I am getting as result as </p>
<pre><code>[object Object],[object Object],[object Object]
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,233,990 | 4,233,991 |
.first('li) select first item in the list not working
|
<p>Hope you can help, this code is not working. It is selecting the next image ok, but if it is on the last image and there is no 'next image' then I want to select the first image in the 'li'. I've added an if condition: if (nextLi.value !=='')... but this doesn't seem to be working.</p>
<pre><code> function nextImg(){
$('#background').find('img').animate({'opacity': 0}, 500, function (){
var nextLi = $('.sel').parent().parent().next('li').find('a');
if (nextLi.value !=='') {
var nextLiA = nextLi.attr('rel');
$('#background').find('img').attr({'src':nextLiA});
$('.sel').appendTo(nextLi);
} else {
var nextLi = $('.sel').parent().parent().first('li').find('a');
var nextLiA = nextLi.attr('rel');
$('#background').find('img').attr({'src':nextLiA});
$('.sel').appendTo(nextLi);
}
});
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,231,102 | 5,231,103 |
Search function to add & remove options from select dropdown
|
<p>Here is my crazy code:</p>
<pre><code>t.config.searchSpanInput.keyup(function () {
var searchCriteria = t.config.searchSpanInput.val();
$.each (t.config.promoInput, function (i, v) {
$.each ($(v + " option"), function (j, v) {
if (optObj[i][j].text().toLowerCase().indexOf(searchCriteria.toLowerCase(), 0) === -1) {
$(v).remove();
}
if (optObj[i][j].text().toLowerCase().indexOf(searchCriteria.toLowerCase(), 0) > -1) {
if (optObj[i][j].length === 1) {
$(v).append(optObj[i][j][0]);
}
}
if (! optObj[0][0]) {
$(v).prepend(optObj[0][0]);
}
});
});
});
</code></pre>
<p>So... All of that is trying to do a somewhat simple task.</p>
<ul>
<li>On page load get all of the select boxes and all of their options and store them in an array. (this part of the code isn't shown in my example)</li>
<li>On keyup of the search box iterate through all of the select dropdowns and their options. - If the text entered in the search box matches any of the text stored in the options in the array then leave those matching options in the select dropdown.</li>
<li>If the text entered does not match any options, remove those options from the select dropdown.</li>
<li>If the text entered in the search box matches any of the text stored in the options in the array, but it does not exist in the DOM, add it back in.</li>
<li>Lastly, keep the top option in all the select boxes always on top. This option says "(All)".</li>
</ul>
<p>Any help would be appreciated. I'm currently getting a <code>Node cannot be inserted at the specified point in the hierarchy</code> on line 3 of jquery.min.js. :(</p>
|
javascript jquery
|
[3, 5]
|
4,722,799 | 4,722,800 |
Adding controls dynamically on user selection in c#.net
|
<p>I have a dropdown which consists of all the controls names like textbox , label , combobox , dropdown list...etc.
if in the starting one label control is placed on form,on user selection of control name in dropdown list ,that label control should be replaced with the user selected control dynamically...like this,what ever control user wants to keep can keep just by selecting dropdow</p>
<hr>
<p>i need the controls to be dynamic.that is only the requirement.whenever a person ,say admin want to change the controls from CMS,he can easily change with the selection.</p>
|
c# asp.net
|
[0, 9]
|
5,696,995 | 5,696,996 |
automatically detect web browser window width change?
|
<p>i know that you with $(window).width() can get the size of the web browser.</p>
<p>i want to detect when the user change the size of his web browser so i could readjust the columns width. is there a way to automatically detect this or do i have to use setTimeinterval to loop and see if it has changed?</p>
|
javascript jquery
|
[3, 5]
|
4,430,164 | 4,430,165 |
POST or GET method?
|
<p>We have a service provider that allows us to connect to his payment page for payments, however the code he uses is php but we would like to do it in asp.net.</p>
<p>Problem is I don't really understand what the method should be, <code>POST</code> or <code>GET</code>, basically we need to redirect to the client with underlying parameters(not query strings) and then our current page that calls the request must be redirected to the client page with the parameters as well.</p>
<p>I do get the response witch is basically markup, but that's not what I want, I want it to redirect to the payment page, can someone please tell me what I do wrong.Thanks
Here is my code I use for the <code>POST</code> Method:</p>
<pre><code>string query = string.Format("description={0}&amount={1}&merchantIdent={2}&email={3}&transaction={4}&merchantKey={5}",
description.ToString(), amount.ToString(), merchantIdent.ToString(), email.ToString(), id.ToString(), merchantKey.ToString());
// Create the request back
string url = "https://www.webcash.co.za/pay";
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.Method = "POST";
req.AllowAutoRedirect = true;
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = query.Length;
req.AllowAutoRedirect = true;
StreamWriter stOut = new StreamWriter(req.GetRequestStream(),System.Text.Encoding.ASCII);
stOut.Write(query);
stOut.Close();
// Do the request
StreamReader stIn = new StreamReader(req.GetResponse().GetResponseStream());
string response = stIn.ReadToEnd();
stIn.Close();
</code></pre>
|
c# asp.net
|
[0, 9]
|
3,515,483 | 3,515,484 |
check whether text field is empty or not jquery
|
<p>I have a div which contain lots of <code>input[type=text]</code> fields. I want to put a check that user must have fill all the fields otherwise show error message. For this i tried :</p>
<pre><code>if ($('div').children("input[type=text]").attr("value") == '')
flag = false;
else
flag = true;
</code></pre>
<p>But this will not check all the text field, it only checks the first-child . How can i check all the text field ?</p>
|
javascript jquery
|
[3, 5]
|
3,216,663 | 3,216,664 |
How do you format a line of text within a div when clicked?
|
<p><strong>Using jQuery or straight javascript, how do you identify / select / choose a single line of text from a div with contentEditable on and add formatting to that line of text only?</strong></p>
<p>I currently have a div with contentEditable set to true, which allows the user to edit the content of the div, adding/removing text as they see fit. However, I want the user to also be able to double-click any line of text within the div and mark that line with a different formatting style. <em>(i.e. enclose the full line of text within spans and then style the span. Note that I can style the span easily. My problem lies with identifying the line of text the user clicked and enclosing it in span tags)</em></p>
<p>Note that since the user can add a lot of content, the div itself is scrollable, so any solution should be able to handle the scrolling.</p>
|
javascript jquery
|
[3, 5]
|
2,001,118 | 2,001,119 |
jQuery pop ups without using third party jQuery libraries?
|
<p>New to jQuery, what are the possible ways to create pop up boxes using jQuery?</p>
<p>While searching in google I came across modal, is there any alternates to this? I prefer to use jQuery pop ups than going for third party jQuery tools.</p>
|
javascript jquery
|
[3, 5]
|
5,947,156 | 5,947,157 |
Comparing between strings goes wrong
|
<p>I have a class that generates the phone location and it updates a TextView every time a new location has retrieved.
We will name this class as Track.</p>
<p>The Track class contains a sendLocation object which is a Thread.
The sendLocation contatins a Track object and it checks every x time if the TextView has changed(the Track class got a method that returns the TextView string), how?</p>
<p>It save the last address in a string and compares between the last address and the Text View address every x time, if they are diffrent it sends this string to my db.
I do that to avoid duplicates.</p>
<p>My question is, how come it keeps sending same addresses to my db?I mean comparing strings is pretty simple.
Here is some code:</p>
<pre><code>if(!t1.getAddress().equals(lastAddress))
{
lastAddress = t1.getAddress();
//send last address to the db
//sleep for a while
}
</code></pre>
<p>t1 is a Track instance.</p>
<p>And here is the getAddress method in Track:</p>
<pre><code>public String getAddress()
{
return this.mAddress.getText().toString();
}
</code></pre>
<p>What's is wrong?it's a simple string comparing!!</p>
|
java android
|
[1, 4]
|
4,563,275 | 4,563,276 |
When element got visible in Javascript it toggle back to hidden
|
<p>Please help as when ever i clcik and call Javascript function to unhide an element it turn back hidden again. it takes a second or less.</p>
<p>HTML</p>
<pre><code><asp:Button ID="btnFromCalOpen" Width = "35" runat="server" Text="&gt;" style="display:none; visibility:hidden;" OnClientClick ="ShowCal()" />
</code></pre>
<p>Javascript</p>
<pre><code>function ShowCal() {
var elem = document.getElementById('MainContent_CalendarFrom');
if (elem.visibility = "hidden" ) {
alert("Show");
elem.style.visibility = "visible";
elem.style.display = "inline";
}
else {
alert("Hide");
elem.style.visibility = "hidden";
elem.style.display = "none";
}
}
</code></pre>
<p>it like when ever i click on the button it refresh its style properties of all elements</p>
<p>Please help</p>
|
javascript asp.net
|
[3, 9]
|
1,629,876 | 1,629,877 |
Split Panel using javascript
|
<p>I'm trying to code a split panel, Left and right. Each will have a button which you can click on and it will toggle that panel, while expanding the other. </p>
<p>I am clueless as to where to start off? Is there an example that already does this?</p>
<p>Can someone help me out. </p>
<p>Thanks</p>
|
php javascript jquery
|
[2, 3, 5]
|
1,310,097 | 1,310,098 |
Remove all but a specific row from a table
|
<p>I want to remove all rows apart from the row with id 'row0' from a table:</p>
<pre><code><table class="mytable">
<tr id="row0" class="myrow">
<td>aaa</td>
</tr>
<tr class="myrow">
<td>bbb</td>
</tr>
<tr class="myrow">
<td>ccc</td>
</tr>
</table>
</code></pre>
<p>But the following JQuery code removes ALL rows:</p>
<pre><code>$('.mytable').children().not('#row0').remove();
</code></pre>
<p>Could someone explain why this happens? I would think that the child with id 'row0' would be excluded, but obviously that's not the case.</p>
<p>I have found another way to do this but still curious why the above method doesn't work:</p>
<pre><code>$('.mytable').find('tr:not(#row0)').remove();
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,364,467 | 5,364,468 |
how to access a web control inside a userControl from aspx page
|
<p>i have 2 textbox controls inside a usercontrol TextBoxUC.ascx<br>
i have a page.aspx that contains the usercontrol. how can i get a reference to each textbox using javascript from page.aspx?</p>
|
c# asp.net javascript
|
[0, 9, 3]
|
3,251,002 | 3,251,003 |
Converting a value to 2 decimal places within jQuery
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1726630/javascript-formatting-number-with-exactly-two-decimals">JavaScript: formatting number with exactly two decimals</a> </p>
</blockquote>
<p>Now that I have got a bit of script to add values in to a div with a total in it, I then try to divide the values by 100 to give me a decimal number (to make it look like currency). </p>
<p>After this the script works and gives me a nice decimal float, sometimes though a large recurring number comes after, I want to limit this to two decimals using the script i already have so was wondering if someone could implement something into my current script.</p>
<pre><code>$(document).ready(function() {
$('.add').click(function() {
$('#total').text(parseFloat($('#total').text()) + parseFloat($(this).data('amount'))/100);
});
})
</code></pre>
|
javascript jquery
|
[3, 5]
|
977,241 | 977,242 |
how to get random item from an arraylist without any repeatation in android
|
<p>I have an <code>ArrayList</code> of an object from where I want items of a particular position, but everytime I launch the Activity the retrieved position should be randomize and also won't repeat until every position Item is completely retrieved. I used this method:</p>
<pre><code>public static int getRandomNumber(ArrayList<Integer> arr)
throws IllegalArgumentException {
try {
Random random = new Random();
int select = random.nextInt(arr.size());
int randomnum = arr.get(select);
GlobalData.randList.remove(select);
return randomnum;
} catch (IllegalArgumentException e) {
for (int i = 0; i < arr.size(); i++) {
GlobalData.randList.add(i);
}
return 0;
}
</code></pre>
<p>but its not working,like duplicate number is coming, there may be a reason because everytime I am re launching the activity. I did it in <code>oncreate</code> instead of <code>onResume</code> but its not working as I expected? Is there any other way to work with it? Any solution?</p>
|
java android
|
[1, 4]
|
491,111 | 491,112 |
Jquery change .text(something) then bring back
|
<p>If i have the following code:</p>
<p>html</p>
<pre><code><div class ="lg"> <img src="/images/images.gif"> </div>
</code></pre>
<p>javascript</p>
<pre><code>$('.lg').text("Correct");
</code></pre>
<p>The jquery will remove image and replace it with "Correct". This is only intended to be a delay before I need the image to reappear. so it will flash correct then bring back the original image.</p>
|
javascript jquery
|
[3, 5]
|
197,014 | 197,015 |
Setting Class-Level Variable to Use Between Event Handlers
|
<p>I'm having a hard time understanding why the following code doesn't work. I'm sure it's something remedial that I'm missing or not understanding. I currently have a page that asks for user input. If, based on the input and logged in user, I find data from this page already in the database, I need to update the existing records rather than creating new ones, so I set a class-level bool to true. The problem is, when MyNextButton is clicked, PreviouslySubmitted is still false. So, I'm not sure how to make the value of this variable persist. Any advice is appreciated, thanks.</p>
<pre><code>public partial class MyForm : System.Web.UI.Page
{
private bool PreviouslySubmitted;
protected void Page_Load(object sender, EventArgs e)
{
MyButton.Click +=
(o, i) =>
{
q = from a in db.TableA
where (a.SomeField == SomeValue)
select a;
if(q.Any())
{
PreviouslySubmitted = true;
//populate the form's fields with values from database for user to revise
}
}
MyNextButton.Click +=
(o, i) =>
{
//the value of PreviouslySubmitted is false at this point,
//even if I made sure it was set to true the previous postback
if(PreviouslySubmitted)
{
//update database
}
else
{
//insert into database
}
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,127,047 | 4,127,048 |
How to Copy a Folder(Not File by File) from server to Android Device
|
<p>I want to copy a folder from server which contains many files but without traveling through files in that folder.
I have URL of that folder and i want to copy that folder from web service.
Is is possible? if yes then please explain? </p>
|
java android
|
[1, 4]
|
1,343,445 | 1,343,446 |
Fade in Each Thumbnail?
|
<p>all of my thumbnails have the class .thumb</p>
<p>I'm trying to fade in each at a time like I've seen on some websites but it doesnt seem to be working. My code is below</p>
<pre><code>$('.thumb').eachDelay(function(){
$(this).fadeIn('1000');
}, 100);
</code></pre>
<p>What is wrong here?</p>
<p>Here is a fiddle: <a href="http://jsfiddle.net/NPWGu/" rel="nofollow">http://jsfiddle.net/NPWGu/</a></p>
<p>I've tried a ton of the solutions and havent had any luck yet so hopefully this will help make it easier to understand how I have my code setup</p>
|
javascript jquery
|
[3, 5]
|
960,594 | 960,595 |
How to call default email application from my android appcation
|
<p>I am new to Android application development and with very little java knowledge. I want to call the default Android email application from my application once a button is clicked. What code should i use ?</p>
<p>Thanks And Regards.</p>
|
java android
|
[1, 4]
|
4,155,189 | 4,155,190 |
Why does my type not load in ASP.Net site?
|
<p>I need to make a few changes in an C# ASP.Net web site.</p>
<p>I know C# and .net 3.5 but with this I am not very familiar.</p>
<p>When I run this program I get this error:</p>
<pre><code> Cannot load type FredCK.FCKeditorV2.Uploader
</code></pre>
<p>at the line:</p>
<pre><code> <%@ Page language="c#" Trace="false" Inherits="FredCK.FCKeditorV2.Uploader" AutoEventWireup="false" %>
</code></pre>
<p>I tried to put the FredCK.FCKeditorV2.dll in the Bin folder but nothing changed.</p>
<p>What could I do to solve this?</p>
|
c# asp.net
|
[0, 9]
|
3,911,610 | 3,911,611 |
changing an elements css position after scrolling down the page
|
<p>I am messing around with some jquery trying to get to grips with it.</p>
<p>I have a ul nav which has a absolute position set but after I scroll the page down by 200 pixels i would like that to switch to position fixed so that the nav always stays on the page.</p>
<p>How would I do this?</p>
<p>below is the example I am working on</p>
<p><a href="http://satbulsara.com/tests/">http://satbulsara.com/tests/</a></p>
|
javascript jquery
|
[3, 5]
|
1,884,506 | 1,884,507 |
c# asp.net table row always going in the same row
|
<p>I have this code</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
TblPrikaz.BorderWidth = 1;
XmlDocument baza = new XmlDocument();
XmlTextReader reader = new XmlTextReader(Server.MapPath("baza.xml"));
baza.Load(reader);
TableRow line = new TableRow();
TableCell id = new TableCell();
TableCell ime = new TableCell();
TableCell prezime = new TableCell();
TableCell godiste = new TableCell();
id.Text = "ID";
ime.Text = "Ime";
prezime.Text = "Prezime";
godiste.Text = "Godiste";
line.BackColor = Color.Green;
line.Cells.Add(id);
line.Cells.Add(ime);
line.Cells.Add(prezime);
line.Cells.Add(godiste);
TblPrikaz.Rows.Add(line);
XmlNodeList popis = baza.GetElementsByTagName("element");
for (int i = 0; i < popis.Count; i++)
{
if (string.Compare(popis[i].Attributes["ID"].Value.ToString(), "0") == 0) continue;
id.Text = popis[i].Attributes["ID"].Value.ToString();
ime.Text = popis[i].ChildNodes[0].InnerText;
prezime.Text = popis[i].ChildNodes[1].InnerText;
godiste.Text = popis[i].ChildNodes[2].InnerText;
line.Cells.Add(id);
line.Cells.Add(ime);
line.Cells.Add(prezime);
line.Cells.Add(godiste);
TblPrikaz.Rows[i].Cells.Add(id);
TblPrikaz.Rows[i].Cells.Add(ime);
TblPrikaz.Rows[i].Cells.Add(prezime);
TblPrikaz.Rows[i].Cells.Add(godiste);
}
}
</code></pre>
<p>for some reason, the table only shows the loast row read fromthe document and I have no idea why it is doing that.</p>
<p>Anyone have an idea?</p>
|
c# asp.net
|
[0, 9]
|
2,108,270 | 2,108,271 |
Equivalent statments in Java for C# formated string cout
|
<p>What is the Java equivalent instruction for the following statements:</p>
<pre><code>String name;
cout << "So your name is " << name << endl;
</code></pre>
<p>Or in C#</p>
<pre><code>console.writeline("So your name is {0} ", name);
</code></pre>
|
c# java
|
[0, 1]
|
4,577,978 | 4,577,979 |
Get two values from one with jQuery
|
<pre><code><div>345000000, 46400000000</div>
</code></pre>
<p>How do I make two values from the text of this <code><div></code>? They are divided by comma.</p>
<p>We should get <code>var value_1 = 345000000</code> and <code>var value_2 = 46400000000</code></p>
|
javascript jquery
|
[3, 5]
|
1,442,683 | 1,442,684 |
Get values from multiple selections in SELECT
|
<p>I have a selection box that allows you to select multiple options. I need to access all the selected values with JavaScript - possible a array of values?</p>
<p>Thank you :-)</p>
|
javascript jquery
|
[3, 5]
|
4,327,727 | 4,327,728 |
Javascript sliding (preferably jQuery)
|
<p>I am trying to think of the name of the plugin (or a plugin) that slides content in (up or down).</p>
<p>So I have a hidden div, I click on one of the titles/header, it opens the hidden div, if I click on another header it hides the other visible div, and slides up or down the new one.</p>
<p>I can't think of it for some reason.. anyone?</p>
|
javascript jquery
|
[3, 5]
|
3,327,168 | 3,327,169 |
php user information for callback
|
<p>in regular php script function the user sends data and the php have a method which give the user output.
<br>
is there a way to write a php script that holds the details for communicate with the user, and to send him data later ?
<br>
kind of notafication service ?</p>
<p>i need it for a server script which should be used by an android application.</p>
<p>i want my user to send data to the php server (hopefully throw http request) and i want to server - if needed - will send the user data when needed...</p>
|
php android
|
[2, 4]
|
4,809,604 | 4,809,605 |
How to find and replace begin tag and end tags in an html string using javascript/jquery
|
<p>How to find and replace begin tag and end tags in an html string using javascript/jquery</p>
<p>for example</p>
<pre><code>var myString = "<span> Hello john</span><div> John likes to play guitar </div> <div style="color:Blue;font-weight:bold" class='quotes'>Anna likes to arrange flowers
</div>";
</code></pre>
<p>I need to find the "div" tag and replace with other html tag like "p" tag/ "span" tag</p>
<p>Resulting html string after replace "div" tag to "p" tag </p>
<pre><code>var replacestring="<span> Hello john</span><p> John likes to play guitar </p> <p style="color:Blue;font-weight:bold" class='quotes'>Anna likes to arrange flowers
</p>";
</code></pre>
<p>Please suggest any solution.</p>
|
javascript jquery
|
[3, 5]
|
4,392,559 | 4,392,560 |
How to convert format date from PHP to Javascript
|
<p>I have a php file which I will later change into the form of an HTML file, which be current constraints are:
<strong>- Date format using Javascript.</strong></p>
<p>Her script like the following snippet:</p>
<pre><code><script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<?php
/* Set start and end dates here */
$startDate = strtotime("15 August 2012 12:00:00");
$endDate = strtotime("15 November 2012 12:00:00");
/* /Set start and end dates here */
?>
<script type="text/javascript">
$(document).ready(function(){
JBCountDown({
secondsColor : "#ffdc50",
minutesColor : "#9cdb7d",
hoursColor : "#378cff",
daysColor : "#ff6565",
startDate : "<?php echo $startDate; ?>",
endDate : "<?php echo $endDate; ?>",
now : "<?php echo strtotime('now'); ?>",
seconds : "<?php echo date("s"); ?>"
});
});
</script>
</code></pre>
<p>please help me to overcome it.
I want to run a php script in javascript that is being subordinated.</p>
<p>example:</p>
<pre><code><script type="text/javascript">
$(document).ready(function(){
JBCountDown({
secondsColor : "#ffdc50",
minutesColor : "#9cdb7d",
hoursColor : "#378cff",
daysColor : "#ff6565",
startDate : startDate, //format time in JS
endDate : endDate, //format time in JS
now : strtotime('now'), //format time in JS
seconds : date("s")
});
});
</script>
</code></pre>
<p>Please help,
Regards</p>
|
php javascript
|
[2, 3]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.