简体   繁体   中英

URL slashes are removed

I have a .NET application that writes an HTML page. One page loads a lot of iframes, so I need to have them run onclick (rather than at page load).

b.Body = "<iframe id=" & Chr(34) & linkID & Chr(34) & "></iframe><a href=" & Chr(34) & "javascript:document.getElementById('" & linkID & "').src=" & Chr(34) & link & Chr(34) & ";></a>"

The problem is once it writes, it removes all slashes from my URL. I've tried escaping them, but spaces are included (which breaks the URL). What am I doing wrong?

使用双引号代替单双引号,并使用单引号在javascript中编写字符串

b.Body = "<iframe id=""" & linkID & """></iframe><a href=""" & "javascript:document.getElementById('" & linkID & "').src='" & link & "';""></a>"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM