Hi
I am facing a problem with my code ....
this is what I am doing ...
I am having a link on the page which says "add tab" o clicking this link I add a new tab to the page, I write the code for that in Javascript function, I set the attributes of that tab in there. One of the attribute is on click. I am able to achieve what I want in mozilla but IE is not doing anything onclicking the tab.
I am attaching the code snippet as well ... see if you can help ... I am stuck ... - function addTab(obj)
-
{
-
tabCount=tabCount+1;
-
var newSpan = document.createElement("span");
-
newSpan.setAttribute("id","tab"+tabCount);
-
-
var newInput = document.createElement("input");
-
newInput.setAttribute("type","button");
-
newInput.setAttribute("value","New Tab "+tabCount);
-
newInput.setAttribute("onclick","changeTab(this)");
-
newInput.setAttribute("id",tabCount);
-
Regards,
Tarun Chandel
8 24837
Hi
I am facing a problem with my code ....
this is what I am doing ...
I am having a link on the page which says "add tab" o clicking this link I add a new tab to the page, I write the code for that in Javascript function, I set the attributes of that tab in there. One of the attribute is on click. I am able to achieve what I want in mozilla but IE is not doing anything onclicking the tab.
I am attaching the code snippet as well ... see if you can help ... I am stuck ... - function addTab(obj)
-
{
-
tabCount=tabCount+1;
-
var newSpan = document.createElement("span");
-
newSpan.setAttribute("id","tab"+tabCount);
-
-
var newInput = document.createElement("input");
-
newInput.setAttribute("type","button");
-
newInput.setAttribute("value","New Tab "+tabCount);
-
newInput.setAttribute("onclick","changeTab(this)");
-
newInput.setAttribute("id",tabCount);
-
Regards,
Tarun Chandel
I had the same problem. Anyone find a solution?
T
Instead of hard-coding the event handler, include this code in a JS file (mine's called dhtml-core.js: - var addEvent;
-
if (document.addEventListener) {
-
addEvent = function(element, type, handler) {
-
element.addEventListener(type, handler, null);
-
}
-
}
-
else if (document.attachEvent) {
-
addEvent = function(element, type, handler) {
-
element.attachEvent("on" + type, handler);
-
}
-
}
-
else {
-
addEvent = new Function; // not supported
-
}
Then, use the call: - addEvent(someObject, "click", functionName, false) ;
It'll work across various browsers.
If You Use INternet Explorer 7 Beta for WINDOWS VISTA You Can Use It
benhunt,
Does that work with parameters? I am having major problems with IE not allowing you to change the onChange attribute of an element.
Jake
Post the HTML along with the JS if your still having this problem.
No, doesn't use parameters in itself. I've never found that's stopped me though. Normally, the element's position in the DOM gives me what I need. Or, you can call different functions from different flavours of elements.
This is pure fluke. I've stumbled across the solution. What you do is hard-code the function(){ ... your code here ...} instead of the myfunction() call... Forgot you could do this in JS. I'm seeing this technique used all over the place. - var listener = addEventListener(elem, "click", function() {
-
alert("You clicked me!");
-
});
Hi,
I have a problem with Internet explorer as in my web applications second page, within few minutes I am getting this error-
The web page cannot be displayed. application is running fine in localhost but page expires if running on some other servers. In Mozilla Firefox its working fine. Please Help.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: masantha wee |
last post by:
Hi all,
I am using Firefox and embedding Javascript in html. I understand that
we can use mouse events by coding them in the body of html (by creating
a button or anything and by adding in the...
|
by: Noozer |
last post by:
Is it possible to detect where on a page the click occurred when the OnClick
event of the BODY tag is fired?
Thx
|
by: Eric-Sebastien Lachance |
last post by:
Hey there,
I decided to just create a 100% height and width div that filled the
space over a background header image, and add an onclick event to
redirect to the my index... Doesn't seem to work...
|
by: Nx |
last post by:
i've got it all working nicely in firefox, but whenever i test it in IE
none of the onclick events are triggered.
i'm using an xsl to transform an rss feed into a photogallery.
when i try to...
|
by: Magician |
last post by:
Hello.
I am trying to set the onclick event for images through a function, but the
event is triggered as soon the page loads, then will not work when the image
is clicked. Can anyone suggest what...
|
by: whitgurley |
last post by:
I've searched the web as well as I can for a solution to this problem
but have found nothing and just don't know enough about JavaScript to
figure out what's going. What I'm trying to do is convert...
|
by: NeoTubNinja |
last post by:
I have a select statement with various numbers. Upon clicking on one of the options, you are sent to a page that puts the option value in a session and returns back to the previous page. When it...
|
by: John Grandy |
last post by:
I wrote a function to populate my dropdowns on the client-side.
The function adds <optionelements to the <selectonly if none are
initially present.
I call the population function from either...
|
by: Geoff Cox |
last post by:
Hello
the following onclick works with IE 7 but not with Firefox 2.0.0.9.
any ideas please?
<form action="">
<select name="txtId">
<option="word1">word1</optionetc
</select>
|
by: Big Moxy |
last post by:
test page - http://projects.missioninternet.com/proweb/clients/test.php.
When I added the onclick event so that I could employ ajax on this
page the stylesheet formatting for this <lidisappeared....
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
|
by: Matthew3360 |
last post by:
Hi,
I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
|
by: Ricardo de Mila |
last post by:
Dear people, good afternoon...
I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control.
Than I need to discover what...
| |