开发者

blogger Coding help- getting error

hello there i am trying to make a blogger gadget... it's my first try to make a gadget. while making i am facing a problem for post id. so can any one tell me how to write the post id automatically for each posts. look below i have given that code , and this section ==> "HERE_SHOULD_BE_TH开发者_开发技巧E_POST_ID" should have each post id. [These code will be placed after "<data:post.body/>" in blogger template]

<input type="hidden" name="blogID" value="xxxxI_KNOW_IT'S_BLOG_IDxxxxxx" id="blogID"> <input type="hidden" name="postID" value="HERE_SHOULD_BE_THE_POST_ID" id="postID">

should i use a javascript like this:

<script type='text/javascript'>"<data:post.id/>"</script>

if so then how? or any other way?


I'm not that familiar with gadget writing, but here's some ideas that might help.

First, I'm assuming you're able to call something to get the post id in JavaScript. If so, then you might try either writing the HTML dynamically from JavaScript so that you can write in the post id. The mechanics of this are basically to do a callback when the page loads and write to the page's HTML.

Another option would be to use DOM manipulation to edit the input element later. You should be able to call getElementByID using postID and then you could add or modify the value attribute with the post id value. This will require a little more work than the first option, but is in some ways cleaner because you only have to dynamically modify the HTML in one place, rather than generating it all on the fly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜