关于Javascript字符串BUG
我们在head中的<Script></Script>中写如下函数:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
其他Body中的内容随便,这个时候我们用IE6,7,FireFox等浏览器打开,我们可以看到在第一排出现了内容“"; alert(s); } ”,这是怎么回事?我们再将我们这个函数改写如下:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
【本文章出自博客园深蓝居,转载请注明作者出处,如果您觉得博主的文章对您有很大帮助,欢迎支付宝(studyzy@163.com)对博主进行打赏。】
我们在head中的<Script></Script>中写如下函数:
其他Body中的内容随便,这个时候我们用IE6,7,FireFox等浏览器打开,我们可以看到在第一排出现了内容“"; alert(s); } ”,这是怎么回事?我们再将我们这个函数改写如下: