Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¹ØÓÚjavascript ²Ù×÷¹â±ê

°æ±¾£ºDHTML Object Model¡¡·µ»ØÖµ£ºÓÐ
Óï·¨£º
oTextRange = object . createTextRange ()
²ÎÊý£º
ÎÞ
·µ»ØÖµ£º
oTextRange : ¶ÔÏó(Element)¡£Èç¹û³É¹¦µÄ»°·µ»Ø±»½¨Á¢µÄ TextRange ¶ÔÏó¡£
˵Ã÷£º
Ϊ object ½¨Á¢ TextRange ¶ÔÏó¡£
ʹÓÃ´Ë TextRange ¶ÔÏó¿ÉÒÔ¼ìË÷ºÍÐÞ¸Ä object ÄÚµÄÎı¾¡£ TextRange ¶ÔÏóµÄ htmlText ÌØÐÔÓÈÆäÌṩÁË·½±ã¡£
Ó¦ÓÃÓÚ£º
IE4.0+ BODYBUTTONINPUT
createTextRangeÓ÷¨
Ò»¡¢·µ»ØcreateTextRangeµÄtextºÍhtmlText
<script language="javascript">
function test()
{
var rng=document.body.createTextRange();
alert(rng.text)
}
function test1()
{
var rng=document.body.createTextRange();
alert(rng.htmlText)
}
</script>
<input type="button" onclick="test()" value="text">
<input type="button" onclick="test1()" value="htmlText">
¶þ¡¢»ñÈ¡Ö¸¶¨Îı¾¿òÖеÄÑ¡ÖеÄÎÄ×Ö£ºÖ»ÏìÓ¦µÚÒ»¸öÎı¾¿ò
<input id="inp1" type="text" value="1234567890">
<input id="inp2" type="text" value="9876543210">
<input type="button" onclick="test()" value="È·¶¨">
<script language="javascript">
function test()
{
var o=document.getElementById("inp1")
var r = document.selection.createRange();
if(o.createTextRange().inRange(r))
alert(r.text);
}
</script>
Èý¡¢Ò³ÃæÎı¾µ¹Ðò²éÕÒ
abababababababa
<input value="µ¹Ðò²éÕÒa" onclick=myfindtext("a") type="button">
<script language ='javascript'>
var rng = document.body.createTextRange();
function myfindtext(text)
{
rng.collapse(false);
if(rng.findText(text,-1,1))
{
rng.select();
rng.collapse(true);
}else
{alert("end");}
}
</script>
ËÄ¡¢¾Û½¹¿Ø¼þºó°Ñ¹â±ê·Åµ½×îºó
<script language="javascript"> 
function setFocus() 

var obj = event.srcElement; 
var txt =obj.createTextRange(); 
txt.moveStart('character',obj.value.length); 
txt.collapse(true); 
txt.select(); 

</script> 
<input type="text" value="http://toto369.net" onfocu


Ïà¹ØÎĵµ£º

myeclipse¸Ä±äjavascript±àÂë¸ñʽ

window ->perferences->myeclipse->Files and Eidtors ->javaScript
ÒòΪMyEclipse±£´æjsÎļþ£¬ÖÐÎÄ»á³öÏÖÂÒÂë¡£°´ÉÏÊö·½·¨½«±àÂë¸ñʽ¸Ä³ÉÖÐÎĵıàÂë
ʵÔÚ²»Ðоʹò¿ªÔ­ÏȵÄÔ­¸åjsµÄÎļþ£¬¸´ÖÆ£¬Õ³Ìù¡£¡£¡£ ......

vbscriptʵÏÖjavascript ¡°this¡± µÄ¹¦ÄÜ

Æäʵ¾ÍÊÇÓÃmeÀ´´úÌæthis£¬²»¶à˵£¬¿´´úÂ룺
=============================
´úÂë1£º
<html>
<head>
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<body>
<input id="testit" type=button value="²âÊÔ" onclick="vbscript:me.value='Íê³É'">
<input id="testit" type=button v ......

Ö´ÐÐAJAX·µ»ØHTMLƬ¶ÎÖеÄJavaScript½Å±¾

Èç¹ûAJAX¼ÓÔصÄÊý¾ÝÊÇÒ»¸öHTMLƬ¶Î£¬¶øÇÒÕâ¸öHTMLƬ¶Î»¹°üº¬½Å±¾<script>¿é£¬ÄÇôÔÚÄã°ÑÕâÊý¾ÝxmlHttp.responseTextÓÃinnerHTML·½·¨²åÈëµ½µ±Ç°ÎĵµÒ»¸öÔªËØÖУ¬Äã»á·¢ÏÖAJAX¼ÓÔØ»ØÀ´µÄ½Å±¾¸ù±¾Ã»ÓÐÖ´ÐС£ÕâÊÇAJAX¿ª·¢Öкܳ£¼ûµÄÎÊÌ⣬Èç¹ûÄã²»ÊÇÒ»Ö±ÔÚÓÃJavaScript¿ò¼Ü×ö¿ª·¢£¬ÏàÐÅÄãÔç¾Í·¢ÏÖÕâ¸öÎÊÌâÁË¡£±¾ÎÄ·ÖÎöÁËÁ ......

asp.netÖÐʹÓÃjavascriptµÄ·½·¨¼°Çø±ð

1.ʹÓà ʹÓÃResponse.Write£¬ÕâÖÖ·½·¨»á°ÑJS´úÂëдÔÚÒ³ÃæµÄ×²¿(µÄÇ°Ãæ)£º
2. ʹÓ㺠page.ClientScript.RegisterStartupScript£¨£©£» ÕâÖÖ·½·¨»á°ÑJS´úÂëǶÈëÔÚÒ³ÃæµÄµ×²¿¡¢±íµ¥µÄ×îºó (Ç°Ãæ)£¬ÊÊÓÃÓÚÒªÔÚÒ³Ãæ¿Ø¼þ¼ÓÔØÍê³ÉºóÔËÐеÄJS´úÂë
3.ʹÓÃRegisterClientScriptBlock£¨£©£»ÕâÖÖ·½·¨»á°ÑJS´úÂëǶÈëÔÚÒ³ÃæµÄ¶¥²¿¡¢ ......

10ÖÖJavaScriptÌØЧʵÀýÈÃÄãµÄÍøÕ¾¸üÎüÒýÈË

    ½ñÌìµÄ»°ÌâÊÇÈçºÎ¸Ä½ø×Ô¼ºÍøÕ¾µÄ½çÃæ»òÌá¸ßÍøÕ¾µÄÊÓ¾õÌåÑ飬´Ó¶øÈÃÓû§¼ÇÒäÓÌС£
    ÎÒÃÇÓÐÈýÖÖÖ÷ÒªµÄ·½·¨(´ÓÄѵ½Ò×):×Ô¼º¶¯ÊÖд½Å±¾;ʹÓÃÀàËÆÓÚjQueryºÍmooToolsµÄJavaScript¿ò¼Ü(¿ÉÒÔÈñàд´úÂë±äµÃ¸üÈÝÒ×Щ);ʹÓÃÄܹ¤×÷ÓÚÏÖÓеÄJavaScript¿ò¼ÜϵÄÌáÇ°Ô¤ÖúõĽű¾»òÄÇÖÖ´ÓÍ·¿ªÊ¼¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ