使用 .document.getElementById 显示我网站上其他页面的元素
我已经搜索这个主题好几天了。并且找不到可行或结论性的答案。
我想要做的就是在我网站(不是我的博客)首页的 div 容器中简单地显示最新博客条目(来自我自己网站上的博客页面)的(样式化)摘要。理想情况下,该镜像博客条目的所有活动链接都会指向我的博客页面的相应部分。然而,这不是必须的,只要整个条目可以链接到博客页面即可。
博客摘要页面上的每个博客条目摘要都有一个唯一的 ID,按数字排序(例如 unique-ID-51
(最新)unique-ID-50
(之前的 ID) ) ETC。) 我正在考虑使用 document.getElementById JS 命令来执行此操作。
我必须将 JS 函数指向一个相对位置 (../blog_folder/blog_summary.html
),可能使用 .window.location.assign
命令,而不是抓取最新元素的(样式化)内容并将其显示在我的首页上。
但我不知道该代码在现实中会是什么样子。你能指出我正确的方向吗?
谢谢 !!!!!!!
M。
I have been searching about this subject now for quite a few days. And could not find a working or conclusive answer.
What I want to do, is to simply display the (styled) summary of the latest blog entry (from the blog page on my own site) in a div container on the front page of my site (which is not my blog). All active links of that mirrored blog entry ideally lead to the appropriate section of my blog page. That is however not a must, as long as the entire entry can link to the blog page.
Each blog entry summary on the blog summary page has a unique ID, sorted by numbers (e.g. unique-ID-51
(latest) unique-ID-50
(the one before) etc.)
I was thinking of doing so with the document.getElementById
JS command.
I would have to point the JS function to a relative location (../blog_folder/blog_summary.html
) with maybe the .window.location.assign
command, than grab the (styled) contents of the latest element and display that on my front page.
But I have no idea how that code would look in reality. Can you point me in the right direction?
Thank you !!!!!!!
M.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将 jQuery 添加到页面并使用简单的构造:
示例代码块:
以及
标记内某处的字符串:
具有自动启动功能的示例代码块:
You could add jQuery to your page and use a simple construction:
An example chunk of code:
And that string somewhere inside the
<head>
tag:An example chunk of code with an autostart feature:
我假设您使用的是隐藏的 iframe?
例如,这将改变样式的高度..样式中还有其他内容
但是您必须在 iframe 中放置一个唯一的 ID
尝试并使用 IE 或 Chrome 中的内置调试器来查找您想要的内容...
您可以看看这个,也许有更多的信息(它是跨域的),但可能有一些东西可以帮助你。您甚至可以考虑使用 jquery 来访问该数据。
另一个跨域 iframe 调整大小的问答
I assume you are using a hidden iframe?
This for example will thet the height of the style.. there are other things in the style
But you have to put an unique ID in the iframe
Try and use the built in debuggers in IE or Chrome to find what you want...
You can take a look at this for maybe some more info(its for cross domain) but there could be something taht helps you. You might even consider using jquery to access that data.
Yet Another cross-domain iframe resize Q&A