![]() |
|
||||||||||
|
|||||
|
Вот решение на мой вопрос чуть ниже (http://flasher.ru/forum/showthread.php?threadid=46850)
Задача: На странице псевдо счётчик который набирает цыферки пока юзер на сайте. Сайт без использования фрэймов. Проблема: Сброс донуля при переходе со страницы на страницу Решение: Код в счётчике this.onLoad=function(){ _root.Myvalue=int(_root.Myvalue); } this.onEnterFrame=function(){ _root.Myvalue=int(_root.Myvalue); _root.Myvalue+=random(5)+1; count_val=String(_root.Myvalue); //переменная текстового поля fscommand("setcookies", _root.Myvalue); } Код на странице ... <script languge="javascript" SRC="counter_cookie.js"> </script> </head> ... <OBJECT classid="clsid 27CDB6E-AE6D-11cf-96B8-444553540000"codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="150" HEIGHT="300" id="counter" name="counter" ALIGN="" onLoad="SetCookie()" > <PARAM NAME=movie VALUE="counter.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000066> <EMBED id="counter" src="counter.swf" quality=high bgcolor=#000066 WIDTH="150" HEIGHT="300" NAME="counter" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" onLoad="SetCookie()"> </EMBED> </OBJECT> <script> <!-- SetCookie(); //--> </script> Код скрипта function addCookies(MyVar, MyVal){ document.cookie=MyVar+"="+MyVal; } function finde_cookie(MyName){ var i = 0; var nStartPosition = 0; var nEndPosition = 0; var myCookie = document.cookie; var myTemp = ""; while(i<= myCookie.length){ nStartPosition = i; nEndPosition = nStartPosition+MyName.length; if (myCookie.substring(nStartPosition, nEndPosition) == MyName){ nStartPosition = nEndPosition+1; nEndPosition = document.cookie.indexOf(";", nStartPosition) if (nEndPosition < nStartPosition)nEndPosition = document.cookie.length; myTemp = document.cookie.substring(nStartPosition, nEndPosition); return unescape(myTemp); break; } i++; } return ""; } function SetCookie(){ document.all['counter'].setVariable("Myvalue",finde_cookie("Myvalue")); } var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1; function counter_DoFSCommand(command, args) { var counterObj = InternetExplorer ? counter : document.counter; if (command == "setcookies") { addCookies("Myvalue", args); } } if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) { document.write('<SCRIPT LANGUAGE=VBScript\> \n'); document.write('on error resume next \n'); document.write('Sub counter_FSCommand(ByVal command, ByVal args)\n'); document.write(' call counter_DoFSCommand(command, args)\n'); document.write('end sub\n'); document.write('</SCRIPT\> \n'); }
__________________
Кто успел тот и ...... Вощем делай дэнс |
![]() |
Часовой пояс GMT +4, время: 18:54. |
|
|
« Предыдущая тема | Следующая тема » |
|
|