全20件 (20件中 1-20件目)
1
サーバー側画像はphpで集めます。php<?php// ファイル$files = glob('../jpg/*.jpg');$imax=count($files)-1;$ran=rand(0,$imax);$i=0;foreach ($files as $key => $value) { if($i==$ran){ $file_name=$value; break; } $i++;}$type = 'image/jpeg'; // base64エンコード$img = base64_encode(file_get_contents($file_name));// Ajax応答データ$list = array("img" => $img, "type" => $type);// JSONデータを出力echo json_encode($list);exit();?>実験サイト
2024.02.29
コメント(0)
<!DOCTYPE html><html lang="ja"><head> <meta charset="UTF-8"> <title>Ajax</title> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script> function get_text() { $.ajax({ url: "loop_test.php", async: true, success: function(data) { console.log("======>succes"); document.write(data); document.write("<br>"); } }); } $(document).ready(function() { console.log("======>interval in"); setInterval(get_text, 1000); }); </script></head><body></body></html>実験サイト
2024.02.29
コメント(0)
JavaScriptだけではリストは取れないのでphpからjavascriptへ画像リストを送る。<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body><?php$files = glob('../jpg/*.jpg');echo '<ul>';echo '<img id = "pic" src = "" width = 30% height = 30% >';echo '<script>';echo 'const img = ['; foreach ($files as $key => $value) { echo '"'.$value.'",'; } echo '];'; echo 'let count = -1;'; echo 'jpgChange();'; echo 'function jpgChange()'; echo '{'; echo 'count++;'; echo 'if (count == img.length) count = 0;'; echo 'pic.src = img[count];'; echo 'setTimeout("jpgChange()",1000);'; echo '}'; echo '</script>'; echo '</ul>';?></body></html>実験サイト
2024.02.27
コメント(0)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body><?php$files = glob('../jpg/*.jpg');foreach ($files as $key => $value) { echo '<img src='.$value . ' width=300px>'; echo $value.'<br>';}?></body></html>実験サイト
2024.02.23
コメント(0)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <input type="text" onchange="func(this)"><script>function func(obj){ alert(obj.value);}</script></body></html><!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <button type=”button” onclick="func(this)">ボタン</button> <script>function func(obj){ alert(obj.textContent);}</script></body></html>
2024.02.22
コメント(0)
実験サイト参考参考サイト
2024.02.19
コメント(0)
html<!DOCTYPE html><html><head> <meta charset="utf-8"> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <title>Ajax Sample1</title></head><body> 名前 : <input type="text" id="name" /> <button id="btn">SEND</button> <div><br></div> <div id="res">JSONオブジェクト表示</div> <script> $(function(){ $("#btn").on("click", function(event){ name = $("#name").val(); $.ajax({ type: "POST", url: "send.php", data: { "name" : name }, dataType : "json" }).done(function(rcvdata){ $("#res").text(JSON.stringify(rcvdata)); }).fail(function(XMLHttpRequest, textStatus, error){ alert(error); }); }); }); </script></body></html>php<?php $name = filter_input(INPUT_POST, 'name'); $list = array("name" => $name); header("Content-type: application/json; charset=UTF-8"); echo json_encode($list); exit;
2024.02.18
コメント(0)
【ご奉仕価格】花たちの戦い 宮廷残酷史(25枚セット)第1話~第50話 字幕のみ【全巻セット 洋画 中古 DVD】送料無料 ケース無:: レンタル落ち女性たちの熱演に、のめり込んでしまう。
2024.02.17
コメント(0)
$.ajax({ type: 'POST', url: 'send.php', dataType: 'text', data: { 'input_name': $input_name.val(), 'input_mail': $input_mail.val(), 'input_title': $input_title.val(), 'input_content': $input_content.val() }, success: function(data) { alert(data); }, error: function(error) { alert('エラーが起きまた。'); } });functionの引数dataは受信データです! success: function(receive_data) { alert(receive_data);と書いたほうがいいでしょう。
2024.02.17
コメント(0)
送信0:上のテキストから下へ送信1:下のテキストから上へ<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>input to out</title></head><body> <input id="text0" type="text" size="80" value="あいうえお" /> <input type="button" value="送信0" onclick="inData0()" /><br> <input id="text1" type="text" size="80" value="abcdefgh" /> <input type="button" value="送信1" onclick="inData1()" /> <script> function inData0() { text = document.getElementById("text0"); text1.value=text.value; } function inData1() { text = document.getElementById("text1"); text0.value=text.value; }</script></body></html>実験サイト
2024.02.15
コメント(0)
javascriptのみで実行<!DOCTYPE html><html lang="ja"><head><meta charset="UTF-8"><title>input to out</title></head><body><input id="text0" type="text" size="50" value="" /> <input type="button" value="送信" onclick="inData0()" /><br> <div id="outdata0"></div> <input id="text1" type="text" size="50" value="" /> <input type="button" value="送信" onclick="inData1()" /> <div id="outdata1"></div><script> function inData0() { text = document.getElementById("text0"); indataText = btoa(unescape(encodeURIComponent(text.value))); outdata0.innerText = indataText; } function inData1() { text = document.getElementById("text1"); indataText = decodeURIComponent(escape(atob(text.value))); outdata1.innerText = indataText; }</script></body></html>実験サイト
2024.02.15
コメント(0)
php+javascript実験サイト
2024.02.14
コメント(0)
javascript + php実験サイト
2024.02.14
コメント(0)
js<html><head><meta charset="utf-8"><title>test canvas</title><script src="https://code.jquery.com/jquery-3.4.1.min.js"></script><script type="text/javascript">//ページロード時イベント$(function() { $("#button").click(function(event){ $.ajax({ type: "POST", url: "base64.php", data: { key: "44OA44Kk44Ko44OD44OI44GM5Yq55p6c44KS6KGo44GX44G+44GZ" }, dataType : "text" }).done(function(data){ $("#result").text(data); }).fail(function(XMLHttpRequest, textStatus, errorThrown){ alert(errorThrown); });});});</script></head><body> <h2>base64 test</h2> <button id="button">実行</button><br> <input type="hidden" id="test1" name="text1" size="5" value=""><br> <div id="result"></div> <br /></body></html>php<?php$id1 = $_POST['key'];$ide=base64_decode($id1); echo ($ide);?>結果実行ダイエットが効果を表します
2024.02.14
コメント(0)
実験サイト
2024.02.06
コメント(0)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <button type=”button” id="sample0" onclick=buttonText0()>クリック0</button> <button type=”button” id="sample1" onclick=buttonText1()>クリック1</button> <p id="pid0"> </p> <p id="pid1"> </p> <script> function buttonText0 () { var pppp = document.getElementById('pid0'); pppp.innerHTML="<img src=\"http://snc29654.php.xdomain.jp/jpg/33.jpg\" width=\"300px\">" ; } function buttonText1 () { var pppp = document.getElementById('pid1'); pppp.innerHTML="<img src=\"http://snc29654.php.xdomain.jp/jpg/1.jpg\" width=\"300px\">" ; } </script></body></html>innerhtmlを使わなくても、以下で同じ結果となる<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <button type=”button” id="sample0" onclick=buttonText0()>クリック0</button> <button type=”button” id="sample1" onclick=buttonText1()>クリック1</button><br> <img src="" width="300px" id="pid0"><br> <img src="" width="300px" id="pid1"> <script> function buttonText0 () { var pppp = document.getElementById('pid0'); pppp.src="http://snc29654.php.xdomain.jp/jpg/33.jpg"; } function buttonText1 () { var pppp = document.getElementById('pid1'); pppp.src="http://snc29654.php.xdomain.jp/jpg/1.jpg"; } </script></body></html>
2024.02.04
コメント(0)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <button type=”button” id="sample0" onclick=buttonText0()>クリック0</button> <button type=”button” id="sample1" onclick=buttonText1()>クリック1</button> <p id="pid0"> </p> <p id="pid1"> </p> <script> function buttonText0 () { var pppp = document.getElementById('pid0'); pppp.innerHTML="click後のテキスト0"; } function buttonText1 () { var pppp = document.getElementById('pid1'); pppp.innerHTML="click後のテキスト1"; } </script></body></html>
2024.02.03
コメント(0)
だから俺はアンチと結婚した DVD-BOX1 [ チェ・テジュン ]
2024.02.01
コメント(0)
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title></head><body> <input type="text" id="form" onchange="createText()"> <table border="2" id="sample">入力</table> <script> function createText () { var form = document.getElementById("form"); var area = document.createElement('tr'); var area1 = document.createElement('td'); area.innerHTML = form.value; var parent = document.getElementById('sample'); parent.appendChild(area); parent.appendChild(area1); form.value = ''; } </script></body></html>
2024.02.01
コメント(0)
2024.02.01
コメント(0)
全20件 (20件中 1-20件目)
1