How can I use console logging in Internet Explorer?

Is there a console logger for IE? I'm trying to log a bunch of tests/assertions to the console but I can't do this in IE. You can access IE8 script console by launching the "Developer Tools" (F12). Click the "Script" tab, then click "Console" on the right. From within your JavaScript code, you can do any of the following: <script type="text/javascri

如何在Internet Explorer中使用控制台日志记录?

有没有IE浏览器的控制台记录器? 我想记录一堆测试/断言到控制台,但我不能在IE中做到这一点。 您可以通过启动“开发工具”(F12)访问IE8脚本控制台。 点击“脚本”标签,然后点击右侧的“控制台”。 从您的JavaScript代码中,您可以执行以下任何操作: <script type="text/javascript"> console.log('some msg'); console.info('information'); console.warn('some warning'); console.error('some erro

Why does JavaScript only work after opening developer tools in IE once?

IE9 Bug - JavaScript only works after opening developer tools once. Our site offers free pdf downloads to users, and it has a simple "enter password to download" function. However, it doesn't work at all in Internet Explorer. You can see for yourself in this example. The download pass is "makeuseof". In any other browser, it works fine. In IE, both buttons do noth

为什么只有在IE中打开开发人员工具后才能使用JavaScript?

IE9错误 - JavaScript只能在打开开发者工具后才能使用。 我们的网站为用户提供免费的pdf下载,并有一个简单的“输入密码下载”功能。 但是,它在Internet Explorer中完全不起作用。 你可以在这个例子中看到自己。 下载通行证是“makeuseof”。 在任何其他浏览器中,它工作正常。 在IE中,两个按钮都不起作用。 我发现的最奇怪的事情是,如果你用F12打开和关闭开发者工具栏,它会突然开始工作。 我们尝试过兼容模式等等

Propagate Permissions to Javascript

I'm debating the best way to propagate fairly complex permissions from the server to an AJAX application, and I'm not sure the best approach to take. Essentially, I want my permissions to be defined so I can request a whole set of permissions in one shot, and adjust the UI as appropriate (the UI changes can be as low level as disabling certain context menu items). Of course, I still ne

将权限传播给Javascript

我正在讨论将相当复杂的权限从服务器传播到AJAX应用程序的最佳方式,而且我不确定采取的最佳方法。 实质上,我希望我的权限得到定义,这样我就可以一次性请求整套权限,并根据需要调整UI(UI更改可以与禁用某些上下文菜单项一样低级别)。 当然,我仍然需要强制执行权限服务器端。 所以,我想知道如果有人有任何建议,以最好的方式 维护权限并在服务器代码中使用它们 可以轻松访问javascript中的权限 不必为每个单独

Example of child iframe scrolling on iPad

Does anyone have an example of a child iframe element which scrolls within its parent page..i want it working on the iPad... If not through iframe..do u have for object element... Thank you...

儿童iframe在iPad上滚动的示例

有没有人有一个儿童iframe元素在其父页面内滚动的例子..我希望它在iPad上工作... 如果不是通过iframe ..你有对象元素...谢谢...

iPad Web App: Detect Virtual Keyboard Using JavaScript in Safari?

I'm writing a web app for the iPad ( not a regular App Store app - it's written using HTML, CSS and JavaScript). Since the keyboard fills up a huge part of the screen, it would make sense to change the app's layout to fit the remaining space when the keyboard is shown. However, I have found no way to detect when or whether the keyboard is shown. My first idea was to assume that th

iPad Web App:在Safari中使用JavaScript检测虚拟键盘?

我正在为iPad编写一个Web应用程序( 不是常规的App Store应用程序 - 它使用HTML,CSS和JavaScript编写)。 由于键盘填满了屏幕的一大部分,因此在显示键盘时更改应用程序的布局以适合剩余空间是有意义的。 但是,我发现无法检测何时或是否显示键盘。 我的第一个想法是假设当文本字段有焦点时键盘是可见的。 但是,当外部键盘连接到iPad时,虚拟键盘在文本字段获得焦点时不显示。 在我的实验中,键盘也不会影响任何DOM元素

How to remove H1 formatting within ContentEditable (wysiwyg)

With the exception of using Undo, I don't think there's a way to remove h1 and h2 tags in content editable. The expected behavior is clicking the H1 button again should toggle it off, but it does not. There's also a "remove formatting" button, but it only works on items that are bold, italic, etc. Is there a way to do this through javascript? Edit: Result must remove the

如何删除ContentEditable中的H1格式(wysiwyg)

除了使用撤消,我不认为有一种方法可以删除内容中的h1和h2标签可编辑。 预期的行为是再次点击H1按钮应该关闭它,但它不。 还有一个“删除格式”按钮,但它只适用于粗体,斜体等项目。有没有办法通过JavaScript来做到这一点? 编辑:结果必须删除打开和关闭H1标记,而不是用其他任何东西替换它。 请看这里的简化测试用例:http://jsfiddle.net/kthornbloom/GSnbb/1/ <div id="editor" contenteditable="true"> <

How to get selected text from a text area in jquery?

This question already has an answer here: How to get selected text from textbox control with javascript 5 answers About to make the selected content as bold, you can't do that directly in the textarea but you can do that using editable divs. This plugin could help you: http://mistic100.github.io/jquery-highlighttextarea/ About your comment: "How can i get the all text from a div e

如何从jquery中的文本区域获取选定的文本?

这个问题在这里已经有了答案: 如何使用JavaScript 5的答案从文本框控件中获取选定的文本 关于将选定内容设置为粗体,不能直接在textarea中执行此操作,但可以使用可编辑的div来完成。 这个插件可以帮助你:http://mistic100.github.io/jquery-highlighttextarea/ 关于你的评论:“我怎样才能从一个div的所有文本排除HTML标签?” 你可以使用像这样的东西:jQuery('。yourDiv')。text();

Insert text before and after selection in a contenteditable

Is there a way to insert text similar to bbcode before and after the selected text in a contenteditable div? I've seen many answers for textarea, but the code does not work with a contenteditable div. IE support is not needed. The approach I'd suggest is: Obtain a range from the selection Insert a text node at the end of the range Insert another text node at the start of the ran

在contenteditable的选择之前和之后插入文本

有没有办法在contenteditable div中选定的文本之前和之后插入类似于bbcode的文本? 我已经看到了许多textarea的答案,但代码不适用于一个可以满足需求的div。 IE支持是不需要的。 我建议的方法是: 从选择中获得一个范围 在范围的末尾插入一个文本节点 在范围的开头插入另一个文本节点 重新选择原文 以下演示适用于除IE <= 8之外的所有主流浏览器。 演示:http://jsfiddle.net/8WEru/ 码: function surrou

How to get selected text with JavaScript

I'm a little confused why doesn't this code work! The HTML Markup: <div id="diva"><b>Score</b> some <i>goals</i></div> <div id="soda"></div> The JavaScript code: function GetSelectedText () { if (window.getSelection) { // all browsers, except IE before version 9 var range = window.getSelection (); alert (range.toString ()); }

如何使用JavaScript获取选定的文本

我有点困惑,为什么这个代码不工作! HTML标记: <div id="diva"><b>Score</b> some <i>goals</i></div> <div id="soda"></div> JavaScript代码: function GetSelectedText () { if (window.getSelection) { // all browsers, except IE before version 9 var range = window.getSelection (); alert (range.toString ()); } else { if (document.selection

How can I highlight the text of the DOM Range object?

I select some text on the html page(opened in firefox) using mouse,and using javascript functions, i create/get the rangeobject corresponding to the selected text. userSelection =window.getSelection(); var rangeObject = getRangeObject(userSelection); Now i want to highlight all the text which comes under the rangeobject.I am doing it like this, var span = document.createElement("span");

我如何突出显示DOM Range对象的文本?

我使用鼠标在html页面上选择了一些文本(在Firefox中打开),并使用javascript函数创建/获取与所选文本对应的rangeobject。 userSelection =window.getSelection(); var rangeObject = getRangeObject(userSelection); 现在我想突出显示范围对象下的所有文本。我是这样做的, var span = document.createElement("span"); rangeObject.surroundContents(span); span.style.backgroundColor = "yellow"; 那么,这工