我试图了解其他开发人员在尝试使用javascript和coldfusion将变量从一个iframe传递到另一个iframe时正在做什么。
发生了什么:而不是在底部框架中显示图像是强制下载的。并且if语句的第一部分显示为好像CurrentImage是=""。
会发生什么:在网址中找到的CurrentImage的值应传递到底部的iFrame,该变量将是一个图像名称,它会在底部窗口中显示该图像。
HTML主页
<FRAMESET ROWS="120,407*" FRAMEBORDER="YES" BORDER="1" FRAMESPACING="1" COLS="*">
<FRAME NAME="selectFrame" SCROLLING="NO" SRC="selectframe.cfm">
<FRAME ONFOCUS="selectFrame.reassignFocus();" NAME="imageFrame" SRC="imageframe.cfm">
</FRAMESET>
在selectframe.cfm中找到:
<HTML>
<HEAD>
<TITLE>Link Fax Image</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
<CFIF SubAction IS "ImageLinked" OR SubAction IS "" OR SubAction IS "ErrNoImages" OR SubAction IS "ErrImageDeleted" OR SubAction IS "NoOverwrite">
parent.imageFrame.location.href="imageframe.cfm?CurrentImage=<CFOUTPUT>#CurrentImage#</CFOUTPUT>";
</CFIF>
//-->
</SCRIPT>
imageframe.cfm代码:
<CFPARAM NAME="CurrentImage" DEFAULT="">
<!--- If CurrentImage is blank, display the following message --->
<CFIF #CurrentImage# IS "">
<HTML>
<HEAD>
<TITLE>No images to link at this time.</TITLE>
</HEAD>
<BODY>
<CENTER><H2>No images to link at this time.</H2></CENTER>
<CENTER><A HREF="/admin/imagelink/" TARGET="_parent">Refresh Page</A></CENTER>
</HTML>
<CFELSE>
<h3>Yes there is a Current Image</h3>
<CFIF #CurrentImage# NEQ "NULL">
<CFIF FileExists("#FaxImageTempDir##CurrentImage#")>
<CFIF CurrentImage CONTAINS ".PDF">
<CFCONTENT TYPE="application/pdf" FILE="#FaxImageTempDir##CurrentImage#" DELETEFILE="No">
<CFELSE>
<CFCONTENT TYPE="image/tiff" FILE="#FaxImageTempDir##CurrentImage#" DELETEFILE="No">
</CFIF>
<CFELSE>
File not found, please contact support.
</CFIF>
</CFIF>
</CFIF>
答案 0 :(得分:0)
我遇到了同样的问题,却忘了这么简单。
在CFOUTPUT中包装框架集
因此,如果您转到页面:page.cfm?var = ABC123
<cfoutput>
<FRAMESET ROWS="120,407*" FRAMEBORDER="YES" BORDER="1" FRAMESPACING="1" COLS="*">
<FRAME NAME="selectFrame" SCROLLING="NO" SRC="selectframe.cfm?var=#var#">
<FRAME ONFOCUS="selectFrame.reassignFocus();" NAME="imageFrame" SRC="imageframe.cfm">
</FRAMESET>
</cfoutput>
ABC123将传递到框架集中。
下面是通过RaspberryPi设置电视留言板的示例。 我可以使用相同的代码创建多个留言板。
<HTML>
<cfoutput>
<frameset rows="0%,15%,69%,16%" framespacing="0">
<frame src="force.cfm?said=#said#" name="force" frameborder="0" hspace="0" vspace="0" marginheight="0" scrolling="no">
<frame src="pit.cfm?said=#said#" name="pit" frameborder="0" hspace="0" vspace="0" marginheight="0" scrolling="no">
<frameset cols="65%,35%" hspace="0" vspace="0" marginheight="0" framespacing="0">
<FRAME src="_schedule.cfm?said=#said#" name="sch" hspace="0" vspace="0" marginheight="0" frameborder="0" scrolling="no">
<FRAME src="_advert.cfm?said=#said#" name="banner" hspace="0" vspace="0" marginheight="0" frameborder="0" scrolling="no">
</frameset>
<frame src="pib.cfm?said=#said#" hspace="0" vspace="0" marginheight="0" frameborder="0" scrolling="no" name="bot">
</frameset>
</cfoutput>
</HTML>