我做了一个CMS的插件,广告管理的
把广告代码生成JS,再调用
现在出了个问题
广告代码如下,两种
<IFRAME id=iframe name=iframe marginWidth=0 marginHeight=0 src="http://code.sms286.com/AdOpen.asp?Action=popWindow&Adid=31&MyUserID=underlaw" frameBorder=0 width=760 scrolling=no height=100></IFRAME>
<iframe marginwidth='0' marginheight='0' frameborder='0' bordercolor='#000000' scrolling='no' src='http://u.heima8.com/pv/show.htm?sid=&wsid=121549&adid=20068&aiid=20068_180_80&reffer=&url=' width='180' height='80'></iframe>
我的生成代码是这种
Public Function T_H()'生成文件
Dim Aid,filepath,fname,code,fout,AJ,AJ1
AID=CInt(Request("AID"))
filepath="../../js"
fname="js_"&AID&".js"
Set fso = Server.CreateObject("Scripting.FileSystemObject")'生成文件
IF FSO.FolderExists(Server.MapPath(filepath))=False Then
fso.CreateFolder Server.MapPath(filepath)
end if
Set fout = fso.CreateTextFile(server.mappath(filePath& "\" & fname))
Set Rs = DB("Select [AC] From [{pre}ad] Where [AID]="&CInt(Request("AID")),2)
code= "document.write('"&rs("AC")&"');"
AJ="/"+right(filepath,2)+"/"+fname
AJ1="<script type=""text/javascript"" src="""&AJ&"""></script>"
Set Rs = DB("update [{pre}ad] set [AJ]='"&AJ1&"' where [AID]="&CInt(Request("AID")),1)
fout.WriteLine code'生成文件的内容
fout.close
Call Main()
end function
现在问题出在红色这里
如果用document.write('"&rs("AC")&"'); 广告代码中用'这个的话,生成的JS代码有一部分就会变成注释
如果用document.write("""&rs("AC")&"""); 广告代码中用"这个的话,生成的JS代码也有一部分就会变成注释
求高手指点一下