我创建了一个简单的程序,使得两个数字的总和但是......程序是连接的,这太令人困惑了!有人可以帮忙吗?
function calculate() {
var numberOne = document.querySelector(".first").value;
var numberTwo = document.querySelector(".second").value;
var sum = numberOne + numberTwo;
document.querySelector(".result").innerHTML = "The sum of the two numbers is : " + sum;
}Run Code Online (Sandbox Code Playgroud)
<!doctype html>
<html>
<body>
<p>Calculate sum of two numbers !</p>
Enter 1rst Number:<br>
<input type="number" class="first" placeholder=""><br><br> Enter 2nd Number:<br>
<input type="number" class="second" placeholder=""><br><br>
<input type="button" onclick="calculate()" value="calculate">
<p class="result"></p>
</body>
</html>Run Code Online (Sandbox Code Playgroud)
我有以下设置:
现在我有一个应用程序loc可以为子域设置一些cookie loc3。我看到 cookie 在 chrome 网络响应中设置(或假设设置)。
Set-Cookie: MY_COOKIE=YUMM; domain=loc3.localdomain;
expires=Fri, 21-Jun-2019 10:48:58 GMT; path=/coolApp/bro
Run Code Online (Sandbox Code Playgroud)
然后在应用程序 atloc我有一个按钮,可以将用户发送到另一个应用程序 at loc2,将用户重定向到loc3at loc3.localdomain:8092/coolApp/bro/something/more。因此,此时我应该在 的应用程序请求中看到 cookie loc3,但我没有。
Cookie 设置:
FacesContext facesContext = FacesContext.getCurrentInstance();
//facesContext.getExternalContext().addResponseCookie("TEST", "TEST", properties); tried this too
//then in properties will be the maxAge, path and domain set
Cookie cookie = (Cookie) facesContext.getExternalContext().getRequestCookieMap().get("MY_COOKIE");
if(cookie == null){
cookie = new …Run Code Online (Sandbox Code Playgroud) function trycatch(myfunction, name) {
return function() {
try {
myfunction.apply(this, arguments);
} catch (e) {
console.log(e + name);
}
}
};
var rambo = {
create: function(i, j) {
return i
},
ramv: function() {
aler("")
}
};
for (var key in rambo) {
if (typeof rambo[key] === 'function') {
rambo[key] = trycatch(rambo[key], key);
}
}
console.log(rambo.create(1))Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>Run Code Online (Sandbox Code Playgroud)
我试图将try catch应用到我的所有函数中,但似乎它们没有返回值,我错过了什么?