|
AmalRaj@Sync wrote: I could not exactly compute the proper result I assume you got 1 as the two operands of XOR are different, but What have you expect?
XOR (^) is a bitwise operator, so assigning it on other types (like Boolean or String) can have interesting results. The reason of course is how type casting is done...
For instance "hello" ^ "word" will return 0 (both operands are the same?), the reason is that both operands are converted to numeric and yielded NaN...and NaN is the same as NaN...
As in your sample true converted to 1 and false to 0, so 1 ^ 0 yields 1...
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Strings are not booleans or numbers. If you use:
var s1 = "true";
var s2 = "false";
var result = s1 ^ s2;
you will (correctly) get a result of 0 . This is because the strings are "truthy" - when converted to a boolean, all non-empty strings convert to true .
Truthy and Falsy: When All is Not Equal in JavaScript[^]
If you use proper boolean values, you will get the expected result:
var s1 = true;
var s2 = false;
var result = s1 ^ s2;
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'd like to find a tutorial or code to learn how to do this: on a web page user enters text to search, then checks checkbox to indicate which fields to search.
* Testing should work in Firefox without installing anything else on my PC. Someone told me AJAX has some problems which disappear if run on a server, and I don't have access to a server with AJAX.
* I don't know if jquery would help me here or not. I know nothing about it.
* Find tutorials about filtering with XML, but not where they get user input from a form.
Screenshot of idea is here[^]
XML file is here:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="studies1.xsl"?>
<studies>
<!-- There is only one study in this example but
in real life there could be 500+.
-->
<study>
<authors>
<author>
<authorfname>Bill</authorfname>
<authorlname>Smith</authorlname>
<association>University of Foo</association>
<assocdept>Microbiology</assocdept>
</author>
<author>
<authorfname>Sandy</authorfname>
<authorlname>Green</authorlname>
<association>University of Foo</association>
<assocdept>Microbiology</assocdept>
</author>
<author>
<authorfname>Peter</authorfname>
<authorlname>Billowsails</authorlname>
<association>United Nations</association>
<assocdept>FAO</assocdept>
</author>
</authors>
<studytitle>How nematodes affect corn crops</studytitle>
<abstract>
These are usually several paragraphs long.
</abstract>
<tags>
<tag>corn</tag>
<tag>nematodes</tag>
<tag>IARC</tag>
</tags>
<publishdate>2016-02-03</publishdate>
<notes>Interesting study.</notes>
</study>
</studies>
I enclosed all the XML in pre and /pre tags and it still doesn't show. What am I doing wrong here?
modified 10-Jun-16 9:56am.
|
|
|
|
|
What architecture are you planning to use? MVC ?
|
|
|
|
|
Dear all,
I want show a picture fullscreen with one web page, but most of the web browers have address bars, toolbars and tab bars, I want show the picture without them all. For example, I use Chorme browser. How to implement it with JavaScript or other methods ?
Thanks all
|
|
|
|
|
In browsers that support it[^], you can use the fullscreen API:
And anticipating your next question, no, there is no way to launch fullscreen mode without asking for the user's permission.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi Richard,
It's very kind of you, thanks a lot, I'll do some tests and feedback later.
Thanks
|
|
|
|
|
Hi Richard,
Thank you once again, I have tried the API,it works and very useful for me. But not reach my goal, as you say there's no way to lanuch fullscreen mode without asking for the user's permission. I have tried to set the state of the key clicked when load the page, so that it can trigger fullscreen mode when open the page, but it does not work in this way. My goal is to show a photo on the screen like desk background pictures, and some other info like Date, temperature and so on.
For the device, may be I can ues Raspberry pi or my old computer.
For my goal, it's not only like a project of digital photo frame, but also a smart home controller.
First of first, show the photo with fullscreen, maybe I should try another solution, can please give me some suggests?
Thanks
B/R
Jiang
|
|
|
|
|
As I said, you cannot enter fullscreen mode without the user's permission.
If there was a way around that restriction, I'm sure every scam, malware and porn site would be doing it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I need simple Javascript code to "Revert To Saved" a fillable PDF form.
Thanks!
|
|
|
|
|
|
- Using Firefox v43.
- Trying example at Simple and Practical Introduction to Asynchronous JavaScript and XML (AJAX)[^]
- I'm a newbie here and with Javascript. If this isn't the right site for newbies just let me know. Some sites are somewhat hostile to newbies.
- I do have Ublock Origin in FF, I don't know if that or FF is blocking popups or not. If so, how do I get FF to not block popups from local HTM files?
I made the XML file and html file (which I called ajax1.htm) and opened it in Firefox. I clicked the button "ReadXML" and it did nothing, nothing changed in my browser.
I'm trying to figure out if FF does not support XMLHttpRequest or if something else is going on. Do you have any ideas?
EDIT: The bottom of ajax1.htm has been changed to this to test the Error() function via clicking a new button. I got no result from clicking the "Test error" button either. (The code formatting does not seem to be working.)
</script>
<script type="text/javascript">
function testButton() {
Error("This is an error");
}
</script>
<body>
<span id="xmlSpan"></span>
<input type="button" onclick="ReadXmlFile();" value="ReadXml" />
<input type="button" onclick="testButton();" value="Test Error" />
modified 25-May-16 15:14pm.
|
|
|
|
|
1. The link you posted is to an article. Usually if you have a question about the article you post it at the bottom of the article. In this case I think it's still valid that you asked here.
2. Notice the date on that article, 2009. Quite old in tech years. I suggest using jQuery and calling .ajax() instead. There are tons of examples online and jQuery is a library that keeps up with the various browsers so the same code should work in all browsers.
3. See jQuery.ajax() | jQuery API Documentation[^] for documentation.
4. Also, if you choose to stick with your original question, edit it and post the relevant code.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
When you have a question about code in an article, it's usually best to post it in the forum at the bottom of the article[^]. That way, the author will be notified of your question and have a chance to respond. The person who wrote the code is the person most likely to be able to answer your question.
Are you loading the page from a web site, or just double-clicking on the HTML file in Windows Explorer? You might have problems making AJAX requests work in a local file.
Have you tried checking the Web Console[^] (F12) for error messages?
Firefox definitely supports the XMLHttpRequest :
XMLHttpRequest[^]
Can I use... XMLHttpRequest advanced features[^]
Error isn't a built-in function, and doesn't appear to be defined in the article's code. Try using alert instead:
function testButton() {
alert("This is an error");
}
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I'm opening a local HTML file. And I didn't know Error() wasn't a standard function. So I'll look into that. Thanks.
If I put the html file on a web server (I have an account on sdf.org) will Ajax work then? That sounds like a PITA if Ajax won't work in a local file.
|
|
|
|
|
I'm not certain that it won't work from a local file; I've just seen a few issues crop up with local files that are resolved by using a web server.
You don't need a live server to deploy it. You can use a local instance of IIS, or create a project in Visual Studio and use IIS Express.
If you haven't got a copy of Visual Studio, you can get Community Edition for free:
Free Dev Tools - Visual Studio Community 2015[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
Hi,
I am beginner for AngularJS and learning, I am trying to execute the following AngularJS script, it is not firing. Can you please help me where did I do mistake?
Here is my script
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="">
<head>
<title>Using AngularJS Directives and Data Binding</title>
</head>
<body data-ng-init="names=['Abdul Aleem', 'Farha Tabassum', 'Abdul Muqtadir', 'Abdul Malik']">
Name :
<br />
<input type="text" data-ng-model="name" />{{name}}
<br />
<ul>
<li data-ng-repeat="personName in Names" > {{personName}} </li>
</ul>
<pre>
<div class="container" data-ng-controller="SimpleController">
<h3>Adding a Simple Controller</h3>
<ul>
<li data-ng-repeart="cust in customers">
{{cust.Name}} - {{cust.City}}
</li>
</ul>
</div>
<script>
function SimpleController($scope) {
$scope.customers = [
{ Name: 'AA', City: 'Sacramento' },
{ Name: 'AB', City: 'Plano' },
{Name: 'AC', City: 'Freemont'},
{ Name: 'AD', City: 'Nalgonda'},
{ Name: 'AE', City: 'Nalgonda' }
];
}
<script>
<script src="Scripts/WebForms/angular.min.js" >
</script>
</body>
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
try this,
the underline one are your mistakes
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="myapp">
<head>
<title>Using AngularJS Directives and Data Binding</title>
</head>
<body data-ng-init="names=['Abdul Aleem', 'Farha Tabassum', 'Abdul Muqtadir', 'Abdul Malik']">
Name :
<input type="text" data-ng-model="name" />{{name}}
<ul>
<li data-ng-repeat="personName in names"> {{personName}} </li>
</ul>
<div class="container" data-ng-controller="SimpleController">
<h3>Adding a Simple Controller</h3>
<ul>
<li data-ng-repeat="cust in customers">
{{cust.Name}} - {{cust.City}}
</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
<script>
var app = angular.module('myapp', []);
app.controller('SimpleController', SimpleController)
function SimpleController($scope) {
$scope.customers = [
{ Name: 'AA', City: 'Sacramento' },
{ Name: 'AB', City: 'Plano' },
{ Name: 'AC', City: 'Freemont' },
{ Name: 'AD', City: 'Nalgonda' },
{ Name: 'AE', City: 'Nalgonda' }
];
}
</script>
</body>
</html>
demo: JSFiddle[^]
|
|
|
|
|
add this line
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
angular js is missing..
|
|
|
|
|
Yeah thanks Karthik I did it that's why removed it but before removing you posted the answer it seems thank you very much for your help.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
welcome Abdul , You shall use "Quick Answers " for this, you could have got the solution 1 day back only.
|
|
|
|
|
Sure I will use it, thanks for bringing this into my notice, I have been using this site for a long time, maybe young people like you learn faster .God bless you Karthik.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi,
I changed it in the below way but still the
{{cust.Name}} - {{cust.City}} are giving me null values, web page is not showing any values against them.
Can you please help me why is it not showing me any values for cust.Name and cust.City?
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="myapp">
<head>
<title>Using AngularJS Directives and Data Binding</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</head>
<body data-ng-init="names=['Abdul Aleem', 'Farha Tabassum', 'Abdul Muqtadir', 'Abdul Malik']">
Name :
<br />
<input type="text" data-ng-model="name" />{{name}}
<br />
<ul>
<li data-ng-repeat="personName in Names" > {{personName}} </li>
</ul>
<pre>
<div class="container" data-ng-controller="SimpleController">
<h3>Adding a Simple Controller</h3>
<ul>
<li data-ng-repeart="cust in customers">
{{cust.Name}} - {{cust.City}}
</li>
</ul>
</div>
<script>
var app = angular.module('myapp', []);
app.controller('SimpleController',
function SimpleController($scope) {
$scope.customers = [
{ Name: 'AA', City: 'Sacramento' },
{ Name: 'AB', City: 'Plano' },
{ Name: 'AC', City: 'Freemont' },
{ Name: 'AD', City: 'Nalgonda' },
{ Name: 'AE', City: 'Nalgonda' }
];
});
</script>
</body>
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
try this, your task to find the difference
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" data-ng-app="myapp">
<head>
<title>Using AngularJS Directives and Data Binding</title>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
</head>
<body data-ng-init="names=['Abdul Aleem', 'Farha Tabassum', 'Abdul Muqtadir', 'Abdul Malik']">
Name :
<input type="text" data-ng-model="name" />{{name}}
<ul>
<li data-ng-repeat="personName in names"> {{personName}} </li>
</ul>
<div class="container" data-ng-controller="SimpleController">
<h3>Adding a Simple Controller</h3>
<ul>
<li data-ng-repeat="cust in customers">
{{cust.Name}} - {{cust.City}}
</li>
</ul>
</div>
<script>
var app = angular.module('myapp', []);
app.controller('SimpleController', function SimpleController($scope) {
$scope.customers = [
{ Name: 'AA', City: 'Sacramento' },
{ Name: 'AB', City: 'Plano' },
{ Name: 'AC', City: 'Freemont' },
{ Name: 'AD', City: 'Nalgonda' },
{ Name: 'AE', City: 'Nalgonda' }
];
});
</script>
</body>
</html>
|
|
|
|
|