javascript错误:'NAD197005601'未定义 [英] javascript Error: 'NAD197005601' is undefined
问题描述
我正在弄错我的javascript错误。我正在尝试使用javascript创建一个模态弹出窗口。我正在使用的javascript代码是:
Hi,
I am breaking my head with a javascript error that I am getting. I am trying to create a modal Popup using javascript. The javascript code that I am using is:
function OpenModalDialogCredit(RRID, SLA_Bucket, AccountNum) {
var vReturnValue;
var AccountNo = new String();
AccountNo = AccountNum.toString();
var url = "RR_Txn_Detail.aspx?RRID=" + RRID + "BucketID=" + SLA_Bucket + "AccNum=" & AccountNum;
if (url != null) {
vReturnValue = window.showModalDialog("Risk_Report_Weekly_Txn_Detail.aspx?RRID=" + RRID + "&BucketID=" + SLA_Bucket + "&AccNum=" + AccountNum + "&DtCt=" + 2, '', 'dialogWidth:800px,dialogHeight:1200px,scroll:1,center:yes;unadorned:yes', 'screenx=100', 'screeny=100');
}
else {
alert("No URL passed to open");
}
}
以上代码适用于AccountNum是一个数字但是当AccountNum有字母和数字,我收到一个错误说:SCRIPT5009:'NAD197005601'未定义。现在'NAD197005601'是传递给函数的AccountNum参数,但由于某种原因,它表示未定义。
请帮助我。
谢谢
The above code works when AccountNum is a Number but when AccountNum has letters and Numbers, I get an error saying: SCRIPT5009: 'NAD197005601' is undefined. Now 'NAD197005601'is the AccountNum parameter that is passed into the function but for some reason it says its undefined.
Please help me.
thanks
推荐答案
我想你忘记了网址中的一些重要字符;见下文:
I think you forgot some important characters in your url ; see below:
var url = "RR_Txn_Detail.aspx?RRID=" + RRID + "&BucketID=" + SLA_Bucket + "&AccNum=" & AccountNum;
但以这种方式构建您的网址会更好:
But it would be even better to construct your URL this way:
var url = string.Format("RR_Txn_Detail.aspx?RRID={0}&BucketID={1}&AccNum={2}", RRID, SLA_Bucket, AccountNum);
更清楚阅读并最终调试。
希望这会有所帮助。
Much more clear to read and eventually debug.
Hope this helps.
Private Sub OpenViewDetailWindow(ByVal BugId As String,ByVal动作作为Actions,ByVal Mode As Mode,ByVal OldBugStatusId As String,ByVal MaxStatusId As Status,ByVal MaxStatusById As String)
Dim oPopupWindowParameters As PopupWindow_Parameters = New PopupWindow_Parameters
with oPopupWindowParameters
.ActionTaken = action
.BugId = BugId
。模=模式
.OldBugStatusId = OldBugStat usId
.MaxStatusId = MaxStatusId
.MaxStatusById = MaxStatusById
结束
Session(PopupWindowParameters)= oPopupWindowParameters
Dim JScrip As StringBuilder = New StringBuilder
Dim Location As String = Request.ApplicationPath&/ BootTrack / ViewCallDetails.aspx
位置=位置&?action =&action
JScrip.Append(< script language ='javascript'type ='text / javascript'>& vbCrLf)
JScrip.Append(var WinSettings ='center:yes; resizable:no; dialogWidth:800pt; dialogHeight:500pt';)
JScrip.Append( window.showModalDialog('&Location&',window,WinSettings);)
'JScrip.Append(window.open('&Location&');)
JScrip.Append(< / script>)
Page.ClientScript.RegisterStartupScript(GetType(String) ,ViewDetails,JScrip.ToString())
End Sub
Private Sub OpenViewDetailWindow(ByVal BugId As String, ByVal action As Actions, ByVal Mode As Mode, ByVal OldBugStatusId As String, ByVal MaxStatusId As Status, ByVal MaxStatusById As String)
Dim oPopupWindowParameters As PopupWindow_Parameters = New PopupWindow_Parameters
With oPopupWindowParameters
.ActionTaken = action
.BugId = BugId
.Mode = Mode
.OldBugStatusId = OldBugStatusId
.MaxStatusId = MaxStatusId
.MaxStatusById = MaxStatusById
End With
Session("PopupWindowParameters") = oPopupWindowParameters
Dim JScrip As StringBuilder = New StringBuilder
Dim Location As String = Request.ApplicationPath & "/BugTrack/ViewCallDetails.aspx"
Location = Location & "?action=" & action
JScrip.Append("<script language='javascript' type='text/javascript'>" & vbCrLf)
JScrip.Append(" var WinSettings = 'center:yes;resizable:no;dialogWidth:800pt;dialogHeight:500pt';")
JScrip.Append("window.showModalDialog('" & Location & "', window, WinSettings);")
'JScrip.Append("window.open('" & Location & "');")
JScrip.Append("</script>")
Page.ClientScript.RegisterStartupScript(GetType(String), "ViewDetails", JScrip.ToString())
End Sub
这篇关于javascript错误:'NAD197005601'未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!