我在两个不同的地方有两个js页面(来源于.js 和 target.js), 现在我想做的就是当用户点击源页的下调列表时, 它会将用户转向目标页面和反之。 我正向您提供所有位置的准确编码, 以及所有内容, 我只想知道如何从一个页面切换到第二个页面 。
源js 编码
var SourceSc = function() {
var that = {};
var _view = null;
var _childPanel = "#content";
var _sourceDlgMgrC = null;
var BEGIN = "BEGIN";
var STARTING = "STARTING";
var END = "END";
var TARGET = "TARGET";
var _state = BEGIN;
that.create = function(parent, panel) {
_parent = parent;
_panel = panel;
_transition(STARTING);
};
that.destroy = function() {
_transition(END);
};
that.eventTargetLanguageView = function() {
_transition(TARGET_LANGUAGE_VIEW);
};
var _transition = function(newState) {
_state = newState;
switch(_state) {
case STARTING: _enterStarting(); break;
case TARGET: _enterTargetDlg(); break;
case END: _enterEnd(); break;
}
};
var _enterStarting = function() {
modelMgr.loadInclude( code/app/sc/LoggedIn/sc/Source/c/SourceDlgMgrC.js , function() {
modelMgr.getHTML( code/app/sc/LoggedIn/sc/Source/Source.html , function(html) {
_sourceDlgMgrC = SourceDlgMgrC();
_sourceDlgMgrC.create(_childPanel);
var req = {};
var fnSuccess = function(res) {
_view = SourceV();
_view.create(that, _panel, html, res);
};
});
});
};
var _enterTargetDlg = function()
{
//now what i have to write here, to load target page
};
var _enterEnd = function() {
//coding of destroy
};
return that;};
var SourceV = function() {
var that = {};
var _sc = null;
var _panel = null;
that.create = function(sc, panel, html, res) {
_sc = sc;
_panel = panel;
that.layoutUi(html);
that.bindEvents();
};
that.layoutUi = function(html) {
$(_panel).html(html);
};
that.bindEvents = function() {
$( #viewList ).change(_sc.eventTargetLanguageView);
};
that.destroy = function() {
$(_panel).html( );
_panel = null;
_sc = null;
};
return that; };
I can post source. html 完整编码, 但我猜这将会少用一些, 所以我会只发布下拉列表编码 。
<select id = "viewList" class="fl width160">
<option>Source</option>
<option>Target</option>
</select>
现在目标页面的编码也完全相同,但目标js的位置是“代码/应用程序/sc/LoggedIn/sc/目标/目标/目标js”。