设置JavaScript弹出框的宽度 [英] Set width of javascript popup box

查看:128
本文介绍了设置JavaScript弹出框的宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
如何在JavaScript中换行

Possible Duplicate:
How to break line in Javascript

我正在使用以下JavaScript在客户网站的页面加载时显示弹出消息.我是JS的真正新手,只能真正复制/粘贴我在网上找到的示例.需要知道如何设置弹出框的宽度.我希望文本跨越两行,而不仅仅是跨越页面的宽度.这是www.manageourwebsite.com.au

I'm using the below javascript to display a popup message on page load for a clients website. I am a real novice at js and can only really copy/paste examples I find on the net. Need to know how I can set the width of the popup box. I would like the text to run over two lines, not just span the width of the page. Here is an example of how it appears www.manageourwebsite.com.au

<body onload="WelcomeMSG()">
    <script language="JavaScript">

<!--
function WelcomeMSG () 
{
alert("Our Retail shop front will be closed from Friday 21st December 2012 thru to Monday 21st January 2013. The Online store will be open 24/7 as usual  with all online orders being processed as normal.")

}

 -->
    </script>

推荐答案

如果您希望将文本包装在两行上,我建议在文本中的所需位置添加\ n换行符:

If you wish to wrap the text onto two lines I recommend adding the \n newline character in the desired location in your text:

alert("Hello\nWorld")

这篇关于设置JavaScript弹出框的宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆