获取页面iframe中xml节点的文本内容

2010年07月29日  |  23:25分类:PHP技术,Zen-Cart二次开发  |  标签:  |  430 views

今天需要从页面嵌入的隐藏的iframe中读取一个节点的内容,找了很久才在网上找到一个函数:

 function fnGetCode(iframeId){                               
                var obj=null;
                if (document.all){//IE
                    obj = document.frames[iframeId].document;                
                    return($(obj).find(“.tx”).text());
                }else{//Firefox
                    obj = document.getElementById(iframeId).contentDocument;                                               
                    return($(obj).find(“code”).text());                                     
                }                               
            }

该函数可以根据iframeId来获取页面中嵌入的iframe中的xml的文本节点的内容。

喜欢本文,那就收藏到: Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

发表您的评论

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word