検索
ホームページウェブフロントエンドjsチュートリアルMain.js_javascript のヒントは Qidian から引用

String.prototype.trim = function()
{
return this.replace(/(^s*)|(s*$)/g, "");
}

String.prototype.len=function()
{
return this.replace(/[^x00-xff]/g,'aa').length;
}

function StringBuilder(value)
{
this.strings = new Array("");
this.append(value);
}

// 指定された値をこのインスタンスの末尾に追加します。
StringBuilder.prototype.append = 関数 (値)
{
if (値)
{
this.strings.push(value);
}
}

// 文字列バッファをクリアします
StringBuilder.prototype.clear = function ()
{
this.strings.length = 1;
}

// このインスタンスを文字列に変換します。
StringBuilder.prototype.toString = function ()
{
return this.strings.join("");
}

//文字列形式のプロトタイプ
//サンプル: var test="私の名前は {0} {2} " ;
// alert(test.format('liang','zhonghua');
if (!String._FORMAT_SEPARATOR){
String._FORMAT_SEPARATOR = String.fromCharCode(0x1f);
文字列。 _FORMAT_ARGS_PATTERN = new RegExp('^[^' String._FORMAT_SEPARATOR ']*'
new Array(100).join('(?:.([^' String._FORMAT_SEPARATOR ']*))?'));
}
if (!String.format)
{
String.format = function (s){
return Array.prototype.join.call(arguments, String._FORMAT_SEPARATOR)
replace(String._FORMAT_ARGS_PATTERN, s);
}
}
if (!''.format)
{
String.prototype.format = function ( ){
return (String._FORMAT_SEPARATOR
Array.prototype.join.call(arguments, String._FORMAT_SEPARATOR)
replace(String._FORMAT_ARGS_PATTERN, this);
//終了文字列形式

関数 checkLoginByCookie()
{
var cookieId="AUTHTEST";
if(window.location.href.toLowerCase().indexOf("qidian.com") > -1)
{
cookieId="cmfuToken";
}

if((GetCookie(cookieId)!=null && GetCookie(cookieId).length > 0 ))
{
return true;
}
else
{
if(GetCookie('cmfu_al') != null && GetCookie('cmfu_al').length > 0)

return true e;
}
}
falseを返します。
}

function getUrlParam(name)
{
var reg = new RegExp("(^|&)" name "=([^&]*)(&|$) "、"私");   
var r = window.location.search.substr(1).match(reg);   
if (r!=null)
{
return unescape(r[2]);
}
else
{
return null;   
}
}

function $(objName)
{

if(document.getElementById)
{
return document.getElementById(objName );
}
else if(document.layers)
{
return eval("document.layers['" objName "']");
}
else
{
return eval('document.all.' objName);
}
}

function DateAdd(BaseDate, interval, DatePart)
{
var dateObj = new Date(BaseDate.replace("-",","));
var ミリ秒=1;
var 秒=ミリ秒*1000;
var 分=秒*60;
var 時間=分*60;
var day=hour*24;
var 年=日*365;

var newDate;
var dVal = 新しい Date(dateObj)
var dVal=dVal.valueOf();
switch(DatePart)
{
case "ms": newDate=new Date(dVal ミリ秒*間隔); 壊す;
case "s": newDate=新しい 日付(dVal 秒 * 間隔); 壊す;
case "mi": newDate=新しい 日付(dVal分*間隔); 壊す;
case "h": newDate=新しい 日付(dVal 時間*間隔); 壊す;
case "d": newDate=new Date(dVal day*interval); 壊す;
case "y": newDate=new Date(dVal year*interval); 壊す;
デフォルト: return escape("日期格式不对");
}
newDate = 新しい 日付(newDate);
return newDate.getFull Year() "-" (newDate.getMonth() 1) "-" newDate.getDate() ; 
}

//增加当前日の天数
Date.prototype.AddDays=function(interval)
{
var dateObj = this;
var ミリ秒=1;
var 秒=ミリ秒*1000;
var 分=秒*60;
var 時間=分*60;
var day=hour*24;
var 年=日*365;

var newDate;
var dVal = 新しい Date(dateObj)
var dVal=dVal.valueOf();

newDate=新しい 日付(dVal 日 * 間隔); 

newDate = 新しい 日付(newDate);
return newDate
}

function SetCookie(name, value)
{

var argv = SetCookie.arguments;

var argc = SetCookie.arguments.length;

var expires = (argc > 2) ? argv[2].toGMTString() : (new Date()).AddDays(30).toGMTString();;

var path = (argc > 3) ? argv[3] : "/";

var domain = (argc > 4) ? argv[4] : null;

var secure = (argc > 5) ? argv[5] : false;


var content = name "=" escape(value) ";";
if(expires != null)
{
content = " expires=" expires ";";
}
if(path != null)
{
content = " path=" path ";";
}
if(ドメイン != null)
{
content = " domain=" domain ";";
}


document.cookie = content;


}

関数 GetCookie(cookieName)
{
var cookieString = document.cookie;

var start = cookieString.indexOf(cookieName '=');

// 等号を追加する理由は、
// 一部の Cookie 値に cookieName と同じ文字列が含まれることを避けるためです。

if (start == -1) // 見つかりません
return null;

start = cookieName.length 1
var end = cookieString.indexOf('; ' , start);
if (end == -1) return unescape(cookieString.substring(start));
return unescape(cookieString.substring(start, end)); 🎜>
/*テキスト ボックスがフォーカスを取得します*/
function TextBoxOnFocus(txtControl,strDefaultText)
{
if (txtControl.value==strDefaultText)
txtControl.value="";
}
/*テキスト ボックスはフォーカスを失います*/
function TextBoxOnBlur(txtControl,strDefaultText)
{
if (txtControl.value.replace(/(^[s]*)| ( [s]*$)/g,"")=="")
txtControl.value=strDefaultText;


/*機能: ポップアップ グループ メッセージ ウィンドウ*/
function MultiSendWin(subject,content)
{
var win =window.open(uploadURL "?subject=" subject "&content=" content,"","menubar=no,width=480 ,height= 550,resizeable=no","");
return false;
}


/*関数: ポップアップ メッセージ ウィンドウ
関数 SpaceSendMsg(toUserId)
{
var win =window.open(spaceSendMsgURL "?toUserId=" toUserId,"","menubar=no,width=500,height=400,resizeable=no",""); return false;
}
*/

function ShowServerMessage(result)
{
eval(result.value);

// を押します。入力してフォームを送信します
function KeydownSubmitForm(btnId)
{
var btn=document.getElementById(btnId);
if (btn!=null&&event.keyCode== 13)
{
event.return Value= false;
btn.click()
}
}

//ReadChapter - バウチャー
function MDown(Object) {
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft; > pY=event.y -document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
ドキュメント。 all(Obj).style .left=event.x-pX;
document.all(Obj).style.top=event.y-pY;
}
}

関数MUp(){
if(Obj!=''){
document.all(Obj).releaseCapture();
Obj='';
}

//クーポン情報を閉じる
function LayerClose(divDiscount){
document.getElementById(divDiscount).style.visibility="hidden"
}

//クーポン情報を表示
function LayerShow(divDiscount,discountPrize){
varpriceUI = document.getElementById(divDiscount);
priceUI.style.left = screen.width-530;
priseUI.style.top = screen.高さ - 480 ;
賞UI.style.visibility="visible";

document.getElementById("lblPrize1").innerHTML=discountPrize; discountPrize;
window.setInterval("LayerClose('" divDiscount "')",15000);
}

//マスターページの使用をヘルプします。
function HideMenu(menuid)
{
var obj = document.getElementById(menuid);
if(obj.style.display == "none")
{
obj.style.display = ""
}
else
{
obj.style.display = "none";

if(obj.style.display == "")
{
var tmpId = "M0";
for(var i = 1 ; i {
var myid = tmpId i;
if(myid != menuid)
{
document.getElementById(myid).style.display = "none";
}
}
}
}

/* div login */
function ShowLoginDiv()

var builder = new StringBuilder( );
builder.append("

");
");
    builder.append("");
    builder.append("");
    builder.append("");
    builder.append("");
    builder.append("");
    builder.append("");
    builder.append("");
    builder.append("
");
    builder.append("登录");
    builder.append("
");
    builder.append("×");
    builder.append("
");
    builder.append("");
    builder.append("
builder.append(""); builder.append(""); builder.append("登录"); builder.append(""); builder.append(""); builder.append("×"); builder.append(""); builder.append(""); builder.append(""); builder.append(""); builder.append(""); builder.append(""); builder.append(""); builder.append("");
//window.top.scrollTo(0,0);
document.getElementById("DivMask").style.height=document.body.scrollHeight;
document.getElementById("DivMask ").style.width=document.body.scrollWidth;
document.getElementById("DivMask").style.display = 'block';
document.getElementById("DivLogin").style.display = " block";
document.getElementById("DivLogin").innerHTML = builder.toString();
ScrollDiv();
window.onscroll=ScrollDiv;
window.onresize=ScrollDiv;
window.onload=ScrollDiv;
}
function HideLoginMask()
{
getElementById("DivMask").style.display="none";
document.getElementById(" DivLogin").style.display="none";
}
/*随画面滚動*/
function ScrollDiv()
{
if($("DivLogin"))
{
document.getElementById("DivLogin").style.top=(document.body.scrollTop
(document.body.clientHeight-document.getElementById("DivLogin").offsetHeight)/2) " px";

document.getElementById("DivLogin").style.left=(document.documentElement.scrollLeft
(document.body.clientWidth-document.getElementById("DivLogin").offsetWidth)/ 2) 「ピクセル」;

}

if($("AddMark"))
{
// if(!event )
// return;

$("AddMark").style.top=document.body.clientHeight document.body.scrollTop-200
$("AddMark").style.left=document.body.clientWidth-56 ;
$("AddMark").style.display=''; 

// (document.body.clientHeight-$("AddMark").offsetHeight)/2) "px";
if($("MonthVoteTip"))
{
//$("MonthVoteTip").style.top=document.body.scrollTop document.body.clientHeight-$("MonthVoteTip")。オフセット高さ "px";
$("MonthVoteTip").style.top = getPosition($("AddMark")).y - $("AddMark").offsetHeight "px";
}
}

}
関数 AutoScroll()
{

window.onscroll=ScrollDiv;
window.onresize=ScrollDiv;
window.onload=ScrollDiv; 
}

function getPosition(el)
{
for (var lx=0,ly=0;el!=null;lx =el.offsetLeft,ly =el.offsetTop, el=el.offsetParent);
return {x:lx,y:ly}
}

/* 2007-11-28 XuJian */
//截取字符串包含中文处理
//(串,長度,增加...)
function subString(str, len, hasDot)
{
var newLength = 0;
var newStr = "";
var chineseRegex = /[^x00-xff]/g;
var singleChar = "";
var strLength = str.replace(chineseRegex,"**").length;
for(var i = 0;i {
singleChar = str.charAt(i).toString();
if(singleChar.match(chineseRegex) != null)
{
newLength = 2;
}
else
{
newLength ;
}
if(newLength > len)
{
break;
}
newStr = singleChar;
}

if(hasDot && strLength > len)
{
newStr = "...";
}
return newStr;
}

/ * 2007-10-26 14:20 Get String Lenth(include chinese character) */
function GetStringLength(strObj)
{
return strObj.replace(/[^x00-xff]/g," **").length;
}

function addMark(title,url) {
try{
if (window.sidebar) {
window.sidebar.addPanel(title , url,"");
} else if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true;
}
}catch(e)
{
alert("Your browser security settings do not allow this operation")
}
}
声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
JavaScriptはCで書かれていますか?証拠を調べるJavaScriptはCで書かれていますか?証拠を調べるApr 25, 2025 am 12:15 AM

はい、JavaScriptのエンジンコアはCで記述されています。1)C言語は、JavaScriptエンジンの開発に適した効率的なパフォーマンスと基礎となる制御を提供します。 2)V8エンジンを例にとると、そのコアはCで記述され、Cの効率とオブジェクト指向の特性を組み合わせて書かれています。3)JavaScriptエンジンの作業原理には、解析、コンパイル、実行が含まれ、C言語はこれらのプロセスで重要な役割を果たします。

JavaScriptの役割:WebをインタラクティブでダイナミックにするJavaScriptの役割:WebをインタラクティブでダイナミックにするApr 24, 2025 am 12:12 AM

JavaScriptは、Webページのインタラクティブ性とダイナミズムを向上させるため、現代のWebサイトの中心にあります。 1)ページを更新せずにコンテンツを変更できます。2)Domapiを介してWebページを操作する、3)アニメーションやドラッグアンドドロップなどの複雑なインタラクティブ効果、4)ユーザーエクスペリエンスを改善するためのパフォーマンスとベストプラクティスを最適化します。

CおよびJavaScript:接続が説明しましたCおよびJavaScript:接続が説明しましたApr 23, 2025 am 12:07 AM

CおよびJavaScriptは、WebAssemblyを介して相互運用性を実現します。 1)CコードはWebAssemblyモジュールにコンパイルされ、JavaScript環境に導入され、コンピューティングパワーが強化されます。 2)ゲーム開発では、Cは物理エンジンとグラフィックスレンダリングを処理し、JavaScriptはゲームロジックとユーザーインターフェイスを担当します。

Webサイトからアプリまで:JavaScriptの多様なアプリケーションWebサイトからアプリまで:JavaScriptの多様なアプリケーションApr 22, 2025 am 12:02 AM

JavaScriptは、Webサイト、モバイルアプリケーション、デスクトップアプリケーション、サーバー側のプログラミングで広く使用されています。 1)Webサイト開発では、JavaScriptはHTMLおよびCSSと一緒にDOMを運用して、JQueryやReactなどのフレームワークをサポートします。 2)ReactNativeおよびIonicを通じて、JavaScriptはクロスプラットフォームモバイルアプリケーションを開発するために使用されます。 3)電子フレームワークにより、JavaScriptはデスクトップアプリケーションを構築できます。 4)node.jsを使用すると、JavaScriptがサーバー側で実行され、高い並行リクエストをサポートします。

Python vs. JavaScript:ユースケースとアプリケーションと比較されますPython vs. JavaScript:ユースケースとアプリケーションと比較されますApr 21, 2025 am 12:01 AM

Pythonはデータサイエンスと自動化により適していますが、JavaScriptはフロントエンドとフルスタックの開発により適しています。 1. Pythonは、データ処理とモデリングのためにNumpyやPandasなどのライブラリを使用して、データサイエンスと機械学習でうまく機能します。 2。Pythonは、自動化とスクリプトにおいて簡潔で効率的です。 3. JavaScriptはフロントエンド開発に不可欠であり、動的なWebページと単一ページアプリケーションの構築に使用されます。 4. JavaScriptは、node.jsを通じてバックエンド開発において役割を果たし、フルスタック開発をサポートします。

JavaScript通訳者とコンパイラにおけるC/Cの役割JavaScript通訳者とコンパイラにおけるC/Cの役割Apr 20, 2025 am 12:01 AM

CとCは、主に通訳者とJITコンパイラを実装するために使用されるJavaScriptエンジンで重要な役割を果たします。 1)cは、JavaScriptソースコードを解析し、抽象的な構文ツリーを生成するために使用されます。 2)Cは、Bytecodeの生成と実行を担当します。 3)Cは、JITコンパイラを実装し、実行時にホットスポットコードを最適化およびコンパイルし、JavaScriptの実行効率を大幅に改善します。

JavaScript in Action:実際の例とプロジェクトJavaScript in Action:実際の例とプロジェクトApr 19, 2025 am 12:13 AM

現実世界でのJavaScriptのアプリケーションには、フロントエンドとバックエンドの開発が含まれます。 1)DOM操作とイベント処理を含むTODOリストアプリケーションを構築して、フロントエンドアプリケーションを表示します。 2)node.jsを介してRestfulapiを構築し、バックエンドアプリケーションをデモンストレーションします。

JavaScriptとWeb:コア機能とユースケースJavaScriptとWeb:コア機能とユースケースApr 18, 2025 am 12:19 AM

Web開発におけるJavaScriptの主な用途には、クライアントの相互作用、フォーム検証、非同期通信が含まれます。 1)DOM操作による動的なコンテンツの更新とユーザーインタラクション。 2)ユーザーエクスペリエンスを改善するためにデータを提出する前に、クライアントの検証が実行されます。 3)サーバーとのリフレッシュレス通信は、AJAXテクノロジーを通じて達成されます。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

SecLists

SecLists

SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

SublimeText3 Linux 新バージョン

SublimeText3 Linux 新バージョン

SublimeText3 Linux 最新バージョン

DVWA

DVWA

Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

強力な PHP 統合開発環境

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。