|
samflex wrote: Is it possible to take a number like [0 - 999,999,999,999] and convert it into its spoken equivalence using JavaScript? Anything is possible, of course. I would suggest looking for a text-to-speech app that can read web pages, or something along that line.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
You'd need some sort of OS hook (namely a plug-in), or send the selection to a server, that can parse it into a common audio format and send that back.
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
google "javascript numbers to words" and you'll find lots of results.
|
|
|
|
|
I have resolved this.
Thanks all
|
|
|
|
|
I want to extract a video name from XML and put it in the URL parameter. I copied the XML reading code from w3school. See below:
var tPath = ... the URL to the XML
var var2 = ... the filename of an XML
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
myFunction(this);
}
};
xmlhttp.open("GET", tPath, true);
xmlhttp.send();
function myFunction(xml) {
var x, xmlDoc, videoName;
xmlDoc = xml.responseXML;
x = xmlDoc.getElementsByTagName("videoName")[0];
videoName = (x.textContent);
alert (videoName);
}
var playerURL = "http://" + getCookie("MediaServerGeneral") + "/IVP/demo.htm?XMLName=" + var2 + "&MediaFileName=" + videoName;
I see the name of the video in alert. but the playerURL has videoName shown as undefined.
my XML is like this, and I'm trying to pick up "videoName.mp4":
<?xml version="1.0" encoding="utf-8" ?>
<video>
<videoName>videoName.mp4</videoName>
<setting>
<videoSize w="896" h="504"></videoSize>
</setting>
</video>
What is wrong with the script?
Thanks,
modified 25-Oct-16 18:02pm.
|
|
|
|
|
|
Just try to fetch the value of "x" in the below code outside "myFunction"
x = xmlDoc.getElementsByTagName("videoName")[0];
I am wondering, if the value of "x" is dying out. I also cant see the closing braces of "myFunction" or no return value of "x" from the function.
Is the below code a part of "myFunction" ?
var x, xmlDoc, videoName;
xmlDoc = xml.responseXML;
x = xmlDoc.getElementsByTagName("videoName")[0];
videoName = (x.textContent);
alert (videoName);
var playerURL = "http://" + getCookie("MediaServerGeneral") + "/IVP/demo.htm?XMLName=" + var2 + "&MediaFileName=" + videoName;
If so, just try out reading the value of the element out side the function and see.
Please let me know the result once.
Thanks
|
|
|
|
|
Thank you for your help. I forgot to copy the } after the alert(videoName). So myFunction ends after alert. var playerURL... is not part of the function.
I'm trying to take the script out of the function. I'll post back the result.
|
|
|
|
|
In a web form 2010 application, I am creating letters that need to be sent to various customers that are generated in html and are sent to 2 or 3 customers at the at different addresses. However each letter needs to be the same. The only difference is the mailing address. Thus I need each letter to be generated on separate pages. Thus I would like to know what html command can be used to made certain each letter is printed on separate pages. Thus can you tell me what the command would be?
|
|
|
|
|
This is exactly the same question that you posted yesterday:
web form generate html on separate pages - ASP.NET Discussion Boards[^]
Ryan has already given you the answer.
If you're just going to ignore valid answers to your question, why should anyone bother trying to help you?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have a javascript application and i wanted it to save data to local machine without using browser storage or Serverside code.
Pure Javasript and html.
|
|
|
|
|
Javascript doesn't have access to write to the local file system so it's not really possible.
|
|
|
|
|
Not possible unless eash user's machine is running Node.js[^].
(or some other runtime that exposes native API hooks to the browser)
"There are three kinds of lies: lies, damned lies and statistics."
- Benjamin Disraeli
|
|
|
|
|
I wrote this from scratch, and I'm trying to get the addClass to run the font spinner before the $ajax runs; but the $ajax is so fast, that the spinner never shows.
I tried queue, which works, if I queue after changing the class. But when I try to run it a 2nd time, it runs but sort of does nothing. I destroyed my queue work and reverted back to the sample below.
Tried Delay, but that seems to only work with animation.
Tried setTimeout, but had no luck.
Just nice to have, but can live without it.
function js_add2Cart(_sku) {
var $itemQty = $("#selectQty"),
$itemType = $("#Type"),
$spinner = $("#js-add2Cart > i"),
$NavCart = $("#navCartCount"),
_qty = parseInt($itemQty.val()),
_type = $itemType.val();
if (isNaN(_qty)) { _qty = 1; }
$.ajax({
type: "POST",
cache: false,
dataType: "json",
url: '/Ajax/json_add2cart',
data: { Sku: _sku, Qty: _qty, Type: _type },
beforeSend: function () {
$spinner.addClass('fa-cog fa-spin');
$("#js-add2Cart").html('Add to Cart').removeClass('error').addClass('add2cart');
},
error: function (xhr, ajaxOptions, thrownError) {
$("#js-add2Cart").removeClass('add2cart').addClass('error').html('Error has occured');
},
success: function (data) {
$NavCart.text(data);
},
complete: function () {
$("#js-add2Cart").html('Item added');
$spinner.removeClass('fa-cog fa-spin');
}
});
}
|
|
|
|
|
How about something like this:
$("#js-add2Cart").html('Add to Cart').removeClass('error').addClass('add2cart');
$("#js-add2Cart > i").addClass('fa-cog fa-spin');
setTimeout(function(){
var _qty = parseInt($("#selectQty").val(), 10),
_type = $("#Type").val();
if (isNaN(_qty)) { _qty = 1; }
$.ajax({
type: "POST",
cache: false,
dataType: "json",
url: '/Ajax/json_add2cart',
data: { Sku: _sku, Qty: _qty, Type: _type },
error: function (xhr, ajaxOptions, thrownError) {
$("#js-add2Cart").addClass('error').html('Error has occurred');
},
success: function (data) {
$("#js-add2Cart").html('Item added');
$("#navCartCount").text(data);
},
complete: function () {
$("#js-add2Cart").removeClass('add2cart');
$("#js-add2Cart > i").removeClass('fa-cog fa-spin');
}
});
}, 900);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I never thought about wrapping the $.ajax in a setTimeout. duh!
And I wrote up this morning thinking I could of just extended the Async delay in the call to the controller as well; duh!
Yours looks more elegant and reliable.
|
|
|
|
|
Well that was strange. Implemented both thoughts, and the same thing happened.
Did some isolating and figured the line to remove was the 'error' class and add the 'add2cart' class was should be the the villain; so I wrapped it with the if statement. Now it works right.
Guess jQuery was too busy processing that request.
I know that line will come back and haunt me soon, when it's triggered.
if ($("#js-add2Cart").attr('class') === 'error') {
$("#js-add2Cart").removeClass('error').addClass('add2cart').html('Add to Cart');
}
$spinner.addClass('fa-cog fa-spin');
if (isNaN(_qty)) { _qty = 1; }
$.ajax({
type: "POST",
cache: false,
async: false,
dataType: "json",
url: '/Ajax/json_add2cart',
data: { Sku: _sku, Qty: _qty, Type: _type },
error: function (xhr, ajaxOptions, thrownError) {
$("#js-add2Cart").removeClass('add2cart').addClass('error').html('Error has occured');
},
success: function (data) {
$NavCart.text(data);
},
complete: function () {
$("#js-add2Cart").html('Item added');
$spinner.removeClass('fa-cog fa-spin');
}
});
|
|
|
|
|
jkirkerx wrote: if ($("#js-add2Cart").attr('class') === 'error') {
It would probably be better to use .hasClass()[^] there:
if ($("#js-add2Cart").hasClass('error')){
That way, it will still work even if you have any other classes on the element.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I didn't know about that call, thanks!
will make the change now.
|
|
|
|
|
As a beginner in Big Data, where do i start to build a simple project or basic project in implement Big Data?
|
|
|
|
|
|
Having just been dipped into the steaming pile of crap based on hadoop/java I found the OPs question too stunning to attempt to answer.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I encounter this issue fairly regularly at work, and I'm interested in learning about how others handle it. Basically, when you have a Web app and you make some changes to a JavaScript file, how do you ensure that the correct script is loaded when users navigate to the updated Web app? We're using ASP.NET MVC, IIS 7.
I've done some digging online and a common solution seems to be appending some sort of identifier to script files in the markup, like this:
<script src="scripts/myscript.js?v=123"></script>
Where 'v' is maybe a version number or something along those lines, updated with each deployment. I came across a StackOverflow post in which someone provided a custom HtmlHelper method to append the file's 'LastWriteTime'. But I was wondering how you all handle this.
Thanks in advance!
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
|
Ah, wonderful! Thanks! I'll read over them today or tomorrow.
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|