Hi,
I have a div tag, nested with many span and div tags inside it.
now i want a regular expression in javascript which will strip the div and the content inside it.
thanks in advance..
hi there,
i have an asp.net mvc app which have quite a few hidden inputs to keep values around and formatting their names so that i can use the Model binding later when i submit the form.
i stumble into a weird bug with chrome which i don't have with IE or Firefox when the user submits the form and click on the back button, i find that chrome will keep my hidden input values as well.
this whole chunk is generated via javascript hence i believe chrome is caching this.
function addProductRow(productId, productName) {
if (productName != "") {
//use guid to ensure that the row never repeats
var guid = $.Guid.New();
var temp = parseFloat($(".tboProductCount").val());
//need the span to workaround for chrome
var szHTML = "<tr valign=\"top\" id=\"productRow\"><td class=\"productIdCol\"><input type=\"hidden\" id=productRegsID" + temp + "\" name=\"productRegs[" + temp + "].productId\" value=\"" + productId + "\"/>"
+ "<span id=\"spanProdID" + temp + "\" name=\"spanProdID" + temp + "\" >" + productId + "</span>"
+ "</td>"
//+ "<td><input type=\"text\" id=\"productRegName\" name=\"productRegs[" + temp + "].productName\" value=\"" + productName + "\" class=\"productRegName\" size=\"50\" readonly=\"readonly\"/></td>"
+ "<td><span id=\"productRegName\" name=\"productRegs[" + temp + "].productName\" class=\"productRegName\">"+ productName + "<\span></td>"
+ "<td id=\"" + guid + "\" class=\"productrowguid\" \>"
+ "<input type=\"text\" size=\"20\" id=\"productSerialNo" + temp + "\" name=\"productRegs[" + temp + "].serialNo\" value=\"" + "\" class=\"productSerialNo\" maxlength=\"18\" />"
+ "<a class=\"fancybox\" id=\"btnImgSerialNo" + temp + "\" href=\"#divSerialNo" + temp + "\"><img class=\"btnImgSerialNo\" src=\"Images/landing_14.gif\" /></a>"
+ "<span id=\"snFlag" + temp + "\" class=\"redWarning\"></span></td>"
+ "<td><input type=\"text\" id=\"productRegDate" + temp + "\" name=\"productRegs[" + temp + "].PurchaseDate\" readonly=\"readonly\" />"
+ "<span id=\"snRegDate" + temp + "\" class=\"redWarning\"></span></td>"
+ "<td align=\"center\"><img style=\"cursor:pointer\" id=\"btnImgDelete\" src=\"Images/btn_remove.gif\" onclick=\"javascript:removeProductRow('" + guid + "')\" /><div style=\"display:none;\"><div id=\"divSerialNo" + temp + "\" style=\"font-family:verdana;font-size:11px;width:600px\">" + serialnumbergeneral + "<br /><br />" + getSNImageByCategory(productId) + "</div></div></td>"
+ "</tr>";
$(".ProductRegistrationTable").append(szHTML);
$("a.fancybox").fancybox();
//initialization
$("#productRegDate" + temp).datepicker({
minDate: new Date(1996, 1 - 1, 1),
maxDate: 0
});
//sanity check
//s7test
alert('1 '+$("#spanProdID" + temp));
alert('2 '+$("#productRegsID" + temp));
} //end function addNewProductRow
i need the id to be refreshed when the user select a new product, but putting another span tag beside it shows that the span will have the new id will the hidden input will still have the previous id.
is there an elegant way to workaround this issue?
thanks
I've been chatting with my colleagues the other day and heard that their coding standard explicitly forbids them to use the var keyword in C#. They had no idea why it was so and I've always found implicit declaration to be incredibly useful when coding. I've never had any problems finding out what type the variable was (you only hover over the variable in VS and you'll get the type that way).
Does anyone know why it would be a bad idea to use the var keyword in C#?
I have this piece of code:
function func1(text) {
var pattern = /([\s\S]*?)(\<\?(?:attrib |if |else-if |else|end-if|search |for |end-for)[\s\S]*?\?\>)/g;
var result;
while (result = pattern.exec(text)) {
if (some condition) {
throw new Error('failed');
}
...
}
}
This works, unless the throw statement is executed. In that case, the next time I call the function, the exec() call starts where it left off, even though I am supplying it with a new value of 'text'.
I can fix it by writing
var pattern = new RegExp('.....');
instead, but I don't understand why the first version is failing. How is the regular expression persisting between function calls? (This is happening in the latest versions of Firefox and Chrome.)
Edit Complete test case:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Test Page</title>
<style type='text/css'>
body {
font-family: sans-serif;
}
#log p {
margin: 0;
padding: 0;
}
</style>
<script type='text/javascript'>
function func1(text, count) {
var pattern = /(one|two|three|four|five|six|seven|eight)/g;
log("func1");
var result;
while (result = pattern.exec(text)) {
log("result[0] = " + result[0] + ", pattern.index = " + pattern.index);
if (--count <= 0) {
throw "Error";
}
}
}
function go() {
try { func1("one two three four five six seven eight", 3); } catch (e) { }
try { func1("one two three four five six seven eight", 2); } catch (e) { }
try { func1("one two three four five six seven eight", 99); } catch (e) { }
try { func1("one two three four five six seven eight", 2); } catch (e) { }
}
function log(msg) {
var log = document.getElementById('log');
var p = document.createElement('p');
p.innerHTML = msg;
log.appendChild(p);
}
</script>
</head>
<body><div>
<input type='button' id='btnGo' value='Go' onclick='go();'>
<hr>
<div id='log'></div>
</div></body>
</html>
The regular expression continues with 'four' as of the second call on FF and Chrome, not on IE7 or Opera.
I just noticed that when I publish an action on the user's timeline for the same object multiple times, using facebook's 'built-in' action type (eg: 'read' an article), i get an error response, something like "action is already associated to the user on this object". But when i try to do the same for a custom action that i created(eg: 'agreed' with an article), I don't get any error message, instead the actions gets published multiple times. I want my custom action to behave just like facebook's default action-type.
I have a producer-consumer like scenario. Class A produces objects of type E. I have to hold it in a static data structure in class A, because the consumer logic should be handled in a class B, which has no reference to object of A. Is LinkedBlockingQueue the correct data type for the queue? Or are there any better selection for this?
hi,
i load a class using
Class.forName(klassname,false,loader)
After this i create an instance using
klass.newInstance();
It returns an object type.I want to cast it to specific type(ie.Klassnamw instance).I used normal casting but it gets hung because it is not resolved during runtime.How can i cast it?Hellp
I am making a site where I need to have styles separated for layout, colors and typography. So basically I took my main style sheet and just copied it 3 times, and in removed everything but coloring from one, everything but type related in another and etc.
But when I link to them now there must be some cascade issue or something, because a lot of the type stuff is not being applied. Is there a proper way to do this?
im trying to work through some questions and im not sure how to do the following
Q:Find the hard drive sizes that are equal among two or more PCs.
its q15 on this site
http://www.sql-ex.ru/learn_exercises.php#answer_ref
The database scheme consists of four tables:
Product(maker, model, type)
PC(code, model, speed, ram, hd, cd, price)
Laptop(code, model, speed, ram, hd, screen, price)
Printer(code, model, color, type, price)
any pointers would be appreciated.
Is it possible to evaluate a String as EL expression in JSP and get value from it?
I need an expression like ${model.${fieldPath}} where fieldPath will contain the required object path from a nested object model.
I can get the actual field path by using but I am not sure how to evaluate a string and get the value from it
Any help regarding this would be highly appreciated.
I have a script which displays images like this:
header("Content-Type: image/{$ext}");
readfile($image-path);
This has worked fine for weeks and now suddenly it has stopped working. The response header looks fine (Content-Type: image/jpg), I have no ending php-tag and I have made no changes to my code, server- or php-setup which could have caused this to malfunction. Does anyone have a clue as to what may be going wrong?
Thanks!
i have the following script
<input style="color: #ccc" type="text" value="something" name="country"
onFocus="if (this.value == 'something') {
this.value='';this.style.color='black';}"
onblur="if (this.value != 'something') {
this.value='something'}" />
<input type="submit" value="save" />
it works fine, but when i click on submit button, it also deletes the value "something"
so, what can i do, if i want, that when i click on submit button, value doesn't delete?
thanks
char b;
operator<<(cout,(operator>>(cin,b)));
this is not compiling in vc++ because all 8 overloads cant convert this type.
can any one explain this.....
is their a problem with return type...........
I know i already asked simillar question, but now when I work with jQuery Mobile I can't figure it out. So I have this form:
<div data-role="page" data-theme="a" id="login_page">
<div data-role="header" data-position="fixed">
<h1>****</h1>
</div>
<div data-role="content">
<form id="login_form" method="POST" data-ajax="false">
<label for="basic">Username:</label>
<input type="text" name="name" id="username" value=""/>
<label for="basic">Password:</label>
<input type="password" name="password" id="password" value=""/>
<input type="submit" value="Login" id="login" name="login"/>
</form>
</div>
<div data-role="footer" data-position="fixed">
<div data-role="navbar"></div>
</div>
</div>
And I need to submit Username and Password to php script, where php replies and send "success" or "failed". Here is php:
<?php
session_start();
$username = $_POST["name"];
$password = $_POST["password"];
include('mysql_connection.php');
mysql_select_db("jzperson_imesUsers", $con);
$res1 = mysql_query("SELECT * FROM temp_login WHERE username='$username' AND password='$password'");
$count=mysql_num_rows($res1);
if($count==1){
echo "success";
}else{
echo "failed";
}
?>
And to do all this I want to use this script:
$(document).ready(function() {
$("form").submit(function(){
$.mobile.showPageLoadingMsg();
$.ajax({
url: "http://imes.jzpersonal.com/login_control.php",
type: "POST",
dataType: "jsonp",
jsonp: "jsoncallback",
data: $("form#login_form").serialize(),
success: function( response ){
$.mobile.changePage( "http://imes.jzpersonal.com/user_panel.html");
}
});
return false;
});
});
But I can't make it work, I know I must have mistakes in there, I just can't find them, or better way to do it. Thank you in advance for any help.
I have a string from an xml document:
<title type="html">
Is there a way for me to write this string like "<title type="html">"? I've had similar problems writing javascript as a string but I did see some solutions in the past (which I can't remember)?
Thanks
I am using the calender module with it's iCal support for Drupal 6. I have made my event type which appear on the iCal feed. I however want to make the event content type private, so only authenticated users can read it. By doing this they will not show on the iCal feed. Is there any way that I could get the iCal feed to still show these events?
I found one limitation in Oracle UCM. Well it might not be limitation but I am not able to figure it out yet:
I didn't find mapping between metadata and content type. What if I wish to associate different set of metadata with different content type which is likely the case?
Thanks.
I'm looking for a way to grab the custom attributes of a element with jquery.
<span id='element' data-type='foo' data-sort='bar'></span>
I'm looking to get: `["data-type", "data-sort"]` as an array.
Anyone know how to do this?
Thanks.
I have this scenario in most of the WindowsForms having grids
I have a sequence of code which is similar -
AddNewRow(in grid),CreateNewEntity,notifyUser,few other steps
Now, I want to use a template kind of pattern.But,my issue is with CreateEntity method since sometimes it is passed a parameter which is different depending on the type of object being created.Should I make createentity accept an "object" type,and cast when the parameter is to be used.What other way can I tackle this design issue? Also,CreateEntity returns the object being created.
type first integer , type second integer, , program repeatedly outputs the second value of the number of times indicated by the first value. Example use inputs 4 and 2, 222 2 displayed. another example user inputs 3 and 8 , 88 8 displayed
I want to make a script where i can put my form in the javascript array invoer[] and display the total
It constantly stops working and i searched a lot, i really can't find the right way :D
This is my javascript code
var strijk = ['broek', 'hemd', 'tshirt', 'lakens', 'korte broek', 'babykledij'];
var minuten = [5, 10, 5, 6, 3, 3];
function invoerstrijk() {
document.write("<form action='' method='get' name='strijkform'>");
for (var a = 0; a < minuten.length; a++) {
document.write(strijk[a] + "<input id='" + strijk[a] + "' name ='" + strijk[a] + "' type='text' />" + "<BR>");
}
document.write("<button onclick='opgeven()'>opgeven</button>");
document.write("</form>");
}
function opgeven() {
var invoer = [];
for (var a = 0; a < minuten.length; a++) {
invoer[a] = document.getElementByI(strijk[a]).value;
}
var totaal;
for (var a = 0; a < minuten.length; a++) {
totaal += parseint(invoer[a]) * parseint(minuten[a]);
}
document.write("<input name=" + strijk[a] + " type='text' value=" + invoer[a] + " readonly />");
if (invoer != []) {
document.write("totaal aantal minuten" + totaal);
} else {
document.write("geen invoer");
}
}
my html looks likes this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript" >
//my javasccript
</script>
<button id="B1" onclick="invoerstrijk()" >Nieuwe strijk</button>
</body>
</html>
Do Integer data types allow spaces when it should be just numeric?
Do other programming languages allow spaces in an Integer data type?
For example, MySQL database storage does not allow spaces to be stored in an int data type. Do other languages allow it?
Hello,
I have program where i want to scrap some Useful study material for me.
This site site maintaining session key and some other key also.
If I trying to go nested page then it will throw me out and showing session out message.
I unable to maintaining session key in web request class.
so please give me some idea that how can i maintain session in web request class.
Let's consider the following XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<schema
targetNamespace="http://www.example.org/library"
elementFormDefault="qualified"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:lib="http://www.example.org/library">
<element name="library" type="lib:libraryType"></element>
<complexType name="libraryType">
<sequence>
<element name="books" type="lib:booksType"></element>
</sequence>
</complexType>
<complexType name="booksType">
<sequence>
<element name="book" type="lib:bookType"
maxOccurs="unbounded" minOccurs="1"></element>
</sequence>
</complexType>
<complexType name="bookType">
<attribute name="title" type="string"></attribute>
</complexType>
</schema>
and a corresponding XML example:
<?xml version="1.0" encoding="UTF-8"?>
<lib:library
xmlns:lib="http://www.example.org/library"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.example.org/library src/library.xsd ">
<lib:books>
<lib:book title="t1"/>
<lib:book title="t2"/>
<lib:book title="t3"/>
</lib:books>
</lib:library>
Is there a way to guarantee that the order of <lib:book .../> elements is preserved? I want to be sure that any parser reading the XML will return books in the specified oder, that is first the book with title="t1", then the book with title="t2", and finally the book with title="t3".
As far as I know XML parsers are not required to preserve order. I wonder whether one can enforce this through XML Schema? One quick solution for me would be adding an index attribute to the <lib:book .../> element, and delegate order preservation to the application reading the XML.
Comments? Suggestions?