按下按钮后如何显示其他信息?

how to display other information after hitting the button?

我的意图是:首先我想在页面上显示一个按钮,点击按钮后,按钮将被移除并显示一些其他信息。因此我使用了以下代码,但它不起作用,按钮仍然存在并且 "other information" 也没有显示。你们能给我一些建议吗?提前致谢。

这是显示信息的代码:

    <cfif displayMessage eq 1>
        <cfif ifUploaded eq 0>
            <div id='message_box'>
            <cffile action="upload" filefield="PRESENTATION_FILENAME" destination="#ExpandPath("./uploads/")#" nameconflict="overwrite">
            <cfset myfile = #cffile.clientFile#>
            <cfset myurl = mid(cgi.HTTP_REFERER,1,46) & 'uploads/' & #myfile#>
            <div id="btn"><input type="button" name="kalturaBtn" value="upload to kaltura" href="javascript:void();" onclick="popupwindow('https://lampa.human.cornell.edu/csg.kaltura/test.php?kurl=#myurl#&kname=#form.title#&rec=#ddl_choice#','','1200', '700'); return false;"></div>
           </div>
        </cfif>
     </cfif>

    <cfif ifUploaded eq 1>
        <div id='message_box'>
        <div>#messageTitle#</div>
        <div>#messageBody#</div>
    </cfif>

我有以下代码来设置 "displayMessage" 和 "ifUploaded" 在点击 "kalturaBtn" 按钮后显示不同的信息。

<cfif kalturaBtn eq "upload to kaltura"> 
    <cfset ifUploaded = "1">
    <cfset displayMessage = "0">
</cfif>

这里我使用另一个变量"displayMessage"的原因是:所有这些信息只有在我在这个页面上提交表单后才会显示。

HTML代码:

     <cfoutput>
        <cfform name="frmPresentation" id="frmPresentation" action="#CGI.SCRIPT_NAME#" enctype="multipart/form-data">

        <!--- Information Table --->
        <div id='main_body'>
            <div id='inside'>
            <div style='text-align: center; font: bold 18pt Arial, Helvetica, sans-'serif'>CHE Multimedia Management Page</div>
                <br/>
                <cfif displayMessage eq 1 AND len(form.PRESENTATION_FILENAME) gt 0>
                    <cfif ifUploaded eq 0>
                    <div id='message_box'>
                        <cffile action="upload" filefield="PRESENTATION_FILENAME" destination="#ExpandPath("./uploads/")#" nameconflict="overwrite">
                        <cfset myfile = #cffile.clientFile#>
                        <cfset myurl = mid(cgi.HTTP_REFERER,1,46) & 'uploads/' & #myfile#>
                        <div id="btn"><input type="button" name="kalturaBtn" value="upload to kaltura" href="javascript:void();" onclick="popupwindow('https://lampa.human.cornell.edu/csg.kaltura/test.php?kurl=#myurl#&kname=#form.title#&rec=#ddl_choice#','','1200', '700'); return false;"></div>
                        <span onclick='this.parentNode.style.display="none"'></span>
                       </div>
                    </cfif>
                 </cfif>

                    <cfif ifUploaded eq 1>
                        <div id='message_box'>
                        <div>#messageTitle#</div>
                        <div>#messageBody#</div>
                        </div>
                    </cfif>

                   <cfdump var="#kalturaBtn#">

     // a lot of other code omitted here
     <input type='submit' name='submitMedia' value='Submit Changes' class='submit' onclick='return confirmSubmit()'/>
    </form>
    </cfoutput>

好的,也许这会对你有所帮助。

您正在尝试使用普通按钮提交表单。

<input type="button" name="kalturaBtn" value="upload to kaltura" href="javascript:void();" onclick="popupwindow('https://lampa.human.cornell.edu/csg.kaltura/test.php?kurl=#myurl#&kname=#form.title#&rec=#ddl_choice#','','1200', '700'); return false;">`

相反,您需要使用提交按钮。对您造成问题的另一件事是,在 popupwindow() 脚本之后,您有 return false 取消表单提交。像这样改变这两个东西,你的表格应该可以工作。此外,输入元素没有 href 属性。

<input type="submit" name="kalturaBtn" value="upload to kaltura" onclick="popupwindow('https://lampa.human.cornell.edu/csg.kaltura/test.php?kurl=#myurl#&kname=#form.title#&rec=#ddl_choice#','','1200', '700')">`

您的页面没有变化,因为您的表单没有提交。