首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

如何在父窗口判断子窗口有没有值?好兄弟哪位高手解决了小弟我给100分,死了

2012-02-19 
怎么在父窗口判断子窗口有没有值?好兄弟谁解决了我给100分,在线等,急死了operation.asp怎么样在operation.

怎么在父窗口判断子窗口有没有值?好兄弟谁解决了我给100分,在线等,急死了
operation.asp    
   
    怎么样在operation.asp   中写脚本判断   IFRAME中upfile6.asp里的影象上传东西了?及在线等,好兄弟谁解决了我给100分,在线等,急死了!!!
 
  <script   language= "JavaScript "   type= "text/JavaScript ">
       
  function   Check()
{
if(blform.Casename.value== " ")
{
alert( "请填写手术名称! ");
blform.Casename.focus();
return   false;
}
if(document.frames( "mqs6 ").Accessories6.value== " ")//这里不行啊!!!!
{
alert( "请上传影象! ");
return   false;
}
//-->
</script>

                            <form   action= "save_bl_action.asp "   method= "post "     name= "blform "   id= "blform ">
        <tr   bgcolor= "#ffffff ">  
                                    <td   align= "right "> <font   color= "#FF0000 "> * </font> 病例名称: </td>
                                    <td   colspan= "5 "   align= "left "   bgcolor= "#ffffff ">   <input   name= "Casename "   type= "text "   id= "Casename "   size= "55 "   /> </td>
                                </tr>
                                <tr   bgcolor= "#ffffff ">  
                                    <td   align= "right "> 手术影像: </td>
                                    <td   colspan= "5 "   align= "left "> <IFRAME   name=mqs6   marginWidth=0   marginHeight=0   src=upfile6.asp?filename= <%=filename%>   frameBorder=0   width=400   scrolling=no   height=100> </IFRAME> </td>
                                </tr>
                        </form>

upfile6.asp

<!--#include   FILE= "inc_upfile.asp "-->
<%on   error   resume   next%>
<meta   http-equiv= "Content-Type "   content= "text/html;charset=gb2312 ">
<link   href= "/img/index.css "   rel= "stylesheet "   type= "text/css ">
<script   language= "JavaScript "   src= "../inc/header.js "> </script>
<%
dim   act
act   =   request( "act ")

sub   err_msg(message)%>
<script> alert( ' <%=message%> ');history.go(-1); </script>
<script> window.close(); </script>


<%response.End
end   sub

select   case   act
case   "up " '上传文件

if   session( "Accessories6List6 ")   =   Empty   then
dim   Accessories6List6
end   if

dim   fso,strDir,ftime,FileUp,FullPath,types

Set   fso   =   Server.CreateObject( "Scripting.FileSystemObject ")
strDir= "./upfile/translation/ "& " "
if   not   fso.folderexists(Server.MapPath(strDir))   then   fso.CreateFolder(Server.MapPath(strDir))

randomize
dim   s
s   =   cstr(Int(Rnd()*(99999-10100+1))+10100)
ftime= " "&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)   &   s   & " "

set   fso   =   nothing
FileName=now() '开始取文件名
FileName=replace(FileName, "- ", " ")
FileName=replace(FileName, ": ", " ")
FileName=replace(FileName, "   ", " ")
FileName=FileName+rndNum(4)
On   Error   Resume   Next
Set   FileUP   =   Server.CreateObject( "Persits.Upload ")
FileUP.SetMaxSize   1000000,   True
FileUP.Save
'if   FileUP.TotalBytes   =   0   then   err_msg( "当前文件为空文件。 ")
    Set   File   =   FileUP.Files( "in_v ")

        ext=LCase(right(file.ext,len(file.ext)-1))
        if   ext= " "   then
                err_msg( "当前文件为空文件。 ")
        end   if

        if   file.ext <> ".wmv "   and   file.ext <> ".mpg "   and   file.ext <> ".wav "   and   file.ext <> ".mp3 "   and   file.ext <> ".wma "   and   file.ext <> ".mpeg "   then
                err_msg( "只允许上传wmv|mpg|wav|mp3|wma类型文件。 ")

end   if

FullPath= "./upfile/translation/ "
'types=mid(FullPath,InStrRev(FullPath,   ". ")+1)
'types=LCase(types)

  filename=filename+ ". "+ext
'File.SaveAs   Server.mappath( " "&filename& " ")

File.SaveAs   "K:\case\upfile\translation\ "   &   Filename

if   session( "Accessories6List6 ")   <>   " "   then
session( "Accessories6List6 ")   =   session( "Accessories6List6 ")   &   "| "
end   if
session( "Accessories6List6 ")   =   session( "Accessories6List6 ")   &filename

case   "delete " '删除文件
dim   sfile,sfilename
sfile   =   request( "file ")
sfilename   =   server.mappath( "../upfile/translation ")   &   "\ "   &   sfile
set   fso   =   Server.CreateObject( "Scripting.FileSystemObject ")
if   fso.FileExists(sfilename)   then
fso.DeleteFile   sfilename
end   if
File.DeleteFile   "K:\case\upfile\translation "&FileName
set   fso   =   nothing


session( "Accessories6List6 ")   =   replace(session( "Accessories6List6 "),sfile, " ")
session( "Accessories6List6 ")   =   replace(session( "Accessories6List6 "), "|| ", "| ")
'response.Write(session( "Accessories6List6 "))
'response.End()
end   select%>
<body   topmargin=0     rightmargin=0     leftmargin=0>
<form   enctype= "multipart/form-data "   method= "post "   action= "upfile6.asp?act=up "   name= "form_up "   onSubmit= "return   checkform(); ">  
<input   name= "cmd "   type= "hidden "   value= "delete ">
<script   language= "JavaScript ">
<!--//
function   checkform()
{
if   (ignoreSpaces(document.form_up.file.value)== " ")
{
alert( "没有选择欲上传的文件。 ");
document.form_up.file.focus();
return   false;
}
}

function   DeleteFile()
{
if   (document.form_up.Accessories6.options.length   >   0)
if   (confirm( "确定删除选定的附件“ "   +   document.form_up.Accessories6.value   +   "”? "))
{
location.href= 'upfile6.asp?act=delete&file= '   +   document.form_up.Accessories6.value;
}
}
//-->
</script>
<table   cellpadding=0   cellspacing=0   width=100%   class=a4>
    <tr>  
        <td   height= "30 ">
<input   name=in_v   type=file   class= "editbox "   id= "in_v "   style= "width:330; "   size=60>  
            <input   type= "submit "   value= "上传 "   name=Submit   class= "button ">
        </td>
    </tr>
    <tr>
        <td   height= "30 ">
<select   name= "Accessories6 "   id= "Accessories6 "   class= "editbox "   style= "width:150; ">
                <%if   act   =   "up "   or   act   =   "delete "   or   act   =   "modify "   then
dim   i
Accessories6List6   =   split(session( "Accessories6List6 "), "| ")
for   i   =   0   to   ubound(Accessories6List6)
if   trim(Accessories6List6(i))   <>   " "   then%>
<option   value= " <%=Accessories6List6(i)%> "> <%=Accessories6List6(i)%> </option>
<%end   if
next
else
session.Contents.Remove( "Accessories6List6 ")
end   if%>
            </select>
            &nbsp;   <input   name= "Delete "   type= "button "   class= "button "   id= "Delete "   value= "删除 "   onClick= "javascript:DeleteFile(); ">
        </td>
    </tr>
</table>
</form>

------解决方案--------------------


引用iframe中嵌入页面的相关属性,使用window.frames[ 'iframeid ']或
document.getElementById( "iframeid ").contentWindow

引用iframe的相关属性,使用document.getElementById( 'iframeid ')

if(document.frames( "mqs6 ").Accessories6.value== " ")//这里不行啊!!!!
这句是在当前页面获取Accessories6,而不是在iframe中的页面里获取,应该改为:
if(window.frames[ "mqs6 "].form名.Accessories6.value== " ")

if(document.getElementById( "mqs6 ").contentWindow.form名.Accessories6.value== " ")


[解决办法]
写法是没错 只是Accessories6 是form_up内的表单元素 需要先指明form_up

document.frames[ "mqs6 "].document.getElementById( "Accessories6 ").value;//一般是这么取值
按照你的写法可以这样
document.frames[ "mqs6 "].form_up.Accessories6.value;

热点排行