|
Do you mean to change to color/background color of the cursor you moving around with your mouse? From JavaScript? Dynamically?
In web pages cursor image can be set by using CSS (possible also via JS, but it is still CSS), by setting the cursor property...
Cursor property supports some predefined values and a URL to an image...
As with most URL related CSS properties this one too can get a data-uri where URL requested...
A data-uri is an inline binary data-string that defines an image, like:
From CSS:
body {
cursor: url('data:application/cur;base64,base64stringoftheimage'), auto;
}
From JS:
document.bodystyle.cursor = "url('data:application/cur;base64,base64stringoftheimage'), auto";
Now you can create that base64-string for your image dynamically based on the color you want...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Hi, thanks for replying. I will attempt to use your solution and see what happens.
|
|
|
|
|
Greetings experts.
Is it possible to take a number like [0 - 999,999,999,999] and convert it into its spoken equivalence using JavaScript?
I have spent almost 30 minutes googling but could not come up with anything.
Thanks for your help in advance
|
|
|
|
|
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
|
|
|
|
|