• 博客园Logo
  • 首页
  • 新闻
  • 博问
  • 助园
  • 闪存
  • 班级
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 简洁模式 ... 退出登录
    注册 登录
Freecoder Team
★colorful life in free coding★
博客园    首页    新随笔    联系   管理    订阅  订阅

iframe应用-后台生成iframe标记

iframe应用,后台生成iframe标志
      刚刚完成的一个应用用到了iframe,稍做记录如下以备忘。
      需求(程序员角度):
      1,商品查询页面(AppItemSearch.aspx)发送了这样一个请求:AppItemIntroduction.aspx?ItemId=xxx
      2,商品介绍页面(AppItemIntroduction.aspx)根据ItemId "xxx"从数据库中ItemIntroductionLinks表中查询对应xxx的商品介绍文档的链接(ItemIntroLink字段),并将此连接的内容显示到AppItemIntroduction.aspx页面上。
      注:AppItemIntroduction.aspx根据ItemId读取的不是商品介绍的内容而仅仅是一个链接名称;商品介绍文档放在与此应用不同域的服务器上;商品介绍文档是html或word文档。
      假设:AppItemIntroduction.aspx已经根据ItemId在ItemIntroductionLinks中找到了对应的文档url,存于ls_RedURL变量里。
      思路:在AppItemIntroduction.aspx里生成一个iframe标志,变量ls_RedURL的值动态赋给iframe的src属性。
      简单源码(vb.net)如下:
        jsText = "<script>var child=document.getElementById('ifr1');if(child!=null){document.body.removeChild(child);}</script>"
        jsText 
+= "<iframe id='ifr1' width=90% height=90% src='" + ls_RedURL + "'></iframe>"
        jsText 
+= "<div align='center'><a href='#' onclick='javascript:window.close()'>关-闭</a></div>"
        
Try
            Response.Write(jsText)
        
Catch ex As Exception
            ls_ErrText 
= ex.Message + "读取产品介绍文档出错!"
            AppGoToErrorPage.f_Redirect(
Me, ll_ErrCode, ls_ErrText, "C")
        
End Try
posted @ 2006-10-27 13:14  freecoder Team  阅读(704)  评论(0)  编辑  收藏  举报
刷新评论刷新页面返回顶部
Copyright © 2023 freecoder Team
Powered by .NET 7.0 on Kubernetes