473,847 Members | 2,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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:edi tCategoryDimmer show123("+id
+");'>"+categor y.name;+"</a>"
Jun 27 '08 #1
5 2651
pr********@gmai l.com escribió:
name="<a href='#' onClick = 'javascript:edi tCategoryDimmer show123("+id
+");'>"+categor y.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...@gmai l.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:edi tCategoryDimmer show123("+id
+");'>"+categor y.name;+"</a>"
Reason:

http://groups.google.com/group/comp....718930ba71d113

Proper way:

var lnk = document.create Element('A');
lnk.appendChild (document.creat eTextNode(categ ory.name));
lnk.href = category.name;
lnk.args = {
'id' : id,
// other params if needed
};
lnk.title = popup.helpPromp t // optional
lnk.onclick = editCategoryDim mershow123;
// ...
yourContainer.a ppendChild(lnk) ;

with editCategoryDim mershow123 like

editCategoryDim mershow123(e) {
if ((typeof event == 'object') &&
('returnValue' in event)) {
event.cancelBub ble = true;
event.returnVal ue = false;
}
else {
e.stopPropagati on();
e.preventDefaul t();
}
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"
<alvaroNOSPAMTH A...@demogracia .comwrote:
prathap...@gmai l.com escribió:
name="<a href='#' onClick = 'javascript:edi tCategoryDimmer show123("+id
+");'>"+categor y.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*********@gma il.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 "godsavethequee n: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...@y ahoo.comwrote:
On May 21, 11:02 am, prathap...@gmai l.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:edi tCategoryDimmer show123("+id
+");'>"+categor y.name;+"</a>"

Reason:

http://groups.google.com/group/comp....718930ba71d113

Proper way:

var lnk = document.create Element('A');
lnk.appendChild (document.creat eTextNode(categ ory.name));
lnk.href = category.name;
lnk.args = {
'id' : id,
// other params if needed};

lnk.title = popup.helpPromp t // optional
lnk.onclick = editCategoryDim mershow123;
// ...
yourContainer.a ppendChild(lnk) ;

with editCategoryDim mershow123 like

editCategoryDim mershow123(e) {
if ((typeof event == 'object') &&
('returnValue' in event)) {
event.cancelBub ble = true;
event.returnVal ue = false;
}
else {
e.stopPropagati on();
e.preventDefaul t();
}
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("showCate gories()");
var catArray;
Org.getImmediat eSubCategories( catid,{callback :function(cat) {
catArray = cat;
}, async:false});

var header=['','Category Name','Parent
Category','Desc ription','Defau lt Quantity'];
var grid=new OAT.Grid("ngrid _content",0,0);
grid.createHead er(header);
if (catArray.lengt h 0){
for(var i = 0;i < catArray.length ;i++){
Org.getCategory (catArray[i],{callback:func tion(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:edi tCategoryDimmer show123("+id
+");'>"+categor y.name+"</a>"
parentId = category.parent ;
fullQuantity =(category.quan tity==""||categ ory.quantity==" null"||
category.quanti ty==null||
category.quanti ty==undefined)? "N.A":category. quantity;
desc =(category.desc ==""||category. desc=="null"||
category.desc== null||category. desc==undefined )?"N.A":categor y.desc;
//fullQuantity = category.quanti ty;
//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,{call back:function(p arent){
parentName = parent.name;
var
rowArr=[cb,name,parentN ame,desc,fullQu antity];/////////////////////////
vp
grid.createRow( rowArr);
},asyn:true});
}else{
parentName = "Parent";
var rowArr=[cb,name,parentN ame,desc,fullQu antity];
grid.createRow( rowArr);
}
},asyn:false});
}
} else {
Org.getCategory (catid,{callbac k:function(cate gory){
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:edi tCategoryDimmer show("+id
+"); return false;'>"+categ ory.name;+"</a>"
parentId = category.parent ;
fullQuantity =(category.desc ==""||category. desc=="null"||
category.desc== null||category. desc==undefined )?"N.A":categor y.desc;
desc =(category.desc ==""||category. desc=="null"||
category.desc== null||category. desc==undefined )?"N.A":categor y.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,{call back:function(p arent){
parentName = parent.name;
var rowArr=[cb,name,parentN ame,desc,fullQu antity];
grid.createRow( rowArr);
},asyn:true});
}else{
parentName = "Parent";
var rowArr=[cb,name,parentN ame,desc,fullQu antity];
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
3714
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 in Advance!!
5
10460
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. Considering that I can style everything else, this must be a bug, right? Any suggestions how to fix the issue with Mozilla 1.4? How about other versions of Mozilla? How about other browsers? (I'm aware that some people think that one should never...
3
1671
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) https://www.scaiecat-spa-gigi.com/sv/damskor-italien.php
3
3274
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 not support onClick event (or maybe I am wrong?) I use onClick events of table cells. And it works as required in IE 6. I click on the input object and the onClick event of the cell is raised. But it does not work in Firefox (I have not yet checked...
72
4284
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 c?
1
5875
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, System.EventArgs e) { Button1.Attributes.Add("OnClick","fun()"); } Problem in using "Button1.Attributes.Add " for client side script for
11
2251
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 of the C line: printf("I saw %d car%s\n", n, n != 1 ? "s" : "")
9
3429
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 {left_tag, right_tag, down_tag, up_tag) { fun(type()); }
3
5266
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 members st_atime, st_mtime, and st_ctime. I don't want any lib fun that returns the corresponding time formatted string coz what I want to know is the interpretation of date-time in those members so that I could extract them and use it for some...
0
9734
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10995
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10654
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10347
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9493
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7888
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4130
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3168
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.