By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,969 Members | 1,767 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,969 IT Pros & Developers. It's quick & easy.

Re: onclick and DOM in parent window problem

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
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

P: n/a
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.