gpt4 book ai didi

查询 : To redirect from one page to another page

转载 作者:行者123 更新时间:2023-11-28 02:07:12 25 4
gpt4 key购买 nike

我在两个不同的位置有两个 js 页面(Source.js 和 Target.js),现在我想做的就是当用户点击源页面的下拉列表时,它将用户重定向到目标页面,反之亦然。我为您提供了所有位置和所有内容的准确编码,我只想知道如何从一页切换到第二页。

Source.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; };

我可以发布 source.html 完整编码,但我想这会用得更少,所以我只会发布下拉列表编码

    <select id = "viewList" class="fl width160">
<option>Source</option>
<option>Target</option>
</select>

现在目标页面的编码也完全相同,但 Target.js 的位置是“code/app/sc/LoggedIn/sc/Target/Target.js”

最佳答案

试试这个...(只是为了举例)

 codeLoadingMgr.loadInclude( path + '/AdminSc.js', function() {
_adminSc = AdminSc();
_adminSc.create(that, path, _childPanel,_selectedAdminTab, _programId);
});

关于查询 : To redirect from one page to another page,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10749692/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com