¹ØÓÚjavascriptÎÊÌâ,,ºÜ¼± - Web ¿ª·¢ / JavaScript
ÓÃjavascript½«Êý¾Ýµ¼³öµ½Îı¾Îļþ(txt)ÖÐ.. Ê×ÏȼÙÉèÒѾÓÐÁËÐèҪдÈëµÄÎı¾ÄÚÈÝ var txtContent ="ÐèҪдÈëµÄÄÚÈÝ"; ÏÖÔÚÐèÒªÓÃjavascript½«ÄÚÈÝдÈëtxtÎļþ(Õâ¸ötxtÎļþ²»´æÔÚ,ÐèÒª´´½¨)ÖÐ,È»ºóдºÃÖ®ºóÐèÒª´ò¿ª(»òÕßÓб£´æµÄ¶Ô»°¿ò),ÈÃʹÓÃÕß×Ô¼º±£´æ... ¾ÍÊÇÈÃʹÓÃÕß¿´×ÅÀàËÆtxtÊÇÏÂÔصÄ..... ÎÒÕÒÁ˺ܶàÎĵµ»ù±¾É϶¼ÊÇÕâÑùµÄ var fso, f1; fso = new ActiveXObject("Scripting.FileSystemObject"); f1 = fso.CreateTextFile("c:\\testfile.txt", true); ÕâÑùÓиöÎÊÌâ,Ê×ÏÈÐèÒª´´½¨¸öÎļþµ½CÅÌ...ÎÒÊÇÒªÌṩÏÂÔضԻ°¿ò»òÊÇ´ò¿ªÕâ¸öÎļþÈÃʹÓÃÕß×Ô¼º±£´æ
Ò»°ëµÄä¯ÀÀÆ÷³öÓÚ°²È«¿¼ÂÇÊDz»ÔÊÐí¶Áд±¾µØÎļþµÄ¡£ ¿ÉÒÔÔÚ·þÎñÆ÷¶ËÉú³ÉÒª±£´æµÄÎļþÈ»ºóÈÃÓû§ÏÂÔØ£¬¾ÍÏëµ±ÓëÒ»°ãµÄÎļþÏÂÔØÒ»Ñù¡£ ʵÏÖ²»Á˵ģ¬ä¯ÀÀÆ÷µÄ°²È«²ßÂÔÏÞÖÆÄãÕâÑù×ö. »¹ÓÐÒ»µã£¬JavascriptÊÇÔÚ¿Í»§¶ËÖ´ÐУ¬ÔõôдÁËÎļþºó£¬»¹Äܵ¯³öÏÂÔضԻ°¿ò. Â¥Ö÷»¹ÊÇÔÚ·þÎñ¶ËÍê³É°É ²»ÒªÓÃjsÉú³ÉÎļþµÄ·½Ê½£¬ÓÃÒ»¸öеÄÒ³ÃæÉú³ÉtxtÀ´ÌṩÏÂÔØ ÔÚÒ³Ê×¼ÓÉÏ£º response.setHeader("Content-Disposition", "attachment;filename=output.txt"); Á¬½Óµ½Õâ¸öÒ³Ãæ¾Í»á³öÏÖÏÂÔصÄÌáʾ ѧϰ JS²»Êʺϣ¬²»½ö¹¦ÄÜÈõ£¬»¹Êܲ»Í¬µÄä¯ÀÀÆ÷°²È«»úÖÆÏÞÖƶøÎÞ·¨ÍêȫͨÓ㬻¹ÊÇÓÃASP,JSP,PHP×ö±È½ÏºÏÊÊ¡£ÒýÓà JS²»Êʺϣ¬²»½ö¹¦ÄÜÈõ£¬»¹Êܲ»Í¬µÄä¯ÀÀÆ÷°²È«»úÖÆÏÞÖƶøÎÞ·¨ÍêȫͨÓ㬻¹ÊÇÓÃASP,JSP,PHP×ö±È½ÏºÏÊÊ¡£ ¹¦ÄÜÈõ£¿×Ô¼ºÑ§ÒÕ²»¾«¾Í²»Òª¹Öʦ¸¸½ÌµÄ²»ºÃ¡
Ïà¹ØÎÊ´ð£º
rt£¬ ÖÐeÎĽԿɣ¬chmµÄ£¬pdfµÄ¾ÍËãÁË£¬ÎÒ×Ô¼ºÏÂÔص½ÁË Ã»ÈËÓУ¿ ²»ÖªµÀÄã˵µÄµç×ÓÊéÊÇʲôÑùµÄ£¬³ýÁËchm¡¢pdf Ī·ÇÊÇÒªÅijöÀ´µÄ¡£¡£¡£¡£=0= ÎÒ¾õµÃÕâÀàÊ黹ÊÇʵÌåÊé¿´µÄÓиоõ... ÈÃÎÒ¿´µç×ÓÊé¾õµÃ¾ ......
Ò³ÃæÔØÈëµÄʱºòʹÓà ÈçÏ´úÂëÈ¡µÃÒ»¸öÊôÐÔ²¢ÏÔʾÔÚjspÖÐ Java code: <td id="temp1"> <bean:write name="Form" property="years" scope="request"/> ......
ÊÖÍ·ÓÐÒ»¸öÍøÕ¾£¬ÍêÈ«ÊÇÓÃjavascriptºÍhtmlдµÄ£¬Ö»ÓÐÒ»¸ö default.htmlÒ³Ã棬Ȼºó×ó²àÓÐÏÂÀ²Ëµ¥£¬ÖмäÏÔʾÄÚÈÝ£¬ÏÖÔÚµÄÎÊÌâÊÇÏ£ÍûÔÚnews²Ëµ¥µã»÷ºóÏÔʾµÄ¶«Î÷Äܹ»·ÖÒ³£¬µ«ÊÇ·ÖÒ³¼¼ÊõÊÇÒª¸Ä±äurlµÄ£¬ÕâÑùµÄ»°Õû¸öÒ³ ......
ÈçÌ⣡ <input onclick="javascript:alert(this.value);" type="button" value="test"/> ²»ÖªµÀÂ¥Ö÷ÊDz»ÊÇÒªÕâÑù£¬Å¼ÊÇÐÂÊÖ£¬¼ûЦÀ² Ps£ºalert ¿ÉÒÔ»»³Édocument.writ ......