|
-
Dec 10th, 2002, 02:12 PM
#1
Thread Starter
Registered User
Carriage Returns
I have the following code in my Page_load event. Can someone tell me how I can add carriage returns at the end of each line of my javascript string? When VB renders the HTML I want my javascript to look nice. At the moment my javascript is written on one line.
Dim sScript As String
sScript = "<script language=javascript> "
sScript += "Function Wait(agr)"
sScript += "{"
sScript += "document.body.style.cursor='wait';__doPostBack(agr, '');"
sScript += "}"
sScript += "function __doPostBack(eventTarget, eventArgument)"
sScript += "{"
sScript += "var theform = document._ctl0;"
sScript += "theform.__EVENTTARGET.value = eventTarget;"
sScript += "theform.__EVENTARGUMENT.value = eventArgument;"
sScript += "theform.submit();"
sScript += "</script>"
If (Not IsClientScriptBlockRegistered("MyScript")) Then
RegisterClientScriptBlock("MyScript", sScript)
End If
Company.Attributes.Add("onChange", "Wait('Company','');")
Thanks
James
-
Dec 10th, 2002, 02:57 PM
#2
Code:
Dim sScript As String
sScript = "<script language=javascript> " & vbcrlf
sScript += "Function Wait(agr)" & vbcrlf
sScript += "{" & vbcrlf
sScript += "document.body.style.cursor='wait';__doPostBack(agr, '');" & vbcrlf
sScript += "}" & vbcrlf
sScript += "function __doPostBack(eventTarget, eventArgument)" & vbcrlf
sScript += "{" & vbcrlf
sScript += "var theform = document._ctl0;" & vbcrlf
sScript += "theform.__EVENTTARGET.value = eventTarget;" & vbcrlf
sScript += "theform.__EVENTARGUMENT.value = eventArgument;" & vbcrlf
sScript += "theform.submit();" & vbcrlf
sScript += "</script>"
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Dec 10th, 2002, 03:10 PM
#3
Thread Starter
Registered User
I tried & vbcrlf but when I ran my code I got an error saying that vbcrlf was not declared. Do you know why?
James
-
Dec 10th, 2002, 05:36 PM
#4
You need to either
imports microsoft.VisualBasic
or reference it directly as
microsoft.VisualBasic.vbCrLf
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|