In the past and with most my current projects I tend to use a for loop like this:
var elements = document.getElementsByTagName('div');
for (var i=0; i<elements.length; i++) {
doSomething(elements[i]);
}
I've heard that using a "reverse while" loop is quicker but I have no real way to confirm this:
var elements = document.getEleme...
Hi,
My master page contains a list as shown here. What I'd like to do though, is add the "class=active" attribute to the list li thats currently active but I have no idea how to do this. I know that the code goes in the aspx page's page_load event, but no idea how to access the li I need to add the attribute. Please enlighten me. Many t...
Hi All,
Thanks for reading. I'm a bit new to jQuery, and am trying to make a script I can include in all my websites to solve a problem that always drives me crazy...
The problem:
Select boxes with long options get cut off in Internet Explorer. For example, these select boxes:
http://discoverfire.com/test/select.php
In Firefox they ar...
Is there a standard way to convert an XSD to an input form (ASP.NET C#) so that later on whenever a new field is added / removed from the XSD the field on the page automatically shows up or goes away respectively, is this something which needs to be developed in-house I assume there must be a way to serializes / deserializes and generate...
Hi all, I need return a list of the element <AssetText>. My query below only returns back the first AssetText. Any thoughts much appreciated.
var q = from c in xDoc.Descendants("Product")
where (int) c.Element("ProductView").Element("ViewId") == 44
select (string) c.Element("ProductView").Element("AssetText").Element("T...
Which would be the correct format for this XML data, are they equivalent or are there trade offs between the two?
1.
<sitemap>
<category name="Animals">
<section title="Dogs">
<page url="/pics/greatdane.jpg" title="Great Dane"/>
</section>
</category>
</sitemap>
2.
<sitemap>
<page>
<category>Animals</category...
I want to change the text of a radio button (html element) not ASP.NET component.
How can I change it from ASP.NET?
Thanks
...
This is bothersome and seemingly rare to figure out. But what I have is the need to serialize a list of objects into XML without the containing list element. For instance:
public class Book
{
public string Name { get; set; }
}
public class Library
{
public List<Book> Books { get; set; }
}
I need to write it like so:
<Librar...
What is the purpose of anonymous { } blocks in C style languages (C, C++, C#)
Example -
void function()
{
{
int i = 0;
i = i + 1;
}
{
int k = 0;
k = k + 1;
}
}
Edit - Thanks for all of the excellent answers!
...
I am using jQuery UI and can create an simple drag 'n drop list.
But now, I want to drop the element into an other list. jQuery always thinks the item has been droppen on the false place and slides it back into the origin list.
...
Hi,
I have the following section in my app.config
<mySettings>
<addins>
<addin fullname="aaaaa"
path="ddddd"
version="ccccc"
enabled="true"
deleteonload="false" />
</addins>
</mySettings>
And im accessing it using a class that ...
std::vector< std::vector<coords> >::iterator iter;
for(iter = characters.begin(); iter != characters.end(); iter++)
{
std::vector<coords>* cha = iter; // doesn't work.
}
// does work.
std::vector<coords>* character = &characters.at(0);
coords* first = &character->at(0);
And I don't get why. Isn't iter supposed to be a pointer to an ...
Given an array of 81 elements (meant to represent a 9x9 grid) how can I go over each element, grabbing the three around it and then performing an operation on those, then continuing to the next three of each row, column, or submatrix. Look below or at a sudoku grid to see the layout.
define COL(n) ((n) % 9)
define ROW(n) ((n)...
I am creating a progressively built single-page (if Javascript is enabled) "blog" which uses AJAX to request HTML for new pages the user is navigating to.
When the user navigates to new pages they will be added one after another into the DOM in a small window with "overflow: hidden;":
<div id="foo" style="width:200px; height:100px;">
...
I need to count the number of elements in an XML file that have a particular value (to verify uniqueness). The XML file looks like this:
EDIT: I updated the original "simplified" XML with the actual hairy mess someone designed. Unfortunately, this is going to make all the previous Answers really confusing and wrong unless edited.
<root...
how can i make cool checkbox and selectbox elements in html form ,
that work in IE too ?
...
Do different browsers (Firefox/Safari/IE/Opera) have different limits on the length of the "name" attribute of form elements?
<input name='a012345678901234567890123456789012345678901234567890123456789 ...'>
...
I have an array like [1,1,1,2,4,6,3,3] and I would like to get the list of repeated elements, in this case [1,3]. I wrote this:
my_array.select{|obj|my_array.count(obj)>1}.uniq
But it is tragically inefficient (o(n²)). Do you have a better idea? If possible concise.
Thanks
...
I am trying to create an XSD schema which will validate the following xml.
<Item ItemGUID="3F2504E0-4F89-11D3-9A0C-0305E82C3301">The name of the item</Item>
I want to validate the max length of the attribute "ItemGUID" to 36 characters and "The name of the item" to a max 25 characters.
How can it be validated to satisfy the above con...
I'm going to develop a Firefox extension which should put a button in the loaded pages, when the tag: <input type="file" ... > is found and a file has been selected.
Likewise, I think the skype toolbar does a similar thing: when a website contains a phone number, the Skype extension automatically converts it into a button that can be cl...