问题描述
我正在开发一个网站,现在正在所有浏览器中进行测试,我目前正在firefox中进行测试,并且在使用event.sourceElement时发现并出错了吗?
I am developing a website and now am testing in all browsers, I am currently testing in firefox and have found and error when using event.sourceElement?
我需要e.srcElement要做的是返回值,在下面我将举例说明如何获取返回的PropID.
What i need e.srcElement to do is return values, a bit below i show an example on how i get the value PropID returned.
我已经编写了一个使用e.srcElement的Jquery函数,它看起来如下:
I have written a Jquery function that uses the e.srcElement and it looks as follows:
$(function () {
$(".DownloadLink").click(function (e) {
e.preventDefault();
var PropID = getParameterByName("PropID", e.srcElement.search),
Token = getParameterByName("Token", e.srcElement.search),
TrackingNumber = getParameterByName("TrackingNumber", e.srcElement.search);
$.post("Valuation", { PropID: PropID, Token: Token, TrackingNumber: TrackingNumber}, function (taskId) {
// Init monitors
$("#dialog-modal").append($("<p id='" + taskId + "'/>"));
updateMonitor(taskId, "Started");
// Periodically update Modal
var intervalId = setInterval(function () {
$.post("Progress", { id: taskId }, function (progress) {
if (progress < 50) {
updateMonitor(taskId, "Building File");
} else if (progress == 50) {
updateMonitor(taskId, "Uploading File to FormMobi");
} else if (progress >= 100) {
clearInterval(intervalId);
updateMonitor(taskId, "Complete");
window.location.href = "downloadcomplete";
}
});
}, 100);
});
});
e.srcElement的工作方式示例:
在chrome中测试并使用inspect元素时,我发现以下行返回:
While testing in chrome and using the inspect element i can find that the following line returns:
代码行:
返回结果:
所以我可以获得所需的PropID结果.
And so i can get the PropID result needed.
我还有其他原因为什么要返回所需的值吗?或者如何让e.srcElement在fireFox中工作?
Is there some other why for me to return the values needed? OrHow can i get e.srcElement to work in fireFox?
推荐答案
只需调用e.target
即可工作.而不是e.srcElement
[仅在IE中有效]
in firefox simply call e.target
to work. instead of e.srcElement
[which works only in IE]
这篇关于e.srcElement在Firefox中未定义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!