0

我一直在尝试使用在 Java 中类似使用的 '\n' 进入下一行,但它似乎在这个脚本中不起作用。

'\n' 不起作用,但整个函数没有它。

我的问题是你怎么去下一行?

    String text_name = Text_Name.Text;
    String text_email = Text_Email.Text;
    String text_message = Text_Message.Text;

    ClientScript.RegisterStartupScript(this.GetType(), "mailto",

       "<script type = 'text/javascript'>parent.location='mailto:" + "someone@gmail.com" +

       "?subject=" + "Inquiry" +

       "&body=" + 

       "Contact Name: " + text_name + '\n' +

       "Contact By: " + text_email + '\n' +

       "Inquiry: " + text_message + '\n' +

       "'</script>"); 
4

4 回答 4

2

尝试Environment.NewLine代替'\n'.

于 2012-07-24T15:56:57.630 回答
0

Try using '\r\n' instead of '\n'. Or you may also use 'Environment.NewLine'

MessageBox.Show("Line 1" + Environment.NewLine + "Line 2");

or

MessageBox.Show("Line 1\r\nLine2", "BlahBlah", MessageBoxButtons.OK, MessageBoxIcon.Question);
于 2012-07-24T16:01:20.550 回答
0

尝试将 %0A 作为新行放入 mailto

于 2013-04-30T00:49:02.797 回答
0

使用Environment.NewLine而不是\n

"Contact Name: " + text_name + Environment.NewLine +
于 2012-07-24T15:57:51.437 回答