我正在浏览.js文件,并在每行结尾处找到带反斜杠的html标签。有人可以告诉我它的原因吗?
我添加了完整的代码。请让我知道为什么会出现反斜杠。
例如
$(document).ready(function () {
$("#nav").html(
"<hr class='menubegin' />\
<div id='menu'>\
<ul>\
<li><a href='fawcettHome.htm'>Home</a></li>\
<li aria-haspopup='true'><a href='#'>Courses ▾</a>\
<ul>\
<li aria-haspopup='false'><a href='Courses.htm'>Courses</a></li>\
<li aria-haspopup='false'><a href='CSE681.htm'>CSE681-SMA</a></li>\
<li aria-haspopup='false'><a href='CSE686.htm'>CSE686-IP</a></li>\
<li aria-haspopup='false'><a href='CSE687.htm'>CSE687-OOD</a></li>\
<li aria-haspopup='false'><a href='CSE775.htm'>CSE775-DO</a></li>\
<li aria-haspopup='false'><a href='CSE776.htm'>CSE776-DP</a></li>\
<li aria-haspopup='false'><a href='CSE784.htm'>CSE784-SS</a></li>\
<li aria-haspopup='false'><a href='Code.htm'>Sample Code</a></li>\
<li aria-haspopup='false'><a href='OfficeHours.htm'>Office Hours</a></li>\
<li aria-haspopup='false'><a href='Courses.htm'>Program Plan</a></li>\
<li aria-haspopup='false'><a href='SoftwareTrack.htm'>SW Track</a></li>\
</ul>\
</li>\
<li aria-haspopup='true'><a href='#'>Core Tech ▾</a>\
<ul>\
<li aria-haspopup='false'><a href='CoreTechnologies.htm'>Core Technologies</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/Cpp.htm'>C++</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/Cpp.htm'>C++/CLI</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/CSharp.htm'>C#, .Net</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/Sockets.htm'>Network Prog</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/ThreadsAndSynch.htm'>Threads</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/Win32SystemProgramming.htm'>Win32 Sys</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/WindowsProgramming.htm'>Win GUI</a></li>\
<li aria-haspopup='false'><a href='../CoreTechnologies/XML.htm'>XML</a></li>\
<li aria-haspopup='false'><a href='Mathematics.htm'>Math</a></li>\
</ul>\
</li>\
<li aria-haspopup='true'><a href='#'>Directories ▾</a>\
<ul>\
<li aria-haspopup='false'><a href='../'>Handouts</a></li>\
<li aria-haspopup='false'><a href='../Coretechnologies/'>CoreTech</a></li>\
<li aria-haspopup='false'><a href='../CSE681/'>CSE681-SMA</a></li>\
<li aria-haspopup='false'><a href='../CSE686/'>CSE686-IP</a></li>\
<li aria-haspopup='false'><a href='../CSE687/'>CSE687-OOD</a></li>\
<li aria-haspopup='false'><a href='../CSE775/'>CSE775-DO</a></li>\
<li aria-haspopup='false'><a href='../CSE776/'>CSE776-DP</a></li>\
<li aria-haspopup='false'><a href='../CSE784/'>CSE784-SS</a></li>\
<li aria-haspopup='false'><a href='../SummerProjects/'>Summer Prj</a></li>\
</ul>\
</li>\
<li aria-haspopup='true'><a href='#'>Research ▾</a>\
<ul>\
<li aria-haspopup='false'><a href='Research.htm'>Research</a></li>\
<li aria-haspopup='false'><a href='ResearchStatement.htm'>Research Statment</a></li>\
<li aria-haspopup='false'><a href='ResearchCode.htm'>Research Code</a></li>\
<li aria-haspopup='false'><a href='SWMatrixCrossPlatformDev.htm'>V.Appaduri</a></li>\
<li aria-haspopup='false'><a href='http://www.lcs3.syr.edu/faculty/fawcett/handouts/research/bolazar/main/index.html'>K.Bolazar</a></li>\
<li aria-haspopup='false'><a href='SoftwareMatrix.htm'>R.Ghosh</a></li>\
<li aria-haspopup='false'><a href='VoiceActivatedRecording.htm'>J.Goddard</a></li>\
<li aria-haspopup='false'><a href='http://www.lcs3.syr.edu/faculty/fawcett/handouts/research/MuratsResearch/MuratsDefense/StructuralModelsForLargeSoftwareSystems.htm'>M.Gungor</a></li>\
<li aria-haspopup='false'><a href='KayaDefense.htm'>M.Kaya</a></li>\
<li aria-haspopup='false'><a href='AspectOrientedProgramming.htm'>R.Krishnan-Chittur</a></li>\
<li aria-haspopup='false'><a href='SelfHealingSoftwareMatrix.htm'>A.Krishna</a></li>\
<li aria-haspopup='false'><a href='Test2.html'>M.Mohammed</a></li>\
<li aria-haspopup='false'><a href='SWMatrixModelDrivenDev.htm'>T.Patel</a></li>\
<li aria-haspopup='false'><a href='ComputingWithGPUs.htm'>P.Pratt-Szeliga</a></li>\
<li aria-haspopup='false'><a href='SoftwareRestructuring.htm'>S.Singh</a></li>\
<li aria-haspopup='false'><a href='EnhancedDebuggingThruVirtualization.htm'>R.Wilson</a></li>\
</ul>\
</li>\
<li class='left' aria-haspopup='false'><a href='Notices.htm'>Notices</a></li>\
<li aria-haspopup='true' class='left'><a href='#'>EECS ▾</a>\
<ul>\
<li aria-haspopup='false'><a href='GradOrientation.htm'>Orientation</a></li>\
<li aria-haspopup='false'><a href='StudentPictures.htm'>Student Picturess</a></li>\
<li aria-haspopup='false'><a href='StudentCultures.htm'>Student Cultures</a></li>\
<li aria-haspopup='false'><a href='Graduates.htm'>Graduates</a></li>\
</ul>\
</li>\
</ul>\
</div>\
<hr class='menuend' />"
);
});
答案 0 :(得分:1)
代码表示包含原始HTML的JavaScript字符串对象。 \
字符允许在字符串中插入换行符,而无需手动连接。