471,896 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Re: onclick and DOM in parent window problem

Martin Honnen ha scritto:
Use properties, not setAttribute:
myTd7.className = "adminfield";
Sorry, which is the difference?
myTd7a.setAttribute("onclick","javascript:deleteRo w(this)");

myTd7a.onclick = function () { deleteRow(this); };
Done, but however i have the same problem...nothing is done and no
error appear...
I have also an "alert" into the function but is not executed. :-/
Jun 27 '08 #1
2 1041
Flyzone wrote:
Martin Honnen ha scritto:
>Use properties, not setAttribute:
myTd7.className = "adminfield";

Sorry, which is the difference?
The difference is, since Element::setAttribute() is known to suffer from
a number of buggy implementations, you should use the attribute property
instead of E::setAttribute() where there is one.
>>myTd7a.setAttribute("onclick","javascript:delete Row(this)");
myTd7a.onclick = function () { deleteRow(this); };

Done, but however i have the same problem...nothing is done and no
error appear...
I have also an "alert" into the function but is not executed. :-/
Then the error is likely to be elsewhere, and you should debug your code:

http://www.jibbering.com/faq/faq_not...ml#ps1DontWork
http://jibbering.com/faq/#FAQ4_43
http://jibbering.com/faq/#FAQ3_2

<FAQENTRY>
As mentioned earlier, the FAQ Notes entry "Don't work" should refer to
FAQ 4.43.

FAQ 4.43 should refer to to FAQ 3.2 since debuggers help to show
non-obvious errors.

FAQ 3.2 should be structured better. It desperately needs one or more
unordered lists and to contain at least one subsection titled "Debuggers",
which should at least include references to Venkman, the debugger in
Firebug, and the Microsoft Script Debugger.

Opera 9.x and Apple Safari 3.x provide pretty neat developer tools as
well:

* http://dev.opera.com/tools/

* http://developer.apple.com/internet/....html#anchor14
(The information there appears to be slightly out of date; you need
to put that key into WebKitPreferences.plist instead. YMMV.)
</FAQENTRY>

That said, you may have better luck with the standards-compliant approach,
and the proprietary one only as a fallback:

function isMethod(o, p)
{
var t;
return o && /\b(function|object|unknown)\b/i.test(typeof o[p]) && o[p];
}

var o = myTd7a,
f = function() { deleteRow(this); };

if (isMethod(o, "addEventListener"))
{
o.addEventListener("click", f, false);
}
else if (typeof o.onclick != "undefined")
{
o.onclick = f;
}
HTH

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #2
On 14 Apr, 11:52, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
function isMethod(o, p)
I solved the problem.
In the source HTML i neede to add also the <tbodytag, that FF add by
itself using the dom, but IE need to show the new table.
Jun 27 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Jez | last post: by
17 posts views Thread by Mike Gratee | last post: by
9 posts views Thread by Todd | last post: by
11 posts views Thread by nma | last post: by

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.