[Solved] How can I change id in string

Since you are already using jquery: for (var i = 0; i < tab.length; i ++) { tab[i] = $(tab[i]).find(“tr”).first().attr(“id”, “id_” + i); } What this does: Create jquery objects from the html string: $(tab[i]) Find the first tr object: .find(“tr”).first() Set the attribute “id” of the object to “id_” + i: .attr(“id”, “id_” + … Read more

[Solved] Complicated regex in PHP

try this: <?php $q1 = “{Hello|Hi} sir.”; $q2 = “{How are you?|How are you doing?}”; $q = substr($q1, 1, strpos($q1,’}’)-1); $q_end = substr($q1, strpos($q1, ‘}’)+2); $parts = explode(‘|’,$q); echo “<select name=\”q1\”>\n”; foreach($parts as $part){ echo “\t<option value=\””.strtolower($part).”\”>$part</option>\n”; } echo “</select>\n”; echo $q_end . “\n”; $q = substr($q2, 1, strpos($q2, ‘}’)-1); $parts = explode(‘|’,$q); echo “<select … Read more

[Solved] My double function is not working correctly [closed]

You are missing the data types. The right code is: using System; namespace Application { class MainClass { public int times2 (int number) { return number * number; } public static void Main (string[] args) { times2(5); } } } 3 solved My double function is not working correctly [closed]

[Solved] Browser detection in PHP causes white screen [closed]

This is my first comment here sorry if its not perfect. I think its because you’re trying to echo everything at once. <?php if (strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Firefox’) !== FALSE || strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Chrome’) !== FALSE || strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Opera’) !== FALSE || strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Safari’) !== FALSE) { $str=”<script>$(document).click(function() {“; $str .= ‘ window.open(“http://google.com”, “_blank”);’; $str .= ‘ });’; … Read more

[Solved] Can someone tell me what this statement does? [closed]

a.strip().split() produces a list of strings of the form ‘a-b’ where the a and b are composed of digit characters. This means that: alignment = set([tuple(map(int, x.split(“-“))) for x in a.strip().split()) produces a set from a list defined by a list comprehension. The list comprehension takes each of these ‘a-b’ strings, spits it into two … Read more

[Solved] Filling a ViewList from an xml file [closed]

Have you looked at How does one parse XML files?, http://msdn.microsoft.com/en-us/library/cc189056%28v=vs.95%29.aspx, http://social.msdn.microsoft.com/Forums/en-US/xmlandnetfx/thread/efcb9fe3-8d1a-47b0-a35e-8415ac1a93bd/ or http://www.codeproject.com/Articles/7718/Using-XML-in-C-in-the-simplest-way ? At least one of those should prove useful. 1 solved Filling a ViewList from an xml file [closed]

[Solved] Complete change and adding of content in webpage [closed]

Assuming you have something like this: <div id=”somecontent”><video …><p>Video Caption</p></div> You can use simple DOM scripting to select the element and replace its contents: <script> var element = document.getElementById(“somecontent”); element.innerHTML = “<audio><p>New Caption</p>” </script> You would then tie this replacement to the onclick event of an input or a link styled to look like a … Read more