admin管理员组文章数量:1290935
We are passing the url page to our Admin Emails through the 'refer' id in Joomla using ...
window.addEvent('domready', function()
{
document.getElementById('refer').value=window.location.href;
});
This code works on some sites but not others. I have tried a jquery version with little luck, though I am open for suggestions. A site not returning the url via email is at while a site that is working is at . We are using 'refer' as a hidden field and everything matches, so I believe the issues is with the window.addEvent('domready', function() unless there is a conflict I am not aware of. Another interesting thing is the working domain has many more script files that has in the past found conflict between script files, while the smaller site has not.
We are passing the url page to our Admin Emails through the 'refer' id in Joomla using ...
window.addEvent('domready', function()
{
document.getElementById('refer').value=window.location.href;
});
This code works on some sites but not others. I have tried a jquery version with little luck, though I am open for suggestions. A site not returning the url via email is at http://www.freestylelitemeter. while a site that is working is at http://www.parediabetictestingsupplies.. We are using 'refer' as a hidden field and everything matches, so I believe the issues is with the window.addEvent('domready', function() unless there is a conflict I am not aware of. Another interesting thing is the working domain has many more script files that has in the past found conflict between script files, while the smaller site has not.
Share Improve this question asked Feb 3, 2012 at 18:32 ShaneShane 1,6403 gold badges23 silver badges51 bronze badges 1- When it doesn't work, what happens? – Diodeus - James MacFarlane Commented Feb 3, 2012 at 18:36
1 Answer
Reset to default 7At http://www.freestylelitemeter./, MooTools fails to load. You get this error in your JavaScript console:
SCRIPT438: Object doesn't support property or method 'getElement'
mootools.js, line 53 character 97
MooTools extends window
with addEvent()
. Since MooTools hasn't loaded, addEvent()
fails and your code is never executed.
You have a buggy version of MooTools, correct that and your problem should be resolved.
But, better yet, you are already using jQuery. Just change your code to this:
$(function ()
{
$('#refer').val(location.href);
});
Are you even using MooTools much? You may be able to switch to jQuery exclusively, and load one fewer library.
本文标签:
版权声明:本文标题:javascript - What are alternatives to window.addEvent('domready',function() for window.location.href? - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741524310a2383376.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论