On May 21, 12:30 pm, VK <schools_r...@yahoo.comwrote:
On May 21, 11:02 am, prathap...@gmail.com wrote:
hi all,
We r working on ERP sys and am doing crossBrowser
compatibility.
The problem is am not able to load one function by onClicking the
refrence text .
could u please help me out.
The code is looking like this........
name="<a href='#' onClick = 'javascript:editCategoryDimmershow123("+id
+");'>"+category.name;+"</a>"
Reason:
http://groups.google.com/group/comp....718930ba71d113
Proper way:
var lnk = document.createElement('A');
lnk.appendChild(document.createTextNode(category.n ame));
lnk.href = category.name;
lnk.args = {
'id' : id,
// other params if needed};
lnk.title = popup.helpPrompt // optional
lnk.onclick = editCategoryDimmershow123;
// ...
yourContainer.appendChild(lnk);
with editCategoryDimmershow123 like
editCategoryDimmershow123(e) {
if ((typeof event == 'object') &&
('returnValue' in event)) {
event.cancelBubble = true;
event.returnValue = false;
}
else {
e.stopPropagation();
e.preventDefault();
}
var id = this.args.id;
// do the rest
}
There are other ways as well but this seems the most flexible in
relevance of the arguments.
hi thanks for the reply
can u bit more specific
actually am tried am getting some errors at " with" if
commented popup not defined n
all,
see this code and try...........
function bG(catid)
{
//alert("showCategories()");
var catArray;
Org.getImmediateSubCategories(catid,{callback:func tion(cat) {
catArray = cat;
}, async:false});
var header=['','Category Name','Parent
Category','Description','Default Quantity'];
var grid=new OAT.Grid("ngrid_content",0,0);
grid.createHeader(header);
if (catArray.length 0){
for(var i = 0;i < catArray.length;i++){
Org.getCategory(catArray[i],{callback:function(category){
var cb;
var name;
var parentId;
var parentName;
var parentName1;
var desc;
var fullQuantity=0;
var image;
var sr1;//src of image
var sr2;
id = category.id;
name="<a href = 'javascript
:editCategoryDimmershow123("+id
+");'>"+category.name+"</a>"
parentId = category.parent;
fullQuantity =(category.quantity==""||category.quantity=="null" ||
category.quantity==null||
category.quantity==undefined)?"N.A":category.quant ity;
desc =(category.desc==""||category.desc=="null"||
category.desc==null||category.desc==undefined)?"N. A":category.desc;
//fullQuantity = category.quantity;
//desc = category.desc;
sr1 = category.image;
sr2 = "images/"+sr1;
//image='<image src="'+sr2+'" width="30px" height="30px" />';
cb = '<input type="checkbox" name ="cbs" id="cbs" value="'+id+'"/
>';
if(parentId != 0){
Org.getCategory(parentId,{callback:function(parent ){
parentName = parent.name;
var
rowArr=[cb,name,parentName,desc,fullQuantity];/////////////////////////
vp
grid.createRow(rowArr);
},asyn:true});
}else{
parentName = "Parent";
var rowArr=[cb,name,parentName,desc,fullQuantity];
grid.createRow(rowArr);
}
},asyn:false});
}
} else {
Org.getCategory(catid,{callback:function(category) {
var cb;
var name;
var parentId;
var parentName;
var parentName1;
var desc;
var fullQuantity=0;
var image;
var sr1;//src of image
var sr2;
id = category.id;
name="<a href ='#' onClick = 'javascript
:editCategoryDimmershow("+id
+"); return false;'>"+category.name;+"</a>"
parentId = category.parent;
fullQuantity =(category.desc==""||category.desc=="null"||
category.desc==null||category.desc==undefined)?"N. A":category.desc;
desc =(category.desc==""||category.desc=="null"||
category.desc==null||category.desc==undefined)?"N. A":category.desc;
sr1 = category.image;
sr2 = "images/"+sr1;
//image='<image src="'+sr2+'" width="30px" height="30px" />';
cb = '<input type="checkbox" name ="cbs" id="cbs" value="'+id+'"/
>';
if(parentId != 0){
Org.getCategory(parentId,{callback:function(parent ){
parentName = parent.name;
var rowArr=[cb,name,parentName,desc,fullQuantity];
grid.createRow(rowArr);
},asyn:true});
}else{
parentName = "Parent";
var rowArr=[cb,name,parentName,desc,fullQuantity];
grid.createRow(rowArr);
}
},asyn:false});
}
}