这个问题已经得到了回答。但是stackoverflow不会让我问其他问题。有人能帮上忙吗?
发布于 2012-12-22 02:45:25
声明s并将其默认设置为空字符串。如果q1不是nothing,则为s赋值。否则,s仍为空字符串。在稍后的代码中,您可以将文本框设置为使用s填充,如果q1为空,则s也将为空,因此不会在那里显示任何内容。
//declare s and set it to default to an empty string
var s = ''
//make sure q1 is defined and not null
if (q1 != undefined && q1 != null)
//if q1 is not empty, then set it equal to '_'+n1+'. '+q1,
//otherwise s will be an empty string
if (q1 != '')
s = '_'+n1+'. '+q1
//if s is empty you can do something,
//OR you can just set your input value to equal s
if (s == '')
//do some stuff herehttps://stackoverflow.com/questions/13995478
复制相似问题