js语法问题--送分

来源:百度知道 编辑:UC知道 时间:2024/06/20 07:53:02
response.Write("<script language='javascript'>if(parent.window.document.form.products_pic.value=""){ parent.window.document.form.products_pic.value='"&picsrc&"'}else{parent.window.document.form.products_pdf.value='"&picsrc&"'</script>")

请问这个js代码有没有问题,我用js加ASP写的代码,进行页面数据传递到一个表单的文本域上!!

response.write("<script language='javascript'>"& vbcrlf)
response.write("if(parent.document.form.products_pic.value==''){ "& vbcrlf)
response.write("parent.document.form.products_pic.value='"&picsrc&"';"&vbcrlf)
response.write("}else{"&vbcrlf)
response.write("parent.document.form.products_pdf.value='"&picsrc&"';}"&vbcrlf)
response.write("</script>")

将:
if(parent.window.document.form.products_pic.value="")
改为:
if(parent.window.document.form.products_pic.value='')

要不然会提示语句未结束。

parent.window.document.form.products_pic.value=""句有错误,在JS中做比较应该用==和!=,用=是赋值。