Also, you don't want to diable INPUT/TEXTAREA nodes, because it will become unreadble (gray #808080) if you disable it, so I prefer to set those nodes readOnly. (only INPUT and TEXTAREA support readOnly property!)
/*
setDisabled function
1. set readOnly property for INPUT/TEXTAREA nodes
2. disable other nodes
id: element's Id
ignoreNodes: nodes can be ignored
nodesDisabled: bool, true = set disable/readonly
*/
function setDisabled(id, ignoreNodes, nodesDisabled)
{
var node, nodes;
nodes = id.getElementsByTagName('*');
if(!nodes)
return;
var i = nodes.length;
while (i--)
{
node = nodes[i];
if(node.nodeName && !(node.nodeName.toLowerCase() in ignoreNodes))
{
if((node.nodeName == "INPUT") || (node.nodeName == "TEXTAREA"))
{
node.readOnly = nodesDisabled;
}
else
{
node.disabled = nodesDisabled;
}
}
}
}
/*disable/readonly fields*/
setDisabled(document.getElementById("areaForm"), {table:'', iframe:'', div:'', form:'', col:'', colgroup:'', lable:'', span:'', tbody:'', body:'', tr:'', td:''}, true);
/*disable IFRAME*/
try
{
window.setTimeout(iframeDisabled, 3000);
}
catch(err)
{
alert("System busy, please try again later!" + err);
window.close();
}
function iframeDisabled()
{
setDisabled(document.frames("IFRAME_1").document.getElementById("mnuBar1"),{}, true);
}
9 comments:
Nice work. This works great for me. However, can I specify that I want a particular field (in my case, a specific datetime field) to not be disabled/readonly?
Thanks
Thanks Dubsport, the easy way is just enable this field on the end.
crmForm.all.Your_Field.disabled = false;
Great work, thanks. But I need to make a whole tab a readonly, how can i do this using your function?!
Unfortunately, this function doesn't fully cover the Notes field. If Notes is accessible (your function disables the Notes tab, but it might be necessary to make Notes readable), you will find that each Notes item has onfocus, onclick, ondblclick etc functionality that is not disabled by your function. Also, because you are using a Timeout (which fires only once), when you add a new note by double clicking on the "Click here to enter a new note..." link and saving it, all elements in the Notes IFrame become enabled, because the function is not re-called (it's only on the parent form load, not the IFrame onload).
Anyway, it's a useful function all the same.
Correction to the above post (I'm the same Anonymous that wrote the above!), if there is an existing note and you double click on it, things happen. Double clicking the "Click here to enter a new note..." is properly disabled.
How can i hide a tab accrding to the subject of the case when the case form loads
Nice work jim, but just wondering any idea how to disable (not hide) entire section & how to disable just an iFrame?
Many Thanks,
mehul
酒店經紀PRETTY GIRL 台北酒店經紀人 ,禮服店 酒店兼差PRETTY GIRL酒店公關 酒店小姐 彩色爆米花酒店兼職,酒店工作 彩色爆米花酒店經紀, 酒店上班,酒店工作 PRETTY GIRL酒店喝酒酒店上班 彩色爆米花台北酒店酒店小姐 PRETTY GIRL酒店上班酒店打工PRETTY GIRL酒店打工酒店經紀 彩色爆米花
艾葳酒店經紀公司提供專業的酒店經紀, 酒店上班小姐,八大行業,酒店兼職,傳播妹,或者想要打工兼差、打工,兼差,八大行業,酒店兼職,想去酒店上班, 日式酒店,制服酒店,ktv酒店,禮服店,整天穿得水水漂漂的,還是想去制服店當日領上班小姐,水水們如果想要擁有打工工作、晚上兼差工作、兼差打工、假日兼職、兼職工作、酒店兼差、兼差、打工兼差、日領工作、晚上兼差工作、酒店工作、酒店上班、酒店打工、兼職、兼差、兼差工作、酒店上班等,想了解酒店相關工作和特種行業內容,想兼職工作日領、假日兼職、兼差打工、或晚班兼職想擁有鋼琴酒吧又有保障的工作嗎???又可以現領請找專業又有保障的艾葳酒店經紀公司!
艾葳酒店經紀是合法的公司工作環境高雅時尚,無業績壓力,無脫秀無喝酒壓力,高層次會員制客源,工作輕鬆,可日領、現領。
一般的酒店經紀只會在水水們第一次上班和領薪水時出現而已,對水水們的上班安全一點保障都沒有!艾葳酒店經紀公司的水水們上班時全程媽咪作陪,不需擔心!只提供最優質的酒店上班,酒店上班,酒店打工環境、上班條件給水水們。心動嗎!? 趕快來填寫你的酒店上班履歷表
水水們妳有缺現領、有兼職、缺錢便服店的煩腦嗎?想到日本留學缺錢嗎?妳是傳播妹??想要擁有高時薪又輕鬆的賺錢,酒店和,假日打工,假日兼職賺錢的機會嗎??想實現夢想卻又缺錢沒錢嗎!??
艾葳酒店台北酒店經紀招兵買馬!!徵專業的酒店打工,想要去酒店的水水,想要短期日領,酒店日領,禮服酒店,制服店,酒店經紀,ktv酒店,便服店,酒店工作,禮服店,酒店小姐,酒店經紀人,
等相關服務 幫您快速的實現您的夢想~!!
Post a Comment