javascript

テーブルにマウスオーバーして図をだす

テーブルにマウスオーバーして図をだす 上の階層の行の行番号を検索 その行の下にぶち抜きの行をつくる ぶちぬくに図を挿入 マウスアウトしたらそれらの行を消す.ソースへの要求 <div id="cor_table"></div> の間にtableをいれる. tableの各行には<a class="fig" href="xxx.png"> みたいな感じにリンクとクラス付の</a>…

JqplotでCanvasの下に重なり触れなくなってしまった要素を触れるようにする。

グラフ描画後以下のスクリプトを実行ポイント (1)再描画ごとに新しく書き直すためpostDrawHooksを利用 (2)点(div class=jqplot-point-label)がソース上canvasの上側にあるのが問題なので、 下に移動する. (3)クラス名でグラフを管理している場合…

親要素のclass属性を取得

親要素のIDを取得 parentで親の要素全体を取得してattr("class")でclass属性を取得する. $(this).parent だけだとhtmlがかえってきてだめなのがポイント. $('div[class2^="pp"]').on('click','canvas', function(){ alert($(this).parent().attr("class")…

JSONで値渡し(deep copy)

JavaScriptのオブジェクトを扱うとき、=は値渡しではない - woshidan's blog http://woshidan.hatenablog.com/entry/2014/09/06/002003 … plot3_prop=JSON.parse(JSON.stringify(plot1_prop));

.on の使い方(新しい要素にイベントを関連付ける)

.on の使い方(新しい要素にイベントを関連付ける) https://app.codegrid.net/entry/practical-jquery-1 を参照.JQUERYでは存在しない要素にはイベントをつけられない. そこで.onを使ってあとからつけた要素にもイベントを発生させられるようにする. 「…

マウスオーバーしたら図をだす

ParentsUntil文で行にいき、その後ろにdivダグを挿入し, divダグのに中身を図をいれる.表にマウスオーバーしたらリンク先の図をだ $(".fig").hover( function(){ link1=$(this).attr("href"); $(this).parentsUntil("tr").after('<div id="tmp1"></div>'); $("#tmp1").append('<img src="'+link1+'" width="100%" height="100%" />'…

flexgridでJSONを読んで動的なかっこいい動的な表を作る

flexgridでJSONを読んで動的なかっこいい動的な表を作る まず基本バージョン、とりあえずだせるように (0)JSONを作る JSONは""でじゃないとだめ。 JSONの説明: http://hakuhin.jp/js/json.html grid2.txt を書きをCGIフォルダに保存 を参考に.http://jquery…

データベースから値を読んでそれに応じてボタンを押せなくなる.

データベースから値を読んでそれに応じてボタンを押せなくなる. <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>tryjquery_hide_p test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){ var up_date_…</meta></head></html>

jqueryでopenコマンドの非同期処理を扱うまとめ

(1) 関数にする.function f(){} (2)関数内にDeferredクラスを導入,function f(){d=$.Deferred} (3)処理が済んだらd.resolve()をよぶ function f(){d=$.Deferred;処理;d.resolve;} (4)d.promise()をリターン function f(){d=$.Deferred;処理;d.r…

javascriptでマウスオーバーしたら他のページをツールチップ風に表示

javascriptでマウスオーバーしたら他のページをツールチップ風に表示 メインページ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"> <script> $(document).ready(function(){ $("p.test2").hover( function(){ //alert("test"); $(this).append('<div id="tmp"><iframe src="in1.html"></iframe></div>

jqplotでマウスイベント。データ点に触れたらデータラベルのアラート (ズーム後もでるようにする)

postDrawHooksにプロット後の事後処理を書いて、 マウスオーバーイベントをリロードする. http://stackoverflow.com/questions/10426192/jqplot-how-to-change-opacity-or-z-index-of-canvasoverlay <html> <head> <script src="js/jquery-1.11.1.js"></script> </head></html>

jqplotでつかったグラフの横にマウスオーバーしたら画像を表示

class1 class2 class3 を使って無理やりに. 親要素のclass3を取得して,そこに書き出す. <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>tryjquery_hide_p test</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> </meta></head></html>

jqueryで表の列を移動させる2

8列目から3列目へ移動 >|html| $("input:button#test3a").click(function(){ alert("This is button\n"); str=$("#myTable tr th:nth-of-type(9):eq("+0+")").html() $("#myTable tr th:nth-of-type(4):eq("+0+")").after(''+str+''); $("#myTable tr th:nth…

jqueryで表の列を移動させる

8列目から3列目へ移動 >|html| $("input:button#test3a").click(function(){ alert("This is button\n"); str=$("#myTable tr th:nth-of-type(9):eq("+0+")").html() $("#myTable tr th:nth-of-type(4):eq("+0+")").after(''+str+''); $("#myTable tr th:nth…

jqueryで表の列を移動させる

8列目から3列目へ移動 >|html| $("input:button#test3a").click(function(){ alert("This is button\n"); str=$("#myTable tr th:nth-of-type(9):eq("+0+")").html() $("#myTable tr th:nth-of-type(4):eq("+0+")").after(''+str+''); $("#myTable tr th:nth…

jqplotで日付横軸に縦線(基本はUNIXTIME入力)

jqplotで日付横軸に縦線(基本はUNIXTIME入力). https://groups.google.com/forum/#!topic/jqplot-users/xfBTrKYBDS8 を参考に.

時系列の複数のグラフを同時に制御して同じ範囲をズームできるようにする。

http://alphasis.info/2012/05/jquery-plugin-jqplot-cursor/を参考に とりあえずCSVファイルを入力に hisana_freq.csv id,date,counts 1,2007-1-1,32 2,2007-1-2,42 3,2007-1-2,23 出来上がりはこんな感じ スクリプト <html> <head> <script language="javascript" type="text/javascript" src="../js/jquery-1.11.1.js"></script> </head></html>

表に小さいグラフを埋め込む

表にグラフを取り入れる.http://omnipotent.net/jquery.sparkline/#s-docs のサンプルを参考に、基本を学ぶ. ./jsに jquery.sparkline.js とjquery-2.1.1.jsを保存したあと <head> <script type="text/javascript" src="jquery-2.1.1.js"></script> </head>

jqueryでCSVを読み取り表をつくる

data.csv Taro,Jiro,Saburo Taro1,Jiro1,Saburo1 Taro2,Jiro2,Saburo2 失敗の記録 jquery.csv.jsを使う→うまくいかない。 で指定しないとだめ。だと変なエラーがでる。 とりあえず、固定タグまではhtmlに書く。中身のうごくとこだけjavascriptを使う感じ こ…