JavaScript: how to generate UUID for Internet Explorer 9?

Does anyone know how to generate UUID/GUID for Internet Explorer? I have code from Broofa at: http://www.broofa.com/2008/09/javascript-uuid-function/ this works fine on almost all the browsers except IE 9. this is how I do it: window.Guid = function () { function part() { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1).toUpperCase(); }; return {

JavaScript:如何为Internet Explorer 9生成UUID?

有谁知道如何为Internet Explorer生成UUID / GUID? 我有来自Broofa的代码:http://www.broofa.com/2008/09/javascript-uuid-function/ 这对几乎所有浏览器除了IE 9都能正常工作。 这是我如何做到的: window.Guid = function () { function part() { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1).toUpperCase(); }; return { NewGuid: function () { return (p

How to make a marquee cycle once at a button click?

What I am trying to achieve is so that a marquee plays once when I click the button. My problem is that if I set the loop to 1 then it only plays once and then does nothing. My other problem is that it stops midway with my current code if I let go of the left mouse button. Or it stops where it was. Is there any way to make it either play once when the button is pressed and then play again whe

如何使按钮点击一次选框循环一次?

我想要实现的是当点击按钮时,一个选取框会播放一次。 我的问题是,如果我将循环设置为1,那么它只播放一次,然后什么都不做。 我的其他问题是,如果我放开鼠标左键,它会在当前代码的中途停下来。 或者它停止在那里。 有没有什么办法让它在按下按钮时播放一次,然后再次按下按钮再次播放,并让它完全完成循环。 这里是代码,我打算使用java脚本代替html。 这是我现在的代码: <marquee behavior="scroll" direction="u

How do you create an instance of an instance in JavaScript

I want to make unique instances of a set of cars that different people can hold. The cars will have similar base specs but some of their properties and methods will vary. The problem I have is that I can't work out how this should work. How do you deal with or create instances of instances in JavaScript? var Car = function(make, country) { this.make = make; this.country = country

你如何在JavaScript中创建一个实例的实例

我想制作一组不同人可以拥有的汽车的独特实例。 这些汽车将拥有类似的基本规格,但其中一些属性和方法会有所不同。 我的问题是我无法弄清楚这应该如何工作。 你如何处理或创建JavaScript实例实例? var Car = function(make, country) { this.make = make; this.country = country; }; var Ferrari = new Car('Ferrari', 'Italy'); var fred = new Person() {}; var fred.cars['Ferrari'] = new Ferrari(1200, 300

How to test valid UUID/GUID?

How to check if variable contains valid UUID/GUID identifier ? I'm currently interested only in validating types 1 and 4, but it's not limit for your answer. Currently, UUID's are as specified in RFC4122. Therefore to validate a UUID... /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i ...ensures you have a canonically formatted UUID that is Version

如何测试有效的UUID / GUID?

如何检查变量是否包含有效的UUID / GUID标识符? 我目前只对验证类型1和4感兴趣,但对答案没有限制。 目前,UUID与RFC4122中的规定相同。 因此要验证UUID ... /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i ...确保您具有版本1至5的标准格式的UUID,并且是根据RFC4122的相应Variant。 注:大括号{和}不是规范的。 它们是一些系统和用法的人造物。 易于修改上述正则表达式以满足原

How do I generate a number after a button is clicked?

Possible Duplicate: How to create a GUID / UUID in Javascript? I need to have a script that generates random numbers and letters with a form that looks like this: M3KRT-CKKYV-YH4G4-YXP42-46FMT Prefer jQuery, or javascript. I know how to generate number when the button is click using the .click() method in jQuery. But I can not find out how to actually make the code :( 像这样:在JavaScr

点击按钮后如何生成数字?

可能重复: 如何在Javascript中创建一个GUID / UUID? 我需要一个脚本来生成随机数字和字母,其格式如下所示: M3KRT-CKKYV-YH4G4-YXP42-46FMT 更喜欢jQuery或JavaScript。 我知道如何使用jQuery中的.click()方法单击按钮时生成数字。 但我不知道如何实际使代码:( 像这样:在JavaScript中创建GUID / UUID? 为什么你在你的问题中包含Win7许可证密钥? 稍微修改这个例子: 在JavaScript中创建GUID / UUID? 并提

Detect a finger swipe through JavaScript on the iPhone and Android

How can you detect that a user swiped his finger in some direction over a web page with JavaScript? I was wondering if there was one solution that would work for websites on both the iPhone and an Android phone. Simple vanilla JS code sample: document.addEventListener('touchstart', handleTouchStart, false); document.addEventListener('touchmove', handleTouchMove, false); var xDown =

通过iPhone和Android上的JavaScript检测手指滑动

你怎么能检测到用户用JavaScript在网页上的某个方向上滑动手指? 我想知道是否有一种解决方案适用于iPhone和Android手机上的网站。 简单的香草JS代码示例: document.addEventListener('touchstart', handleTouchStart, false); document.addEventListener('touchmove', handleTouchMove, false); var xDown = null; var yDown = null;

Send message from content script to another

I am developping a google chrome extension. My purpose is to send message from my script1.js to script2.js. Here is what i wrote in my manifest.json { "matches": ["https://www.google.fr/"], "css": ["styles.css"], "js": ["script1.js"] }, { "matches": ["my_website.html"], "css": ["styles.css"], "js": ["script2.js"] }, Here is what i wrote in script1.js: chrom

从内容脚本发送消息到另一个

我正在开发一个谷歌浏览器扩展。 我的目的是将消息从我的script1.js发送到script2.js。 这是我在我的manifest.json中写的 { "matches": ["https://www.google.fr/"], "css": ["styles.css"], "js": ["script1.js"] }, { "matches": ["my_website.html"], "css": ["styles.css"], "js": ["script2.js"] }, 这是我在script1.js中写的内容: chrome.runtime.sendMessage('hello world

Chrome extension message being passed as object

I'm sending a message from the content script to the background page. The message is a URL which then gets ajax parsed in the background. When I console.log the data retrieved into background.js the console log is pure html, but when I send the message back to my content script the message is suddenly in an object, and I'm not sure why. Here is my code: Content_Script.js: chrome.ru

Chrome扩展程序消息作为对象传递

我从内容脚本发送消息到后台页面。 该消息是一个URL,然后在后台获取ajax解析。 当我console.log数据检索到background.js控制台日志是纯html,但是当我发送消息回我的内容脚本消息突然在一个对象,我不知道为什么。 这是我的代码: Content_Script.js: chrome.runtime.sendMessage({greeting: URL}, function(response) { console.log(response.farewell); //logs an object: Object {farewell: Object} $('#

Chrome Extension message passing : verify the sender

I'm writing a chrome extension in which content-script sends a message to background script. chrome.runtime.sendMessage({greeting: "hello"}, function(response) { console.log(response.farewell); }); When background.js receives this message it get's the sender information which has { ID, tab, url } I want to verify that this message was sent by content script that belong to my extensi

Chrome扩展程序消息传递:验证发件人

我正在编写一个chrome扩展,其中content-script将消息发送给后台脚本。 chrome.runtime.sendMessage({greeting: "hello"}, function(response) { console.log(response.farewell); }); 当background.js收到这条消息时,它会得到发送者的信息 { ID, tab, url } 我想验证此消息是由属于我的扩展的内容脚本发送的,没有其他内容。 如何验证发件人ID,background.js如何获取扩展名ID。 你不需要。 有两个与消息有关的不

how to handle this?

When installing anything via npm, it downloads dozens of not needed files. Usually I am looking for a library final build, a *.min.js file or anything like that but the rest is useless. How do you handle all these useless files? Do you remove them by hand or generate the final app with any build tool like gulp or grunt ? I'm quite confused as I have plenty of npm modules installed in my

如何处理这个?

当通过npm安装任何东西时,它会下载几十个不需要的文件。 通常我在寻找一个库最终版本,一个*.min.js文件或类似的东西,但其余的是没用的。 你如何处理所有这些无用的文件? 你是通过手工删除它们还是使用任何构建工具(如gulp或grunt生成最终的应用程序? 我很困惑,因为我的webapp中安装了大量的npm模块,文件夹大小约为50兆字节,但它可能只有2MB。 npm install --production 只是做一个npm安装会带来开发和运行时