I was pestered by this stupid windows error that it cannot delete a file because it was being used ! I made sure that none of the applications.. are accessing it. But there must be some code written by M$ guys which made sure that the file was locked.
Cannot delete Filename. Access is denied. The source file may be in use.
I resolved it after a peek >>Here<< .
This file was a normal video file, and the only reason windows would access it is to create a thumbnail. But this video file additionally is corrupt which adds to the problem. So there definitely is a bug in Windows thumbnail creation software, which “keeps-on-trying” to create a thumbnail thereby keeping a lock on this file.. And hence the problem.
If any M$ guy has access to the source.. Let me know if i cornered the bug !..
Was working on a very simple form and found out that Firefox behaves differently in case of Form Reset.
The problem is, Firefox is unable to reset “hidden” inputs in the form, Internet explorer on the other hand clears out all the variables of the form. A simple code to check the same is below..
<script>
function someFunction() {
document.getElementById(’hid’).value = “Hiding”;
document.getElementById(’vis’).value = “Visible”;
}
</script>
<form name=”one” id=”one”>
<input type=”hidden” id=”hid” name=”hid” value=”">
<input type=”text” id=”vis” name=”vis” value=”">
<input type=”button” value=”click” onclick=”someFunction()”>
<input type=”reset” value=”Reset form”>
<input type=”button” value=”What is in Hidden Field?” onClick=”alert(document.getElementById(’hid’).value)”>
</form>
If you want to have a look at this working example. Open >>this<< in both the browsers.
These are tested in Firefox 2.0.0.8 and IE 6.0
Ofcourse, there are other “bug-or-feature-god-knows” such as after an F5, the hidden values still retain values.. A Strong Reload (CTRL-F5) should be done.. More details here.
Was in need for such a code but only found scripts and pages from Google with static usage. I am sure there must be source samples for adding tabs dynamically when required, but just didn’t find any at this point of time.. So here is my source sample for that..
So i m using existing tab logic from Tab Content Script v2.0. and with the help of this tutorial to add/remove html elements dynamically. The code is as follows
<head>
<link rel=”stylesheet” type=”text/css” href=”tabcontent.css” />
<script type=”text/javascript” src=”tabcontent.js”>
/***********************************************
* Tab Content script v2.0- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
</head>
<input type=”hidden” name=”noTabs” id=”noTabs” value=”4″>
<h3>Demo #1- Basic implementation</h3>
<ul id=”countrytabs” class=”shadetabs”>
<li><a href=”#” rel=”country1″ class=”selected”>Tab 1</a></li>
<li><a href=”#” rel=”country2″>Tab 2</a></li>
<li><a href=”#” rel=”country3″>Tab 3</a></li>
<li><a href=”#” rel=”country4″>Tab 4</a></li>
</ul>
<div id=”parent” name=”parent” style=”border:1px solid gray; width:450px; margin-bottom: 1em; padding: 10px”>
<input type=”hidden” name=”noTabs” id=”noTabs” value=”4″>
<div id=”country1″ class=”tabcontent”>
Tab content 1 here<br />Tab content 1 here<br /></div>
<div id=”country2″ class=”tabcontent”>
Tab content 2 here<br />Tab content 2 here<br /></div>
<div id=”country3″ class=”tabcontent”>
Tab content 3 here<br />Tab content 3 here<br /></div>
<div id=”country4″ class=”tabcontent”>
Tab content 4 here<br />Tab content 4 here<br /></div></div>
<script type=”text/javascript”>
var countries=new ddtabcontent(”countrytabs”)
countries.setpersist(true)
countries.setselectedClassTarget(”link”) //”link” or “linkparent”
countries.init()
function addTab() {
var numi = document.getElementById(’noTabs’);
var num = (document.getElementById(’noTabs’).value -1)+ 2;
numi.value = num;
// first add to list
var ti = document.getElementById(’countrytabs’);
var newLi = document.createElement(’li’);
newLi.innerHTML = ‘<a href=”#” rel=”country’+num+’”>Tab ‘+num+’</a>’
ti.appendChild(newLi);
// then add the content.
var ni = document.getElementById(’parent’);
var newdiv = document.createElement(’div’);
var divIdName = ‘country’+num;
newdiv.setAttribute(’id’,divIdName);
newdiv.setAttribute(’class’,'tabcontent’);
newdiv.innerHTML = ‘dynamically added’;
ni.appendChild(newdiv);
countries.init();
}
</script>
<p><b><a href=”javascript: countries.expandit(3)”>Click here to select last tab</a></b></p>
<hr />
<a href=”javascript:addTab()”>Add More Tabs</a>
———————
Hope this helps ppl who r in need of this feature..
Update: will upload an example as requested !
———————
Banta walks into a bar for a bar and takes a seat. However, just as the bartender put the beer on the bar, there was a loud disturbance outside. Hey ran out to see what was going on but soon went back to drink his beer.
When he got back he found his glass empty and a note saying: “Thanks for the beer!”
Banta was a little ticked-off but ordered another beer anyway. Again, just as the bartender put the beer down a loud crash was heard in the street. Thinking that someone ran into his parked car, Banta runs outside to check on things. Seeing that his car was okay he returned to the bar and again found his glass empty and another note that said: “Thanks again, this was as good as the first one.”
Well he still hadn’t had a beer to quench his thirst, so he ordered another. Just as the bartender put the beer down, a series of shots were heard outside. This time Banta wasn’t going to lose his beer to anybody. So he spit into the beer and left a note saying, “Enjoy, I just spit into the beer.” He then ran outside to see what had happened.
When Banta returned he was delighted to find that his beer was just where he left it.
However this time the note said: “You enjoy, I spit in it too!”