Jump to content

Calling Javascript Experts........


Recommended Posts

Posted

[quote name='galigannarao' timestamp='1320345192' post='3061083']
var nr = document.all.length;
for(i=0;i<nr;i++)
{
if(document.all(i).tagName == 'SELECT' || (document.all(i).tagName == 'INPUT' &&
(document.all(i).type == 'radio' || document.all(i).type == 'checkbox' || document.all(i).type == 'text'|| document.all(i).type == 'button')))
document.all(i).disabled = true;
}
}

try this it shopuld work
[/quote]
nenu kuda same code use sesa baa.....but cheppa kadha idhi chrome or firefox lo work kaadhu...only IE lo work avuthundi...... $s@d $s@d $s@d $s@d

Posted

[b]var c = document.getElementsByTagName("body")[0].getElementsByTagName("*");[/b]
var outstr="";
for (var x=0;x<c.length;x++) {
outstr=outstr+"tagName: "+c[x].tagName+", ";
if (c[x].id)
outstr=outstr+"ID: "+c[x].id+", ";
if (c[x].name)
outstr=outstr+"Name: "+c[x].name+", ";
if (c[x].type)
outstr=outstr+"Type: "+c[x].type+", ";
outstr=outstr+'\r\n';
}
alert(outstr);

Posted

I don't know if you can use JQuery?

JQuery does in one line.....like this


$(function() {
$("*").attr('disabled', 'disabled');
});This is typically disable all elements on the document. You can specify input type instead of * if you want to restrict controls to disable.

I will try to get you in Javascript as well.

Posted

[quote name='galigannarao' timestamp='1320345671' post='3061102']
[b]var c = document.getElementsByTagName("body")[0].getElementsByTagName("*");[/b]
var outstr="";
for (var x=0;x<c.length;x++) {
outstr=outstr+"tagName: "+c[x].tagName+", ";
if (c[x].id)
outstr=outstr+"ID: "+c[x].id+", ";
if (c[x].name)
outstr=outstr+"Name: "+c[x].name+", ";
if (c[x].type)
outstr=outstr+"Type: "+c[x].type+", ";
outstr=outstr+'\r\n';
}
alert(outstr);
[/quote]

sariga ardam kaledhu baa......first line returns object..?
suppose if want to remove only all href links on my page like


if(elems[i].tagName.toLowerCase() == 'a'){
elems[i].disabled = true;
}
do i need to make any changes here......this code already worked in IE. i itried with ur code

document.getElementsByTagName("body")[0].getElementsByTagName("*"); but did'nt work...
em cheyalo seppu baa...... cry@fl cry@fl cry@fl cry@fl cry@fl cry@fl

Posted

Try this ...working in Chrome......

for (var i = 0; i < document.FrmName.elements.length; i++) {
controlType = document.FrmName.elements[i].type;
if (controlType == 'select-one' ) {
document.FrmName.elements[i].readOnly = true;
document.FrmName.elements[i].disabled = true;
} else if (controlType == 'text' || controlType=='hidden') {
document.FrmName.elements[i].readOnly = true;
} else if (controlType == 'checkbox') {
document.FrmName.elements[i].disabled = true;
} else if (controlType == 'textarea') {
document.FrmName.elements[i].readOnly = true;
}

}

Posted

[quote name='criz' timestamp='1320347416' post='3061190']
Try this ...working in Chrome......

for (var i = 0; i < document.FrmName.elements.length; i++) {
controlType = document.FrmName.elements[i].type;
if (controlType == 'select-one' ) {
document.FrmName.elements[i].readOnly = true;
document.FrmName.elements[i].disabled = true;
} else if (controlType == 'text' || controlType=='hidden') {
document.FrmName.elements[i].readOnly = true;
} else if (controlType == 'checkbox') {
document.FrmName.elements[i].disabled = true;
} else if (controlType == 'textarea') {
document.FrmName.elements[i].readOnly = true;
}

}
[/quote]

thanks baa....i'll try, but is this works only in chrome or any browser.....?

Posted

Working in IE & Chrome. You can test in Firefox as well.

By the way I missed Radio control... Do include that as well and you may not need hidden remove it if not required.

Posted

[quote name='criz' timestamp='1320347613' post='3061198']
Working in IE & Chrome. You can test in Firefox as well.

By the way I missed Radio control... Do include that as well and you may not need hidden remove it if not required.
[/quote]

thank so much....i'll try now H&*() H&*() H&*() H&*()

Posted

[quote name='criz' timestamp='1320347613' post='3061198']
Working in IE & Chrome. You can test in Firefox as well.

By the way I missed Radio control... Do include that as well and you may not need hidden remove it if not required.
[/quote]

it is not working....... cry@fl cry@fl cry@fl cry@fl cry@fl cry@fl cry@fl cry@fl

×
×
  • Create New...