I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....
But Javascript has garbage collection. This means that the node object itself will remain in existence as long as any variable refers to it. So you can assign a node to a variable, use removeChild
to prune it from its parent node, and later on, insert or append it to some other node, thereby effectively moving it around on the page.
下面的法典将删除一条 no子,在把它重新投到树上(从而排到树上)之前等待10秒钟:
var oldNode = someNode.removeChild(...);
setTimeout(function () {
document.documentElement.appendChild(oldNode);
}, 10000);
这意味着,由于该物体仍然有变数点(即<代码>oldNode),因此该物体没有从记忆中删除。
另一起案件:
var node = document.getElementById( test );
// ... do stuff
node.parentElement.removeChild(node);
// node still exists, but has been removed from the page
// ... do some more stuff
node = document.getElementById( hello );
// The variable node now points to something else;
// this means the original node will be deleted from memory
If, on the other hand, you don’t reassign the removed node to another variable, it can’t be accessed anymore (not via the document tree, since it’s been removed from there; and not via a JS variable); so Javascript will automatically purge it from memory:
someNode.removeChild(...);
将移走的 no子分配到一个变数,然后将<条码>null(或任何其他)分配给这一变量——如马克·布在其答复中建议的那样——是完全不必要的,而且,IMHO是sil的。
这将完全删除以下术语:
someNode.removeChild(...);
这将从OMM中清除 no子,使之不明显,但将予以节省,以便你能够在其他地方插入:
oldNode = someNode.removeChild(...);
拆除 孩子们将这个内容从大片中去除,但是如果你重新去做,在别处重新插入,则从该功能中恢复。 你们必须杀死这种回报价值,才能真正摆脱被清除的 no子:
oldNode = someNode.removeChild(...);
oldNode = null;
如果你想要真正删除一个主轴。 拆除 仅靠儿童是不够的。 这与Steveoders的情况一样,后者是Moslow的作者。 您需要删除
I have a div <div id="masterdiv"> which has several child <div>s. Example: <div id="masterdiv"> <div id="childdiv1" /> <div id="childdiv2" /> <div id="...
I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...
<form><input type="file" name="first" onchange="jsFunction(2);"> <input type="file" name="second" onchange="jsFunction(3);"</form> Possible to pass just numbers to the js ...
So I ve got a menu with a hover/selected state and it loads fine in IE6/IE7. However when I scroll down the page and put the element outside of the viewport and then back in I get a broken image! I ...
I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...
Is it possible to reload a form after file-input change? I have a form where the user can chose an image for upload. I also have a php script which displays that image resized. I only wonder if it ...
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!
- winforms
- combobox
- fogbugz
- java
- date
- internationalization
- asp.net
- iis
- url-rewriting
- urlrewriter
- c#
- enums
- ocaml
- haxe
- algorithm
- string
- viewstate
- .net
- c++
- c
- symbol-table
- mysql
- database
- postgresql
- licensing
- migration
- vb.net
- vb6
- declaration
- vb6-migration
- python
- psycopg2
- backup
- vmware
- virtualization
- gnu-screen
- authentication
- desktop
- excel
- xll
- cultureinfo
- regioninfo
- oracle
- client
- session
- download
- html
- virtual
- constructor
- scenarios
- perl
- full-text-search
- javascript
- ajax
- testing
- oop
- inheritance
- vim
- encapsulation
- information-hiding