document

Use DomDocument to replace all header tags with the h4 tags

自古美人都是妖i 提交于 2019-12-30 12:04:42
问题 I've used DomDocument to to GetElementById. It has selected a div. I need to replace all the header tags within that div with the h4 tag. 回答1: You have not made clear in your question what the concrete problem is you run into. I would assume that there are two parts that could cause you some questions marks. The first one would be how to get the hand on all the elements that you want to rename and the second one is actually how to rename an element. Get Heading Elements of a DOMDocument So

Javascript createElement no end tag

牧云@^-^@ 提交于 2019-12-30 10:00:13
问题 I'm trying to use document.createElement('circle') to work with svgs but Chrome creates a end tag to circle giving <circle></circle> which results of an error. How can I create an element without an ending that? 回答1: You might want to take a look at this article SVG Scripting with JavaScript Part 1: Simple Circle The method you're looking for is: var circle = document.createElementNS("http://www.w3.org/2000/svg", "circle"); Edit: Credit where credit is due Stackoverflow: Creating SVG graphics

Flash document viewer

元气小坏坏 提交于 2019-12-30 04:57:04
问题 Is there a flash based document viewer? I am looking for something similar to iPaper that Scribd.com uses. 回答1: There's a great open source viewer for PDF2SWF: http://www.devaldi.com/?page_id=260 回答2: I've used PDF2SWF in the past to do basic document conversion/viewing in Flash: http://www.swftools.org/pdf2swf.html although I don't think they are as full featured as the iPaper and Scribd viewers - although it is entirely free to use. You can download from here: http://www.swftools.org

MongoDB preload documents into RAM for better performance

无人久伴 提交于 2019-12-30 01:29:08
问题 I want MongoDB to hold query results in RAM for longer period of time (say 30 minutes if memory is available). Is it possible? OR is there any way i can make sure that the data is pre-loaded into RAM before subsequent queries on it. In fact i am wondering about simple query results performance by MongoDB. I have a dedicated server with 10GB RAM and my db.stats() are as follows; db.stats(); { "db": "test", "collections":16, "objects":625690, "avgObjSize":68.90, "dataSize":43061996,

Window.print doesn't work in IE

霸气de小男生 提交于 2019-12-29 07:41:53
问题 I have to print out a div which I'm doing in the following way: function PrintElem(elem) { Popup(elem.html()); } function Popup(data) { var mywindow = window.open('', 'to print', 'height=600,width=800'); mywindow.document.write('<html><head><title></title>'); mywindow.document.write('<link rel="stylesheet" href="css/mycss.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.print(); mywindow

Window.print doesn't work in IE

你。 提交于 2019-12-29 07:41:52
问题 I have to print out a div which I'm doing in the following way: function PrintElem(elem) { Popup(elem.html()); } function Popup(data) { var mywindow = window.open('', 'to print', 'height=600,width=800'); mywindow.document.write('<html><head><title></title>'); mywindow.document.write('<link rel="stylesheet" href="css/mycss.css" type="text/css" />'); mywindow.document.write('</head><body >'); mywindow.document.write(data); mywindow.document.write('</body></html>'); mywindow.print(); mywindow

Make parts of a JTextArea non editable (not the whole JTextArea!)

烈酒焚心 提交于 2019-12-29 06:13:35
问题 I'm currently working on a console window in Swing. It's based on a JTextArea and works like a common command line. You type a command in one line and press enter. In the next line, the output is shown and under that output, you could write the next command. Now I want, that you could only edit the current line with your command. All lines above (old commands and results) should be non editable. How can I do this? 回答1: You do not need to create your own component. This can be done (as in I

Make parts of a JTextArea non editable (not the whole JTextArea!)

╄→гoц情女王★ 提交于 2019-12-29 06:13:12
问题 I'm currently working on a console window in Swing. It's based on a JTextArea and works like a common command line. You type a command in one line and press enter. In the next line, the output is shown and under that output, you could write the next command. Now I want, that you could only edit the current line with your command. All lines above (old commands and results) should be non editable. How can I do this? 回答1: You do not need to create your own component. This can be done (as in I

Set hilighting color in jTextField

↘锁芯ラ 提交于 2019-12-29 01:27:59
问题 I am developing a Java Swing application. This app allows user use basic command line. For example user can add event with simply type add "Something to be added." .I wanna highlight add when user type this command. Can any one implement a jTextField. 回答1: An idea would be to use a StyleDocument and DocumentFilter This is actually based on this question, but I wasn't sure if I could attempt to use a JTextField import java.awt.Color; import java.awt.EventQueue; import java.awt.GridBagLayout;

Create a DOM document from string, without JQuery

故事扮演 提交于 2019-12-28 12:17:42
问题 We're looking for ways to create a DOM document in javascript from a string, but without using Jquery. Is there a way to do so? [I would assume so, since Jquery can do it!] For those curious, we can't use Jquery, becase we're doing this in the context of a Chrome application's content script, and using Jquery would just make our content script too heavy. 回答1: In case you're still looking for an anwer, and for anyone else coming accross it, I just have been trying to do the same thing myself.