|
This might help:
Javascript:
var replaceWordChars = function(text) {
var s = text;
s = s.replace(/[\u2018\u2019\u201A]/g, "\'");
s = s.replace(/[\u201C\u201D\u201E]/g, "\"");
s = s.replace(/\u2026/g, "...");
s = s.replace(/[\u2013\u2014]/g, "-");
s = s.replace(/\u02C6/g, "^");
s = s.replace(/\u2039/g, "<");
s = s.replace(/\u203A/g, ">");
s = s.replace(/[\u02DC\u00A0]/g, " ");
return s;
}
C#:
public static string ReplaceWordChars(this string text)
{
var s = text;
s = Regex.Replace(s, "[\u2018\u2019\u201A]", "'");
s = Regex.Replace(s, "[\u201C\u201D\u201E]", "\"");
s = Regex.Replace(s, "\u2026", "...");
s = Regex.Replace(s, "[\u2013\u2014]", "-");
s = Regex.Replace(s, "\u02C6", "^");
s = Regex.Replace(s, "\u2039", "<");
s = Regex.Replace(s, "\u203A", ">");
s = Regex.Replace(s, "[\u02DC\u00A0]", " ");
return s;
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard,
Thank you very much sir; exactly what I was looking for.
|
|
|
|
|
Hi,
I have couple of divs and spans are inserted within one another, but in a particular situation I want to make inner div visible or show when outer div is hidden or invisible. Please help me with this regard. Here is the code snippet for it.
Where the condition if (event.target.checked) outer div WaitListDiv is hidden and then I want to show the OptOutDiv inner div, but it is not showing up, please let me know if there is anyway to resolve this issue. I have tried all those options which are commented and un-commented. When I tried with the code OptOutDiv.show("fast"); then it gave me error "uncaught typeerror undefined is not a function" on the browser debugging.
Thanks in advance.
Here is the element
<div class="my-section" id="WaitListDiv">
<p>
It is recommended that this child be placed on a waiting list as soon as possible. This allows all ELMS
users at the Waiting List site(s) the ability to provide services to the child in a more timely fashion.
</p>
<div id="OptOutDiv">
<asp:CheckBox ID="chkOptOut" runat="server" Text="Parent Does Not Wish to Add Child to Waiting List" AutoPostBack="true" />
<span id="spnOptOutReason" runat="server">
<asp:Label ID="lblOptOutReason" runat="server" AssociatedControlID="txtOptOutReason" Text="Reason:" />
<asp:TextBox ID="txtOptOutReason" runat="server" DataField="OptOutOfWaitListReason" DataType="PrescreenData" />
<asp:Button ID="btnSaveReason" runat="server" Text="Save Opt Out Reason" />
</span>
</div>
<elms:AvailableWaitingLists runat="server" ID="waitList" />
</div>
Here is javascript/jquery code
optOut: function (event) {
var waitListDiv = $("[id$='grdWaitList']").closest("div.my-container");
if (event.target.checked) {
waitListDiv.hide("fast");
var j = jQuery.noConflict();
j('#OptOutDiv').show("fast");
j('#spnOptOutReason').show("fast");
} else {
waitListDiv.show("fast");
$("[id$='spnOptOutReason']").hide("fast");
if ($("[id$='txtOptOutReason']")[0].value != "") {
$("[id$='txtOptOutReason']")[0].value = "";
ELMS.Common.sneakySave($("[id$='chkOptOut']")[0].name, true, ELMS.Page.sneakySave_Callback, ELMS.Page._originalOptOutCallback);
}
}
},
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
|
Please do not use these forums to advertise your articles, especially when posted on other sites. If you wish to publish it on CodeProject then read the Posting Guidelines[^].
|
|
|
|
|
Hello i i have this thing here http://jsfiddle.net/Trolstover/qxd32hkk/15/[^]
What i expect it to do is when you click on the Td element , it hide "..." and shows full word and vice versa , the problem is , that in my code it works randomly on elements, also if you fast click on elements , it gets bugged (it will show both "..." and full word at the same time)
How can i fix my code?
|
|
|
|
|
|
Hi , thanks for answer , try to click on one element multiple times , and also try all elements you will see the bug
|
|
|
|
|
It runs multiple times and blinks
I can't tell what the problem is, in other words the line of code at fault.
But I can tell you that it's sort of like non-async code, in which code runs straight through until it's done.
And your animation is like async, in which the animation must complete before the next line of code executes. You need some point of measurement to tell when the animation is complete.
I made a filmstrip and ran into the same problem. The principals are similar, but not the same.
[edit] - Consider my filmstrip, details in the article.
Display Advertising Filmstrip[^]
modified 16-Jan-15 13:04pm.
|
|
|
|
|
Hi,
I have a popup coming from a link on that popup I have a link that opens tooltip, when I click on anywhere on the popup, the tooltip closes which is perfect. But when I close the popup, unfortunately tooltip doesn't close, this is happening in IE browser.
I found the reason why it is happening, but I still don't know work around, because I am new to JQuery.
The reason is Popup is created and closed by using Popup.js file where as Tooltip is created and closed by some other xxx.js file. Then I tried to copy the Tooltip closing code and pasted it in Popup closing code, but then if we click close button on Popup, then Tooltip is closing but Popup is never closing at all.
Can somebody please help me any advice or link or suggestion or code snippet will be very helpful. Its urgent please help me, thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
That's interesting. So the Tooltip doesn't know that the modal display is no longer active? I've never bother to used the tooltip in a model display.
So which tooltip are you using, the one associated with asp.net objects? or is it a plugin as well?
You would have to reverse engineer the HTML that the tooltip produces, and look for a common denominator like the class name, id prefix, or element name, in order to use jquery to loop the common denominator and destroy them or something.
[edit]
I did the demo here on tooltip, looks like the asp.net object uses the tooltip attr to generate a title attr. Could not find the mechanics on how the browser knows to take a title and generate a tooltip out of it.
http://www.w3schools.com/aspnet/showaspx.asp?filename=demo_prop_webcontrol_standard_tooltip[^]
|
|
|
|
|
|
Hi,
They are using a different kind of tooltip, actually its a form only opens by using jquery but it functions just as tooltip. When I asked them why are you using this type of implementation the answer came up as they wanted to copy the content of the tooltip.
Weird kind of implementation I am banging my head to actually understand the UI, when they use lot of jquery and javascript.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
In the javascript i would like to save the uploaded file in the solution explorer folder after previewing.
here is the code:
<script type="text/javascript" >
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#imgPreview').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#FileUploadImage").change(function () {
readURL(this);
});
</script>
|
|
|
|
|
|
I think the getJSON should be taking the JSON URL and returning it as a response - The data file has Author x3 Body x3 and Title x3. Once it has this it should map it into the nodes and give me three nodes for each section of data.
However currently its giving me the console.log output that I have below and nothing in my nodes var.
Console Log:
script.js:7 [Object, Object, Object]0: Object1: Object2: Objectlength: 3__proto__: Array[0]
Code:
$(document).ready(function(){
var url = "assets/js/data.json";
$.getJSON(url).done(function(response) {
var nodes = response.map(function(i) {
return $('<div>').append(
$('<div>', {class: 'title'}).text(i.title),
$('<div>', {class: 'author'}).text(i.author),
$('<div>', {class: 'body'}).text(i.body)
);
console.log(response);
});
});
});
|
|
|
|
|
without the json file it is hard to say.
it looks like it is malformed.
|
|
|
|
|
I am performing a basic calculation using javascript and when I use this combination of number it won't calculate correctly:
alert((40071.13 + 6028.91) - 46100.04);
It should calculate to 0 but it doesn't. All other number combinations work for me.
Help!
|
|
|
|
|
|
hell sir/mam,
i need to advance cricket games source code in .net or java ,php,android in any technologies used
kindly help you...
|
|
|
|
|
"Sure Sir, do you want fries with that?"
Please note that it won't work this way. You need to show some effort and ask specific question where you are stuck.
Good luck!
Your time will come, if you let it be right.
|
|
|
|
|
Have you tried anything?
Start off with something and then post queries here.
|
|
|
|
|
Greetings, experts,
I have this code:
<div id="ExistingRequest">
<div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$("#doit").dataTable( {
"sProcessing" : true,
"sDom":'T<"clear">',
"sJQueryUI": true,
"aaSorting": [[ 1, "desc" ]],
"sPaginationType": "full_numbers",
"sDom": 'T<"clear"><"fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix"lfr>t<"fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix"ip>',
"sAjaxSource" : "getUserRequests.php?loginName=<?php echo $user; ?>",
"sAjaxDataProp" : "",
"sDestroy" : false,
"sScrollXInner": "110%",
"fnServerData" : function(sSource, aoData, fnCallback) {
request = $.ajax({
"dataType" : "json",
"type" : "GET",
"url" : sSource,
"data" : aoData,
"success" : fnCallback
});
},
"aoColumns" : [
{ "mDataProp": "RequestID", "sWidth": "50px", sSortable: true,
"bSearchable": false,
"bSortable": false,
"fnRender": function (oObj)
{
return "<a target='tab' data-tab-name='#RequestDetails' data-tab-index='1' href='getRequestDetails.php?loginName="
+ <?php echo json_encode($user); ?> + "&requestID=" + oObj.aData["RequestID"] + "'> " + oObj.aData["RequestID"] + " </a>";
}
},
{ mDataProp: "RequestDate", "sWidth": "100px", sSortable: true },
{ mDataProp: "RequestorFullName", "sWidth": "150px", sSortable: true },
{ mDataProp: "PrimarySiteContactDisplay", "sWidth": "250px", sSortable: true },
{ mDataProp: "RequestLocation", "sWidth": "150px", sSortable: true },
{ mDataProp: "RequestDescription", "sWidth": "200px", sSortable: true },
{ mDataProp: "RequestStatus", "sWidth": "100px", sSortable: true },
],
})
$('#doit tbody tr').click(function () {
if ($(this).hasClass('selected')) $(this).removeClass('selected');
else
{
$(this).siblings('.selected').removeClass('selected');
$(this).addClass('selected');
}
});
$(window).bind('resize', function () {
oTable.fnAdjustColumnSizing();
});
jQuery('.dataTable').wrap('<div class="scrollStyle" />');
$("#doit").on("click", "a[target='tab']", function(){
var me = $(this);
var url = me.attr("href");
var tabName = me.data("tabName");
var tabIndex = parseInt(me.data("tabIndex"), 10);
$.get(url, function(data) {
var table = $( '<table id="details" class="details" style="font-weight:bold;font-size:10pt;" cellpadding="4" width="100%" cellspacing="0" />'),
tr = $('<tr clss="d0"/>'),
td = $('<td/>'),
th = $('<th/>'),
table2 = $('<table class="details" style="background-color:#eeeeee;" cellpadding="4" width="100%" bordercolor="cellspacing="0" />');
tr = $('<tr clss="d1"/>'),
td = $('<td/>'),
th = $('<th/>'),
table2.html(tr.clone());
table2.append(tr.clone()).append(tr.clone());
var tr2 = table2.find('tr:first');
$.each(data[0], function(key,value) {
if($.inArray(key, ['RequestID','RequestInitiatedDate','RequestStatus','RequestClosedDate']) == -1) {
tr.clone().html(th.clone().html( key.replace(/[a-z][A-Z]/g, function(s) { return s.split('').join(' '); })))
.append(td.clone().html(value))
.appendTo(table);
} else {
th.clone().html( key.replace(/[a-z][A-Z]/g, function(s) { return s.split('').join(' ');
})).appendTo(tr2);
td.clone().html(value).appendTo(tr2);
if (key == 'RequestInitiatedDate') {
tr2 = tr2.next();
}
}
});
$(tabName).html(table2).append('<br>').append(table);
$("table#details tr:even").css("background-color", "#eeeeee");
$("table#details tr:odd").css("background-color", "#C0C0C0");
$("#tabs").tabs("option", "active", tabIndex);
}, 'json');
return false;
});
});
</script>
<style>
#doit{
border-collapse: separate;
}
table.details {
border: 2px inset #8B8378;
-moz-border-radius: 2px;
font-size: 12px;
text-align: left;
}
table.details td {
border: 1px solid black;
padding: 0.2em 2ex 0.2em 2ex;
font-size: 12px;
color: black;
}
table.details tr.d0 td {
background-color: #eeeeee;
font-size: 12px;
}
table.details tr.d1 td {
background-color: #FEFEF2;
font-size: 12px;
}
</style>
<script type="text/javascript">
$(document).ready(function()
{
$("table#details tr:even").css("background-color", "red");
$("table#details tr:odd").css("background-color", "blue");
});
</script>
<div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix">
<div class="fg-buttonset ui-helper-clearfix">
<div id="TableToolsToolbar" class="fg-buttonset ui-helper-clearfix"> </div>
<table><tr><td></td</tr></table>
<table cellpadding="0" cellspacing="0" border="0" style="width:100%;" class="display" id="cityworks">
<thead style="background-color:#666362; color:White; font-weight:bold;font-size:10pt;">
<tr style="border:solid 1px #000000;">
<th>ID</th>
<th>Date</th>
<th>Requestor</th>
<th>Site Contact</th>
<th>Location</th>
<th>Description</th>
<th>Status</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
<style>
table.dataTable tr.odd { background-color: #ffffff;font-size:8pt; }
table.dataTable tr.even { background-color: white;font-size:8pt; }
div.dataTables_scroll { clear: both; }
.dataTables_length { vertical-align:middle;nowrap }
.dataTables_filter { vertical-align:middle;nowrap; }
</style>
</div>
</div>
<div id="RequestDetails">
</div>
</div>
Notice #ExistingRequests.
This which is more like the Summary page and when a user clicks on any RequestId, it opens up request details, is my code
Then this code that produced this result:
<script type='text/javascript'>
$(function(){
$("#doit").on("click", function () {
var data = [{
RequestID: 1234,
RequestInitiatedDate: '01/01/2000',
RequestStatus: 'OK',
RequestClosedDate: '31/12/2000',
WONo: '25728',
WOStatus: 'In Design',
WONote: 'Project is too risky',
WOInitiatedDate: '12/17/2014',
ProjectedFinishDate: '04/16/2015'
}];
$.each(data[0], function (key, value) {
$("#tableRequestSummary td[name='" + key + "']").html(value);
$("#tableRelatedWorkActivity td[name='" + key + "']").html(value);
});
$("#divResultsSummary").show();
$("#divResultsRelatedWorkActivity").show();
});
});
</script>
</head>
<body>
<button id="doit" type="button">Do it Easy</button>
<div id="divResultsSummary" style="display:none">
<div>Request</div>
<div>
<table id=tableRequestSummary border=1>
<tr><td>Request ID</td><td name=RequestID></td><td>Request Initiated Date</td><td name=RequestInitiatedDate></td></tr>
<tr><td>Request Status</td><td name=RequestStatus></td><td>Request Closed Date</td><td name=RequestClosedDate></td></tr>
</table>
</div>
</div>
<p>some text here... some text here... some text here... some text here... some text here... some text here...</p>
<div id="divResultsRelatedWorkActivity" style="display:none">
<div>Related Work Activity</div>
<div>
<table id=tableRelatedWorkActivity border=1>
<tr><td>WO #</td><td name=WONo></td><td>WO Initiated Date</td><td name=WOInitiatedDate></td></tr>
<tr><td>WO Status</td><td name=WOStatus></td><td>Projected Finish Date</td><td name=ProjectedFinishDate></td></tr>
<tr><td>WO Note</td><td name=WONote colspan=3></td></tr>
</table>
</div>
</div>
I would like to integegrate this code which produces the result in the demo below into my code above:
http://jsfiddle.net/
Is this possible?
I apologize for the long code.
Thank you very much
|
|
|
|
|
Good afternoon,
i am a french student in France and i am studying informatics . For validating my term at the beginning of January i have a projet in JAVA to do called YAHTZEE. It's a game which i have to code WITHOUT USING AN OBJECTS. I already started the coding, i did all the beginning stuff ( to call the number and the names of players, to roll the 5 dices, i made the code for all the scoring points too(rules) ) but i can't do the table score which updates the new scores after each turn ( 3 turns in total) . So can someone please help me with that ??
Thank you very much .
|
|
|
|
|
Please use the correct forum, and provide a clearer description of what help you need.
|
|
|
|
|