我有两个视图文件,一个用于产品,第二个用于预订。这是我想在视图页面之间调用的脚本,按下后面和下一个按钮来回来回。请告诉我怎么做。谢谢。
的script.js:
$(document).on('click', '.showNextPage', function() {
$.mobile.navigate('#second', {
transition: "slide"
});
});
$(document).on('click', '.showPrevPage', function() {
$.mobile.navigate("#index", {
transition: "slide"
});
});
预订查看Index.cshtml
@{
Layout = ViewBag.Layout;
}
@{ViewGenerator vg = new ViewGenerator();
CartInfo cartInfo = vg.GetBookingCartInfo();
@section head{
@Url.ScriptRender(BundleResources.BOOKIGN_SCRIPT)
@{if (DffUtility.SalesChannelID == 2)
{
<!-- Google Tag Manager -->
<script>
var google_tag_params =
{
hrental_id: '@cartInfo.ProdId',
hrental_pagetype: 'conversionintent',
hrental_startdate: '@cartInfo.StartDate.ToString("yyyy-MM-dd")',
hrental_enddate: '@cartInfo.EndDate.ToString("yyyy-MM-dd")',
hrental_totalvalue: '@cartInfo.TotalPrice'
}
</script>
<noscript>
<iframe src='//www.googletagmanager.com/ns.html?id=GTM-NMVP7S' height='0' width='0' style='display: none; visibility: hidden'></iframe>
</noscript>
<script>(function (w, d, s, l, i) { w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' }); var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src = '//www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f); })(window, document, 'script', 'dataLayer', 'GTM-NMVP7S');</script>
<!-- End Google Tag Manager -->
}
}
<!-- Advertiser 'Advantage Media Aps', Exclude user from segment 'Friferie 1. reg step Re-Targeting' -->
<script type="text/javascript">
var pixelSRCType = (("https:" == document.location.protocol) ? "https://" : "http://");
var cId = '299f5c2b-2920-4888-acc7-37be7f8a9d28';
var tName = 'basket';
var pId = '@cartInfo.ProdId'; // Insert comma seperated string of productid/ids
var revenue = '';
var orderId = '';
var p1 = '';
var p2 = '';
var p3 = '';
document.write("<iframe src='" + pixelSRCType + "adserver.adnexio.com/Tracking/EventHandler?cId=" + cId + "&tName=" + tName + "&pId=" + pId + "&revenue=" + revenue + "&orderId=" + orderId + "&p1=" + p1 + "&p2=" + p2 + "&p3=" + p3 + "' allowtransparency='true' framespacing='0' frameborder='no' scrolling='no' width='0' height='0'></iframe>");
</script>
<!-- End of segment tag -->
}
<script type="text/javascript">
var LoadCustomerInfo_Url, SaveBooking_Url, SendEmail_Url, CartInfo_Url, TENWEB_PATH, SeeMoreText, BOOKING_FORM, TellHome, Fax, PhoneHome, COAddress, City, Country,
CUSTOMER_INFO, BASIC_MESSAGE, BASIC_RULE, IsPartialPayment;
LoadCustomerInfo_Url = '@Html.Raw(string.Format("{0}/Booking.aspx/LoadCustomerInfo?{1}", ConfigurationSettings.TENWEB_PATH, Request.QueryString))';
SaveBooking_Url = '@Html.Raw(string.Format("{0}/Booking.aspx/SaveBooking?{1}", ConfigurationSettings.TENWEB_PATH, Request.QueryString))';
SendEmail_Url = '@Html.Raw(string.Format("{0}/Booking.aspx/SendErrorEmail?{1}", ConfigurationSettings.TENWEB_PATH, Request.QueryString))';
CartInfo_Url = '@Html.Raw(string.Format("{0}/Booking.aspx/LoadCartItems?{1}", ConfigurationSettings.TENWEB_PATH, Request.QueryString))';
TENWEB_PATH = '@Html.Raw(ConfigurationSettings.TENWEB_PATH)';
SeeMoreText = '@Html.Raw(DffUtility.GetGlobalResource("SeeMore"))';
IsPartialPayment = '@cartInfo.IsPartialPayment.ToString().ToLower()';
BASIC_MESSAGE = {
FName: '@Html.Raw(DffUtility.GetGlobalResource("FirstNameErrorText"))',
LName: '@Html.Raw(DffUtility.GetGlobalResource("LastNameErrorText"))',
Email: {
required: '@Html.Raw(DffUtility.GetGlobalResource("EmailErrorText"))',
email: '@Html.Raw(DffUtility.GetGlobalResource("EnterYourEmailErrorText"))'
},
Email2: {
required: '@Html.Raw(DffUtility.GetGlobalResource("ConfirmEmailErrorText"))',
equalTo: "@Html.Raw(DffUtility.GetGlobalResource("ConfirmEmailNotMatchText"))",
email: "@Html.Raw(DffUtility.GetGlobalResource("EnterConfirmEmailErrorText"))"
},
Address: '@Html.Raw(DffUtility.GetGlobalResource("AddressErrorText"))',
PostNo: '@Html.Raw(DffUtility.GetGlobalResource("PostNoErrorText"))',
MobileNo: '@Html.Raw(DffUtility.GetGlobalResource("MobileNoErrorText"))',
ddlCancellationInsurance: '@Html.Raw(DffUtility.GetGlobalResource("CancellationInsuranceErrorText"))',
ddlCardTypes: '@Html.Raw(DffUtility.GetGlobalResource("SelectCardType"))'
}
</script>
<div class="bestilling">
<form action="">
<div class="bestilling_i">
<h2>@Html.Raw(DffUtility.GetGlobalResource("OrderingOfHoliday"))</h2>
<div class="bestilling-wrap pb17">
<div class="bestilling__col bestilling_Align">
<div class="row-sel">
<div class="inp">
<input type="email" placeholder="@Html.Raw(DffUtility.GetGlobalResource("Email"))" id="Email" name="Email" onchange="LoadCustomerInfo()">
</div>
<div class="inp">
<input type="text" placeholder="@Html.Raw(DffUtility.GetGlobalResource("FirstName"))" id="FName" name="FName">
</div>
<div class="inp">
<input type="text" placeholder="@Html.Raw(DffUtility.GetGlobalResource("Address"))" id="Address" name="Address">
</div>
<div class="inp">
<input type="number" pattern="[0-9]*" placeholder="@Html.Raw(DffUtility.GetGlobalResource("MobileNo"))" id="MobileNo" name="MobileNo">
</div>
</div>
</div>
<!--bestilling__col end-->
<div class="bestilling__col bestilling_Align">
<div class="row-sel">
<div class="inp">
<input type="email" placeholder="@Html.Raw(DffUtility.GetGlobalResource("ConfirmEmail"))" id="Email2" name="Email2">
</div>
<div class="inp">
<input type="text" placeholder="@Html.Raw(DffUtility.GetGlobalResource("LastName"))" id="LName" name="LName">
</div>
<div class="inp">
<input type="number" pattern="[0-9]*" placeholder="@Html.Raw(DffUtility.GetGlobalResource("PostNo"))" id="PostNo" name="PostNo">
</div>
@*<div class="inp">
<input type="text" placeholder="@Html.Raw(DffUtility.GetGlobalResource("PromoCode"))" id="PromoCode" name="PromoCode">
</div>*@
</div>
</div>
<!--bestilling__col end-->
<div class="clear-both"></div>
</div>
<div class="bestilling-wrap">
<h3>@Html.Raw(DffUtility.GetGlobalResource("DimensionsAndAcquisitions"))</h3>
</div>
@{if (cartInfo.IsCancellationInsuranceEnable)
{
<div class="bestilling-wrap pb19">
<div class="bestilling__col">
<i>@Html.Raw(string.Format(DffUtility.GetGlobalResource("AmendingAndCancellation"), cartInfo.CancellationInsurancePrice))</i>
<div class="row-sel">
<div class="inp">
<select class="select-inp" tabindex="-1" title="" id="ddlCancellationInsurance" name="ddlCancellationInsurance" onchange="UpdateCartInfo()">
<option value="0">@Html.Raw(DffUtility.GetGlobalResource("SelectIns"))</option>
<option value="1">@Html.Raw(DffUtility.GetGlobalResource("YesPlease"))</option>
<option value="2">@Html.Raw(DffUtility.GetGlobalResource("NoIns"))</option>
</select>
</div>
</div>
<!--row-sel end-->
</div>
<!--bestilling__col end-->
</div>
}
}
<!--bestilling-wrap end-->
</div>
@*</form>*@
<div class="bestilling__info">
<div class="bestilling__info_i">
<p>
@cartInfo.DestinationText
<a class="btnMoreCartInfo" onclick="ShowMoreCartInfo()" href="javascript:void(0)">@Html.Raw(DffUtility.GetGlobalResource("SeeMore")) +</a>
</p>
<div class="more-text" id="MoreCartInfo">
<i>@Html.Raw(cartInfo.PaxAndDateInfoText)</i>
<div class="sub-total">
<div class="row">
<p><b>@cartInfo.AccomodationPriceText:</b> <i style="width: 70%;">@cartInfo.AccomodationDiscountText</i></p>
<span>@cartInfo.AccomodationPriceValue<br />
<i>@cartInfo.AccomodationDiscountValue</i></span>
</div>
@{if (cartInfo.MandatoryProdObjs != null)
{
foreach (MandatoryProdObjs mpo in cartInfo.MandatoryProdObjs)
{
<div class="row">
<p>@mpo.Caption:</p>
<span>@mpo.Price</span>
</div>
}
}
}
@{if (!string.IsNullOrEmpty(cartInfo.CleaningValue))
{
<div class="row">
<p>@cartInfo.CleaningText:</p>
<span>@cartInfo.CleaningValue</span>
</div>
}
}
@{if (cartInfo.IsCancellationInsuranceEnable)
{
<div class="row">
<p>@cartInfo.CancellationInsurance:</p>
<span class="CancellationInsurancePrice">@cartInfo.CancellationInsuranceValue</span>
</div>
}
}
</div>
</div>
</div>
<div class="total">
<p>@cartInfo.TotalPriceText:<a class="btnMoreTotalPrice" onclick="ShowMoreTotalPrice()" href="javascript:void(0)">@Html.Raw(DffUtility.GetGlobalResource("SeeMore")) +</a></p>
<span class="TotalPrice">@cartInfo.TotalPriceValue</span>
<div class="more-text" id="MoreTotalPrice"><i>@Html.Raw(DffUtility.GetGlobalResource("BookingFeeInclusive"))</i></div>
</div>
</div>
@{ if (cartInfo.IsPaymentEnable)
{
string fullPaymentCheck = "checked";
string partialPaymentCheck = "";
string totalPaymentDisplay = "none";
if (cartInfo.IsPartialPayment)
{
fullPaymentCheck = "";
partialPaymentCheck = "checked";
totalPaymentDisplay = "block";
}
<div class="bestilling__info" style="background: #fff;">
<div class="bestilling__info_i" style="padding-bottom: 0px;">
<p>
@cartInfo.ChoosePaymentMethod
<a class="btnMorePaymentInfo" style="padding-bottom: 5px;" onclick="ShowMorePaymentInfo()" href="javascript:void(0)">@Html.Raw(DffUtility.GetGlobalResource("SeeMore")) -</a>
</p>
<div class="more-text payment-info" id="MorePaymentInfo" style="display: block">
@{ if (cartInfo.ChkFullPayment && cartInfo.ChkInstallmentPayment)
{
<span>
<input type="checkbox" id="chkFullPayment" name="chkFullPayment" @fullPaymentCheck onchange="FullPayment()">
<b style="vertical-align: super;" class="FullPaymentText">@cartInfo.FullPaymentText</b><br>
<input type="checkbox" id="chkFirstPayment" name="chkFirstPayment" onchange="FirstPayment()" @partialPaymentCheck>
<b style="vertical-align: super;" class="InstallmentPaymentText">@cartInfo.InstallmentPaymentText</b>
</span>
}
}
<div class="sub-total">
<div class="row pnlTotalPrice" style="display: @totalPaymentDisplay;">
<p>@cartInfo.TotalPriceText:</p>
<span class="TotalPrice">@cartInfo.TotalPriceValue</span>
</div>
<div class="row">
<p>@cartInfo.PaymentPriceText:</p>
<span class="PaymentPriceValue">@cartInfo.PaymentPriceValue</span>
</div>
<div class="row">
<p class="CardFeeText">@cartInfo.CardFeeText:</p>
<span class="CardFeeValue">@cartInfo.CardFeeValue</span>
</div>
<div class="row">
<p class="FirstPaymentText">@cartInfo.FirstPaymentText:</p>
<span class="FirstPaymentValue">@cartInfo.FirstPaymentValue</span>
</div>
</div>
<div style="padding-top: 10px;">
<p>
@cartInfo.ChoosePayment:
</p>
<div class="row-sel">
<div class="inp">
<select class="select-inp" tabindex="-1" title="" id="ddlCardTypes" name="ddlCardTypes" onchange="UpdateCartInfo()">
@{ foreach (CardTypes type in cartInfo.CardTypes)
{
<option value="@type.Value">@type.Text</option>
}
}
</select>
</div>
</div>
</div>
</div>
</div>
</div>
}
}
<div class="bestilling__info" style="padding: 14px 0px;">
<div class="bestilling__info_btn">
<a class="btn btn_green" onclick="SaveBooking()" id="btnSave" href='javascript:void(0)'>@Html.Raw(DffUtility.GetGlobalResource("Book"))</a>
</div>
</div>
</form>
<!--bestilling__info end-->
</div>
}
<div class="Progress_Layout" style="display: none;">
<div class="Progress_Content">
<div>
<img src="@Url.FilePath(FileTypes.IMAGES, "loader", "10271456A2B3")" style="vertical-align: middle" alt="" />
</div>
<div class="Progress_Text">
@DffUtility.GetGlobalResource("pleaseWait")
</div>
</div>
</div>
<div data-role="page" id="index" data-theme="a" >
<div data-role="header">
<h3>
First Page
</h3>
<a class="ui-btn-right showNextPage">Next</a>
</div>
<div data-role="content">
<p>1st List Example:</p>
<ol>
<li>HTML Examples</li>
<li>HTML Tutorial</li>
<li>HTML Codes</li>
<li>and much more!</li>
</ol>
</div>
<div data-role="footer" data-position="fixed">
</div>
</div>
<div data-role="page" id="second" data-theme="a" >
<div data-role="header">
<h3>
Second Page
</h3>
<a class="ui-btn-left showPrevPage">Back</a>
</div>
<div data-role="content">
<p>Image Example:</p>
<p>Second List Example:</p>
<ol>
<li>HTML Examples</li>
<li>HTML Tutorial</li>
<li>HTML Codes</li>
<li>and much more!</li>
</ol>
</div>
<div data-role="footer" data-position="fixed">
</div>
</div>
产品视图:
@{
Layout = ViewBag.Layout;
}
<script type="text/javascript">
PAGE_TYPE = @DffUtility.PageType,
BASIC_PARA = '@(Html.Raw(DffUtility.Basic_QueryString))'
</script>
@section head{
@Html.Raw(ViewBag.SEARCH_HEAD)
@Html.Raw(ViewBag.SEARCH_SCRIPT)
@Url.ScriptRender(BundleResources.WOWSLIDER_SCRIPT)
@Url.ScriptRender(BundleResources.SOCIAL_SCRIPT)
}
@section header{
@Html.Raw(ViewBag.SEARCH_HTML)
@Html.Partial("PriceCalculation")
}
@Html.Raw(ViewBag.HTML)
@section footer{
@Url.CssRender(BundleResources.WOWSLIDER_CSS)
}
Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@Html.Raw(ViewBag.Title)</title>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta id="descriptionTag" name="description" content="@MvcHtmlString.Create(ViewBag.Description)" />
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
<meta name="ROBOTS" content="NOHTMLINDEX" />
<link href="@Url.FilePath(FileTypes.IMAGES, "favicon", "C3AC16EE6772")" rel="shortcut icon" type="image/x-icon" />
<style>
@{ string basefontpath = ConfigurationSettings.HOST + Url.Content("~/Resources/") + "fonts/";
}
@@font-face { font-family: 'TradeGothicLTStdBold'; src: url("@(basefontpath + "TradeGothicLTStdBold.eot")"); src: url("@(basefontpath + "TradeGothicLTStdBold.eot")") format("embedded-opentype"), url("@(basefontpath + "TradeGothicLTStdBold.woff2")") format("woff2"), url("@(basefontpath + "TradeGothicLTStdBold.woff")") format("woff"), url("@(basefontpath + "TradeGothicLTStdBold.ttf")") format("truetype"), url("@(basefontpath + "TradeGothicLTStdBold.svg#TradeGothicLTStdBold")") format("svg"); }
@@font-face { font-family: 'ITCAvantGardeStdMd'; src: url("@(basefontpath + "ITCAvantGardeStdMd.eot")"); src: url("@(basefontpath + "ITCAvantGardeStdMd.eot")") format("embedded-opentype"), url("@(basefontpath + "ITCAvantGardeStdMd.woff2")") format("woff2"), url("@(basefontpath + "ITCAvantGardeStdMd.woff")") format("woff"), url("@(basefontpath + "ITCAvantGardeStdMd.ttf")") format("truetype"), url("@(basefontpath + "ITCAvantGardeStdMd.svg#ITCAvantGardeStdMd")") format("svg"); }
@@font-face {font-family: 'Droid Sans';font-style: normal;font-weight: 400;src: local('Droid Sans'), local('DroidSans'), url("@(basefontpath + "s-BiyweUPV0v-yRb-cjciL3hpw3pgy2gAi-Ip7WPMi0.woff")") format('woff');}
@@font-face {font-family: 'Droid Sans';font-style: normal;font-weight: 700;src: local('Droid Sans Bold'), local('DroidSans-Bold'), url("@(basefontpath + "EFpQQyG9GqCrobXxL-KRMXbFhgvWbfSbdVg11QabG8w.woff")") format('woff');
@@font-face {font-family: 'Open Sans';font-style: normal;font-weight: 400;src: local('Open Sans'), local('OpenSans'), url("@(basefontpath + "cJZKeOuBrn4kERxqtaUH3bO3LdcAZYWl9Si6vvxL-qU.woff")") format('woff');}
@@font-face {font-family: 'Open Sans';font-style: normal;font-weight: 700;src: local('Open Sans Bold'), local('OpenSans-Bold'), url("@(basefontpath + "k3k702ZOKiLJc3WVjuplzKRDOzjiPcYnFooOUGCOsRk.woff")") format('woff');}
@@font-face {font-family: 'Open Sans';font-style: normal;font-weight: 600;src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url("@(basefontpath + "MTP_ySUJH_bn48VBG8sNSqRDOzjiPcYnFooOUGCOsRk.woff")") format('woff');}
}
</style>
@{
@Url.ScriptRender(BundleResources.BASIC_SCRIPT)
@Url.CssRender(BundleResources.BASIC_CSS)
}
@RenderSection("head", required: false)
<script type="text/javascript">
src = "http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"
src = "http://code.jquery.com/jquery-1.10.1.min.js"
$(document).on('click', '.showNextPage', function() {
$.mobile.navigate('#second', {
transition: "slide"
});
});
$(document).on('click', '.showPrevPage', function() {
$.mobile.navigate("#index", {
transition: "slide"
});
});
</script>
</head>
<body>
<header>
<div class="fri-col-sm-1 ">
<a class="arr-prev" href="#"> </a>
</div>
<div class="fri-col-sm-7 ">
<a class="logo" href="@ViewBag.Site">
<img src="@Url.FilePath(FileTypes.IMAGES, "logo", "AC9A5300E0D9")" alt="friferie" /></a>
</div>
<div class="fri-col-sm-1 ">
@*@(Html.RenderControl<Menu>("~/Menu/Menu.ascx", x => { x.MENU_NAV = SharePointServiceHelper.GetAllNavigationTerms(); x.MENU_ISMOBILE = DffUtility.IsMobile; x.MENU_PATH = Url.Content("~"); x.MENU_CSS = Url.FilePath(FileTypes.CSS, "Menu", "C7FC02E3E231"); x.MENU_JS = Url.FilePath(FileTypes.JS, "menu", "FAA6A2464B43"); x.MENU_ICON = Url.FilePath(FileTypes.IMAGES, "menu", "4A01DD1145F6"); x.MENU_EXTRACLASS = "menu-icon"; }))*@
</div>
<div class="clear-both"></div>
@RenderSection("header", required: false)
</header>
<div class="content">
<div class="ferie-home">
@RenderBody()
</div>
@*@Html.Raw(ViewBag.Footer)*@
</div>
@RenderSection("footer", required: false)
</body>
</html>