IG再網頁執行時透過js取得到JSON格式的資料
程式碼如下:
services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
namespace WebOnlineEditorApplication
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
services.AddAntiforgery(o => o.HeaderName = "XSRF-TOKEN");
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseMvc();
}
}
}
<!DOCTYPE html> <html> <head> <meta charset="utf8"> <title>hi</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script type="text/javascript"> function myClick () { var myText = $('#demo'); //更改id myText[0].id = "id"; //更改name myText[0].name = "name"; } </script> </head> <body> <input type="text" id="demo" name="demo"> <button onclick="myClick();">Change</button> </body> </html>
http://gdata.youtube.com/feeds/api/videos/Videoid?v=2&alt=json
<!DOCTYPE html> <html> <head> <meta charset="utf8"> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script> <script type="text/javascript"> $(function (){ $("input[type=radio]").each(function(){ console.debug($(this).val()); }); $("input[type=text]").each(function(){ $(this).val("C.Y. Fang") ; }); }); function MyClean(){ $("input[type=radio]:checked").each(function(){ $(this).prop("checked", false) }); $("input[type=text]").each(function(){ $(this).val('') ; }); } </script> </head> <body> <div> <input type="radio" value="男">男 <input type="radio" value="女">女 <input type="text"> </div> <button onclick="MyClean()">Clean</button> </body> </html>
<html> <head> <meta charset="utf8"> <title>Demo</title> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script type="text/javascript"> $(function () { $("#test2").position({ left: 0, top:0 }); }); function Hide () { $("#test2").hide(); } </script> <style type="text/css"> #test2{ position: absolute; z-index: 1; left: 120px; top: 100px; } #test2 img{ margin: 0 auto; width: 640px; height: 480px; } </style> </head> <body> <div id="test1"> testdsadasdsad<br> eqwewqe<br> qewqeqwe<br> wqewqewqe<br> wqewqe<br> </div> <div id="test2"> <img src="1.jpg" onclick="Hide();"> </div> </body> </html>
<!DOCTYPE HTML> <html> <head> <meta charset="utf8"> <script type="text/javascript" src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <script type="text/javascript"> $(function () { $('.bar').click(function() { var hidden = $('.bar').children().is(":visible"); if(hidden) $('.bar').children().hide(); else $('.bar').children().show(); }); }); </script> <style type="text/css"> .bar{ width: 300px; height: 50px; background-color: #758FEA; } </style> </head> <body> <div class="bar"> bar <div> test </div> </div> </body> </html>
function change (num) { reload (); index = num.options[num.selectedIndex].value; switch(parseInt(index)){ case 1: case 2: case 3: case 4: addTextArea (); break; case 5: index = parseInt(index) + 1; addTextArea (); break; default: break; } }
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>JS輪播範本</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script type="text/javascript" src="http://malsup.github.com/chili-1.7.pack.js"></script> <script type="text/javascript" src="http://malsup.github.com/jquery.cycle.all.js"></script> </head> <body> <style type="text/css"> body{ background-color: #808080; } #slideshow { color: #FF80C0; font-size: 20pt; margin-left: 40%; margin-top: 30%; } </style> <script type="text/javascript"> $(function() { $('#slideshow').cycle({ timeout: 3000, cleartype: 1, speed: 400, cleartypeNoBg = true }); }); </script> <div id="slideshow"> <div>這是一個輪播的範本</div> <div>會根據目前的排序去輪播</div> <div>時間間格大概就是3秒鐘</div> </div> </body> </html>