¡¾PB.NET±à³ÌϵÁÐ6¡¿ÀûÓÃJavaScript½øÐпͻ§¶Ë±à³Ì
¡¾PB.NET±à³ÌϵÁÐ6¡¿ÀûÓÃJavaScript½øÐпͻ§¶Ë±à³Ì
ÆÕͨWEB³ÌÐòÊÇÓÉä¯ÀÀÆ÷·¢³öÇëÇ󣬷þÎñÆ÷ÒÔHTMLÐÎʽ·µ»Ø½á¹û¡£Ò»°ãÇé¿öÏÂÎÒÃÇÔÚPBµÄʼþÀï±àдµÄÈκζԿͻ§¶ËʼþµÄÏìÓ¦´úÂ붼»á²úÉúÒ»´ÎÓë·þÎñÆ÷µÄ½»»¥¹ý³Ì£ºµ±Ò»¸ö¿Í»§¶Ëʼþ±»´¥·¢Ê±£¬JavaScriptÖÐÓÐÒ»¸ö¶ÔÓ¦µÄʼþÈ¥Ïò·þÎñÆ÷·¢ÆðÇëÇ󣬷þÎñÆ÷¶Ë»áµ÷ÓöÔӦʼþµÄ´úÂë²¢½«½á¹û·µ»Ø¸ø¿Í»§¶Ë£¬¶ÔÓÚ¿Í»§À´ËµÒ»¸öÖ±½ÓµÄ¸Ð¹Û¾ÍÊÇÆÁÄ»±»Ë¢ÐÂÁËÒ»´Î¡£ÎªÁ˼õÉÙÕâÑùµÄpostback£¬ÎÒÃÇ¿ÉÒÔÀûÓÃJavaScript¶Ô¿Í»§¶Ë½øÐбà³ÌÒÔÌá¸ßWEB³ÌÐòµÄÐÔÄܺÍÓû§ÌåÑé¡£
Òª¶Ô¿Í»§¶Ëʼþ½øÐбà³Ì£¬±ØÐ轫ÎÒÃǵĴúÂë°üº¬ÔÚÒ»¸öÌõ¼þ±àÒëµÄ´úÂë¿éÀïÃ棬±àÒëÆ÷»áʶ±ð²¢ÓëÆÕͨpower script´úÂëÇø·Ö¿ªÀ´¡£ÔÚ×Ô¶¨ÒåµÄJavaScriptʼþÀï¿ÉÒÔͨ¹ýʹÓõ÷ÓÃDocument.Form.Submit»òPBȱʡµÄÒѶ¨ÒåʼþÀ´½Ó¹Ü±»´¥·¢µÄʼþ¡£
ÏÂÃæµÄÀý×Óͨ¹ýÒ»¸ö×Ô¶¨ÒåµÄ¿Í»§¶ËJavaScriptʼþ´úÂëÀ´È¡´úDATAWINDOWµÄItemChangedʼþ£¬Õâ¶Î´úÂëµÄÒâ˼ÊÇÈç¹ûÊǵÚÒ»ÁлòµÚ¶þÁеÄÖµ±»¸Ä±ä£¬ÄÇôµ÷ÓÃȱʡµÄJavaScriptʼþPBDataWindow_ItemChangedRejectÀ´È¡ÏûÖµµÄ¸Ä±ä¡£ÔÚÕâ¸öÀý×ÓÀïȱʡʼþ½«²»»á²úÉúpostback£¬Èç¹û²»ÊǵÚÒ»ºÍµÚ¶þÁн«²»»á´¥·¢¿Í»§¶Ë´úÂë¡£
//Start MyScriptFile.js
function MyItemChanged(sender, rowNumber, columnName, newValue)
{
if(columnName == "column1" || columnName == "column2")
{
// The default function is invoked
return PBDataWindow_ItemChangedReject(sender, rowNumber, columnName, newValue)
}
else
{
//do nothing
}
}
//End MyScriptFile.js
½Ó¹ÜµÄJavaScriptʼþдÔÚÒ»¸öÌõ¼þ±àÒë´úÂë¿éÀï:
#IF DEFINED PBWEBFORM THEN
dw_1.JavaScriptFile = "MyScriptFile.js"
dw_1.OnClientItemChanged = "MyItemChanged"
#END IF
ȱʡµÄJavaScriptʼþ
µ±ÎÒÃÇ·¢²¼³ÌÐòʱÎļþPBDataWindow.js »á¿½±´µ½·þÎñÆ÷applicationName\ScriptsĿ¼Ï£¬ÔÚÕâ¸öÎļþÀﶨÒåÁËһЩȱʡʼþ¹©ÎÒÃǵ÷Óᣵ÷ÓÃÕâЩȱʡµÄʼþ½«»áµ¼ÖÂÒ»´Îpostback»òÑÓʱµÄpostbak£¬Ò²ÓÐЩʼþ²»²úÉúpostback£¬ÃæµÄÁбíÁгöÁËÕâЩʼþºÍ²î±ð¡£ÔÚÇ°ÃæµÄÀý×ÓÖÐÎÒÃÇʹÓÃÀàËÆdw_1.OnClientʼþÃû = "×Ô¶¨ÒåJSº¯Êý"ÕâÑùµÄ´úÂë½Ó¹ÜÁ˶ÔÓ¦µÄDW¶ÔӦʼþµÄ´úÂ룬дÔÚDW¶ÔӦʼþÀïµÄ´úÂ뽫²»»áÔÙ±»µ÷Óã¬Èç¹ûÎÒÃÇÏëÖØд¥·¢ÕâЩ´úÂ룬¾Í±ØÐèʹÓÃϱíµÄJavaScriptʼþÁË£¬µ÷ÓÃÕâЩʼþʱ±ØÐèÊ
Ïà¹ØÎĵµ£º
ÕâÈý¸öÓïÑÔ·Ö±ðÊÇÈý¸ö¹«Ë¾¿ª·¢µÄ£¬SUNµÄJava£¬NetscapeµÄJavaScript£¬MicrosoftµÄJScript
JavaScriptÊÇÓÉNetscape¹«Ë¾¿ª·¢²¢ËæNavigatorµ¼º½ÕßÒ»Æð·¢²¼µÄ¡¢½éÓÚJavaÓëHTMLÖ®¼ä¡¢»ùÓÚ¶ÔÏóʼþÇý¶¯µÄ±à³ÌÓïÑÔ£¬²»ÐèÒªJava±àÒëÆ÷£¬¶øÊÇÖ±½ÓÔËÐÐÔÚWebä¯ÀÀÆ÷ÖУ¬ËüµÄÇ°ÉíÊÇLive Script¡£
JScriptÊÇÒ»ÖÖÀàËÆJavaScriptµÄÓïÑÔ¡ ......
ÄãÖªµÀÊÀ½çÉÏÓжàÉÙÖÖä¯ÀÀÆ÷Â𣿳ýÁËÎÒÃÇÊìÖªµÄIE, Firefox, Opera, SafariËÄ´óä¯ÀÀÆ÷Ö®Í⣬ÊÀ½çÉÏ»¹Óнü°ÙÖÖä¯ÀÀÆ÷¡£
¼¸ÌìÇ°£¬ä¯ÀÀÆ÷¼Ò×åÓиյ®ÉúÁËһλСÍõ×Ó£¬¾ÍÊÇGoogleÍƳöµÄChromeä¯ÀÀÆ÷¡£ÓÉÓÚChrome³öÉúÃûÃÅ£¬¾¡¹ÜËû»¹ÊǸöС¼Ò»ï£¬Ã»ÓÐÈ˸ÒС ......
¶ÁÈ¡XMLÎĵµ£»
²ÉÓõݹéÉú³ÉÎÞÏÞ¼¶µÄÊ÷Ðβ˵¥£»
Äܹ»ÏìÓ¦Êó±êʼþ£¬Õ¹¿ªÓë²ðµþ×Ó¼¶²Ëµ¥£»
Ê×ÏÈÊÇÉú³ÉÒ»¸öXMLÎĵµ£¬ÎÒÓõÄÊÇXML SpyµÄ±à¼Æ÷£»
<?xml version="1.0" encoding="utf-8"?>
<menu>
<menu name="Ã÷ ......
JavaScriptÕýÔò±í´ïʽµÄÓ÷¨
ÕýÔò±í´ïʽÊÇÒ»ÖÖ¿ÉÒÔÓÃÓÚģʽƥÅäºÍÌæ»»µÄÇ¿´ó¹¤¾ß£¬ÔںܶàÓïÑÔÖж¼¿ÉÒÔÓ¦Óá£JavaScript¶ÔÕýÔò±í´ïʽÌṩÁ˺ܺõÄÖ§³Ö£¬
JavascriptÖÐÓÐÒ»¸öÕýÔò±í´ïʽ¶ÔÏóRegExp¡£¸Ã¶ÔÏóÌṩÁË´óÁ¿µÄÊôÐԺͷ½·¨À´´¦ÀíÕýÔò±í´ïʽ£¬Í¬Ê±£¬String¶ÔÏóÒ²ÌṩÁËÏà¹ØµÄ·½·¨À´
´¦ÀíÕýÔò±í´ïʽ£¬ÔÚWebÓ¦ÓÃÖУ¬¾³ ......