473,396 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

<a href='#' onClick="fun()"; is not working in IE

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>"
Jun 27 '08 #1
5 2623
pr********@gmail.com escribió:
name="<a href='#' onClick = 'javascript:editCategoryDimmershow123("+id
+");'>"+category.name;+"</a>"
1. Why '#'? Provide a valid alternative URL for the task or just get rid
of the <atag.

2. Why 'javascript:'? The onclick attribute expects javascript code, not
an URI.

3. Does it work if you remove the ";" character so you close the <atag?

--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #2
VK
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.
Jun 27 '08 #3
On May 21, 12:20 pm, "Álvaro G. Vicario"
<alvaroNOSPAMTHA...@demogracia.comwrote:
prathap...@gmail.com escribió:
name="<a href='#' onClick = 'javascript:editCategoryDimmershow123("+id
+");'>"+category.name;+"</a>"

1. Why '#'? Provide a valid alternative URL for the task or just get rid
of the <atag.

2. Why 'javascript:'? The onclick attribute expects javascript code, not
an URI.

3. Does it work if you remove the ";" character so you close the <atag?

--
--http://alvaro.es- Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:http://bits.demogracia.com
-- Mi web de humor al baño María:http://www.demogracia.com
--
hi thanks for the reply actually
i tried with href it was not working that's why i changed
it.
javascript: is for we r refering that function from another js file
thats wy
Jun 27 '08 #4
vp*********@gmail.com escribió:
hi thanks for the reply actually
i tried with href it was not working that's why i changed
it.
javascript: is for we r refering that function from another js file
Where did you read about that? It doesn't trigger any error but it's of
no use. You can write "godsavethequeen:alert('Hello, World!')" and it'll
still work. I suppose JavaScript considers it a label.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://bits.demogracia.com
-- Mi web de humor al baño María: http://www.demogracia.com
--
Jun 27 '08 #5
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});
}
}
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: c | last post by:
RH9, Apache 2.0.49, php 4.3.6 been away from php for about 2 years and this way used to work, still does in older php versions, now it doesn't. is there a reason for this? a work around? Thanx...
5
by: Mikko Rantalainen | last post by:
See example at <URL:http://www.cc.jyu.fi/~mira/moz/formtest.php>. The problem is that the label of submit button is always centered on the button regardsless of 'text-align' property in CSS....
3
by: Luigi Donatello Asero | last post by:
Is an index in a database the equivalent for a <TH scope="col"> in a column of a table in the html code? -- Luigi ( un italiano che vive in Svezia)...
3
by: Silmar | last post by:
Hi! In my form I have table which cells contain input objects of type="text" which initially are disabled. I would like to activate them by clicking on them. However because input object does...
72
by: Paminu | last post by:
In math this expression: (a < b) && (b < c) would be described as: a < b < c But why is it that in C these two expressions evaluate to something different for the same values of a, b and...
1
by: Anup | last post by:
In my form I and doing validations using 'Javascript' as I m using ASP1.1 and there is very less support for Validators there. //Code Behind private void Page_Load(object sender,...
11
by: Holger | last post by:
Hi I have not been able to figure out how to do compound statement from C - "<test>?<true-val>:<false-val>" But something similar must exist...?! I would like to do the equivalent if python...
9
by: PengYu.UT | last post by:
Hi, I have the code below this email. I want to replace the last 4 lines with a Metaprogramming loop to get something like the following (I don't know the syntax). Is it possible? for type in...
3
by: Magesh | last post by:
How date-time attributes of a file are represented in the structure "struct stat"? Coz as I noted they found to be unsigned integers and I donno how they are interpreted as date & time in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.