Fire Fox – Bug or feature ?

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.

Javascript Multiple Tabs – Add Tabs dynamically

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 and his beer…

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!”

Hare Krishna

हरे कृष्ण हरे कृष्ण,
कृष्ण कृष्ण हरे हरे,
हरे रामा, हरे रामा,
रामा रामा, हरे हरे

इसके बारे में अधिक जानकारी केलिए जाये याहापर

The Arrival of the New Monitor

Its been sometime, that i’ve got a new monitor.. Forgot to talk about it.. I felt like writing about it because there were not many reviews about this model “ViewSonic vx1932wm“.

The Pros

  • This has a 19″ Wide Screen with 1440×900 resolution
  • Has a 2ms Response Time gray to gray.. Suitable for Gaming – I’ve played CS v1.6 on this till now.. Looks more than fine.
  • The Monitor setup was pretty much simple, just had to install drivers and had to change the resolution. (its the same case with any other monitor.. yet to check if this is fine with Linux as well).
  • The Contrast ratio is kool as well.

& The Cons

  • This LCD is viewable only in a straight angle, so all the people wishing to watch something on the screen better sit in front of the monitor.. Side viewing is almost impossible.
  • Has built speakers which are hardly useful for me, i already own a Creative 4.1 Sound Blaster. I wish there was something else instead of this.. May be the iPod dock provided in 1945wm.

Anyway, next stop – A DVD Writer… !

Electrified !

You r looking at the Visual – Lightning hits a plane in mid-air !

Imagine… What would be the passenger’s condition like if it really conducts the amount of electricity

This image is hot linked and the original source is Forever Geek

Terrorism and its relatedness !

Just going through one of the News posts at Rediff.com and found out that Musharaff, the Pakistan President has quite a close relatedness with AlQaeda…

Look what Rediff image search shows for a search of “al qaeda”.

Its either Mush having close ties with the Terrorist organization or is it the problem with Rediff Image search contexting algorithm.. !

Migrating…

Just a recap of the activities in the past 1 week.

  • Taken back my resignation.
  • Got Blacklisted for some misunderstanding by my Dream company.
  • Going to Hyderabad on this Friday, 06th July 2007.

Hyderabad Charminar

Here i come.. !

Plan before you leave !..

People claim technology has made life easier.. But is it ? .
I do agree to the point where its said “Technology was intended to make life easier”.

Suppose you pack your bags to go on a vacation..
You take a print of the Google Maps directions to reach ur destination…Without checking the directions you start with ur travel..You would end up totally screwed.. Coz this is what i found.

Swim the way to hell

I would rather depend on Human Guidelines..

I would seriously advice u to check for the automated road directions.. the next time..