I need to get time in miliseconds and attach that on like get parameter on 'view.php'. How to set href to that value (href='view.php?time=x
) if I have <a id='view.php'>
using JQuery ?<a id='view.php'>
-1
A
答えて
0
これはUNIXTIMEのUTC値にID link-id
とのリンクのhrefを設定します:
$(document).ready(function() { $("#link-id").attr("href", "view.php?time=" + ((new Date()).getTime() + (new Date()).getTimezoneOffset() * 60000))});
編集:固定コードと言葉遣い。
5
$("#yourElementId").attr("href", "view.php?time=" + (new Date()).getTime())
0
Given:
<div id="target">
<a id="view.php">link</a>
<a id="anotherview.php">link</a>
</div>
You can:
var time = new Date().getTime();
$("#target a").each(function() {
this.href = this.id + "?time=" + time;
});
Result:
<div id="target">
<a id="view.php" href="view.php?time=1308729633979">link</a>
<a id="anotherview.php" href="anotherview.php?time=1308729633979">link</a>
</div>
See demoがある場合、hrefを何らかの値に設定するにはどうすればいいですか? (。とIDなしのリンクは変更されませんanother demo)
関連する問題
- 1. <a href="#id"> to a javascript
- 2. <a href> link with id
- 3. HTML <a href> to ID link not working
- 4. jQueryのif文:セクションIDは<a>
- 5. エラー「リポジトリIDに複数のID-文」/ <a href="http://ontotext.com/products/graphdb/" rel="nofollow">GraphDB</a>オン
- 6. どのようにエコーを与える '<a href="view2.php?id=' . $id . '">' . $name . '</a>'; HTML
- 7. どうすればpreg_replace @<a> @</a>〜<a> @</a>?
- 8. は、複数のエクスポート<a href="https://drive.google.com/open?id=0BzAJnxmL2vZodmJSRU1XWnNVSHM" rel="nofollow">,link to data in csv file</a><br>
- 9. <a href
- 10. デシリアライズオプション<'a>
- 11. jQuery - target.href <a href="#"><img></a>
- 12. がThingworx:ここ<a href="http://support.ptc.com/cs/help/thingworx_hc/thingworx_6.0_hc/index.jspx?id=thingworx10&action=show" rel="nofollow">tutorial</a>で
- 13. Html.BeginForm()でIDを渡す方法は? <a href="http://en.wikipedia.org/wiki/ASP.NET_MVC_Framework" rel="noreferrer">ASP.NET MVC</a>で
- 14. <a>のIDまたはVALUEまたはNAMEをJS
- 15. IDトラフ<a>タグをブートストラップモーダルに渡すPHP
- 16. <a>タグにid値を挿入しますか?
- 17. なぜですか<a id="test"/> breaks out of the DOM chain?
- 18. A [n-1]> = A [n] <= A [n + 1]
- 19. カスタマイズで画像をアップロード<a></a>(html)
- 20. タグ内<a href="....."></a></td> DOUBLE_WHITESPCE in query href
- 21. <a href="" with Class
- 22. <a>タグ
- 23. は<a>
- 24. <a name>
- 25. <a>タグ
- 26. <a>タグ
- 27. Umbraco - <a>タグ
- 28. JQueryプル<a href
- 29. セレンのPython:私はセレン/パイソンを使用しています</p> <pre><code><a id="AAA" class="BBB" data-json="{"link":"thelink","field1":1,"field2":5}"> Load more </a> </code></pre> <p>:特定のウェブページ<a>タグ
- 30. ウィケット: - 私は<a href="https://cwiki.apache.org/confluence/display/WICKET/A+Simple+DataView+Example" rel="nofollow noreferrer">https://cwiki.apache.org/confluence/display/WICKET/A+Simple+DataView+Example</a></p> <p>org.apache.wicket.markup.MarkupNotFoundException
これを使用すると、サイトを閲覧しているユーザーの現地時間がわかります。 – Till
ありがとうTillさんのコメント。また、コメントを編集してくれたNanneに感謝します。私は、StackOverflowの新しい人です。フォーマットなしでは申し訳ありません。 – YODA