Jump to content

dgek495

Newbie
  • Posts

    2
  • Joined

  • Last visited

dgek495's Achievements

Explorer

Explorer (1/14)

0

Reputation

  1. Извините за глупый вопрос. Что-ли код решает отправку данных? Вы про это? — {"q":"7EdfoRk7I10OsHdQamvklPrUivktm1KkGixgvFOKGid768TItp9Im3WbVsvh6dMI1k0hI/d7liZn\r\n+jiY7z/muJfL2ijBgt2b4X4HS55ljcUy941HucWHo7sYuifP2RQ+Cig3Mv//FSpmj+QFgvrY45FG\r\nPWtJVaPCUdc3WQNa7niPN6xpN++VRblOQc/5T6xgTT72L8iEHSoP3rF7BXKVKQBq7kCuc8r/GG4w\r\nFd6VummLoD5RSUFrwkjWRh2K1KyJLgHr1gQ821fp0YyIKHPTTS0IWzeGqNx7J2X3NoO9yMLvCtMc\r\nN75764I/zC6IL8zIzH0RIxXvvV9F2cuHTcVFLoqcMZzpgLdU6rQTJVvTh7usLZYS9N1Q8HBQZuU1\r\ncewJYk2/uuAElPe/cObxYOT/cY2/BeU+INQ0A19XvHeOI2uWPTMU5Jli7B0mUXUjTvwx9pTRR9Xh\r\niE+WDMANajJrFBJI42kS5QNxg5G1apkQOu7KecKLQkShekLCo2ulaG6u14Y1FzvjOjeie6k2QlSl\r\ny4pi8h93iaeVfpG3POR4d+153f7RyDvtS0XOvDxZFU+qbweVSsU5QOZrOizU/HBLJIGtAVUK+fLe\r\nYRbQj1D7PZNfIXQ8zj49FNmNbJuWNK0NwWal4aJWHhmAzqeAMixj9OrPkVnHjXTMPGCAO3xY9zJ+\r\nx3AD5tFLZm0rfbH+3kN435lhP7BKCq3474dVYu2jmesbWCeJ4H0Ci3YEMWywQFG2luCQRkuIyGQS\r\nh0h//Z4qr/SRVd+j95Ml5HalbNlF5U7n+bERXBjLt8C/SvKd0CUPUnA0fDoe5A5a3SU1TZahXerM\r\n9PAeZRsRgobkq67cTL+4n9/vMSa6cw7I6ai8W+ERNXOVbgYDxfznQCPSH8C7fIkzDNz77+CUEDES\r\nqCFXrHND8P........................ Или это делает js? -- ;var SHARED_URL = "http://assets.webservices.websitepros.com"; var SHARED_SECURE_URL = "https://secure.websitepros.com/assets.webservices.websitepros.com"; Почему форма работает без PHP ? Подскажите пожалуйста как где отредактировать html или js чтобы данные приходили на мой хост, а почта на мою почту? спасибо.
  2. Подскажите пожалуйста . Я скачал форму вот такого вида- И нужна именно такого вида.Объясните ,подскажите пожалуйста как отредактировать плагин ResourceLoader.js. Чтобы данные приходили на мой хост, а почта на мою почту. Насколько я понимаю, форма обрабатывается скриптом ResourceLoader.js. Подскажите пожалуйста, какие файлы мне необходимо дописать/править для нормальной работы формы. И зачем нужен хэш ? Вот HTML: <HTML> <script type='text/javascript' src="1/javascript/com/web/ResourceLoader.js"></script> <script type='text/javascript'> WebCom.ResourceLoader.loadLib('com.jquery', '', true); WebCom.ResourceLoader.loadLib('com.web.components.navigation', '1.1', true); WebCom.ResourceLoader.loadLib('com.web.core', '', true); WebCom.ResourceLoader.loadLib('com.web.components.socialmediashare', '1.0', true); WebCom.ResourceLoader.loadLib('com.web.components.footercontact', '1.0', true); </script> <script type='text/javascript'>WebCom.ResourceLoader.flushResourcesQueue();</script> <script type="text/javascript" language="JavaScript"> <!-- jQuery(document).ready(function() {WebCom.ResourceLoader.setDocumentClosed(true);WebCom.Components.Navigation.init({"styleNav":{"primary":{"orientation":"horizontal","animation":{"effect":"none","speed":"default"},"decoration":{"stretch":"horizontal"},"button":{"width":160,"stretch":"horizontal","bullet":"none"},"singleline":true,"width":960},"secondary":{"position":{"offsetV":0,"offsetH":0,"reference":"self"},"orientation":"vertical","animation":{"effect":"none","speed":"default"},"decoration":{"stretch":"vertical"},"button":{"width":160,"stretch":"vertical","bullet":"none"},"direction":{"y":"down","x":"right"},"delay":"default","type":"flyout"}}});if (WebCom.Components.SocialMediaShare && typeof(WebCom.Components.SocialMediaShare.initInstances) == 'function') {WebCom.Components.SocialMediaShare.initInstances([{"id":"webcom-component-socialmediashare-20057736747724534","componentData":{"shareStyle":"IconOnly_Large"},"miscData":{"q":"JhBFnjDhIwnYuDeRvByGafNnGZ3CbaAn+uZ51u/qi/GPZdWlM7ZFIedC+fdfyrwRH9CtG7AlSeTe\r\nfIkeENDoogIisn3z4wKrlLNmmzMmCstdZKkZk7WdkOcf8GHFjfhvEXihXHcyaUPaD/EEbs+ExnKu\r\nholbUjGgRfs8LuF2betzWgWcCH3aAw==","renderMode":"Publish"}}]);}WebCom.Components.Form.renderInstances([{"id":"webcom-component-form-20057737038405283","componentData":{"form":{"id":"webcom-layout-area","template":"ContactUs_Narrow","title":"","formProcessorUrl":"#","description":"","имя":"Связаться с Нами","settings":{"emailDelivery":"copy","form2db":false,"isSecure":false,"postSubmission":{"message":"Thanks for your submission!","errorValue":"Oops! There was a problem submitting your form. Please try again.","type":"showСообщение","url":"../yourdomain.com/thankyou.html"/*tpa=http://yourdomain.com/thankyou.html*/},"formatting":{"useCustomStyle":true,"errorMsgColor":"#c70202","postSubmissionMsgColor":"","requiredTextColor":"#c70202","label":{"fontWeight":"bold","color":"#FFFFFF","fontFace":"","size":""},"formAlignment":""}},"creationTime":"2012-04-02T17:34:21","elements":[{"height":"medium","validators":[],"isRequired":false,"имя":"header","width":"medium","value":"%3Cp%3E%3Cstrong%3E%3Cspan%20style%3D%22color%3A%20%23ffffff%3B%22%3EСвязаться%20с Нами%20Сегодня%3A%3C/span%3E%3C/strong%3E%3C/p%3E","children":[],"label":"","type":"Paragraph","defaultValue":"","options":{}},{"height":"medium","validators":[],"isRequired":true,"имя":"имя","width":"medium","children":[],"label":"Имя","type":"TextBox","defaultValue":"","options":{}},{"height":"medium","validators":[],"isRequired":true,"имя":"phone","width":"medium","children":[],"label":"Номер телефона","type":"TextBox","defaultValue":"","options":{}},{"validators":[],"toolTip":"","width":"medium","children":[],"label":"Сообщение","type":"TextArea","height":"small","isRequired":true,"maxChar":"","имя":"message","value":"","defaultValue":"","options":{}},{"height":"medium","validators":[],"isRequired":false,"имя":"Submit","width":"small","value":"Submit","children":[],"label":"Untitled","type":"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renderMode":"Publish"}}]);if (WebCom.Components.FooterContact && typeof(WebCom.Components.FooterContact.initInstances) == 'function') {WebCom.Components.FooterContact.initInstances([{"id":"footerContact","componentData":{"email":"admenu@mail.ru"/*tpa=http://mail.ru/admenu@mail.ru*/},"miscData":{"renderMode":"Publish","q":"7EdfoRk7I11uo9aoFmslwhifZynVnUck0GSvZCNPXquFmIMSDNnkv8p8dI4GM5aDMnewSJ669YpN\r\nHqzOd/eW1DrWFupB1g0yQUlc5YOSWxoF3ujJr6mryb3SS4mxGg6ptoUgbVI+Kd1ZpzcQm4Mhgv5/\r\n0ZLMRA4HZzJr5C7OvnTN+Bj7LlJjUXpwVX4Q1CDlszQeYRz23/8="}}]);}}); // --> </script> <TABLE cellpadding="0" border="0" cellspacing="0"> <TD style="BACKGROUND-COLOR: #ff4949"><div id='webcom-component-form-20057737038405283'></div><BR> </TD> </TABLE> <td align="right" nowrap><font size="2" color="" face="Andale Mono, Arial, sans-serif"><div id="footerContact"></div></font><img title="" height="1" width="1" border="0" alt="" src="image/9.gif" ></td> </HTML> А Вот js: /* * To change this template, choose Tools | Templates * and open the template in the editor. */ (function () { if (typeof (WebCom) == 'undefined') { WebCom = {}; } /*private class*/ function Resource (/*RC_TYPE*/ type, /*ResourceLocator*/ locator, /*Object*/ _statusHandler) { this.type = type; this.locator = locator; var statusHandler = _statusHandler; this.getURL = function () { return this.locator.getURL(); }; this.getStatusHandler = function() { return statusHandler; } }; /*private class*/ function ResourceLocator (baseURL, fileName) { this.baseURL = baseURL; this.fileName = fileName; this.getBaseURL = function() { return this.baseURL; }; this.getURL = function () { if (this.fileName != "") { return this.baseURL + "/" + this.fileName; } else { return this.baseURL; } }; }; /*private class*/ function LibraryWrapper(_libHandle) { var libHandle = _libHandle; this.getResourceURL = function (/*String*/ resourcePath) { return libHandle.getResourceURL(resourcePath); }; this.loadResource = function (/*String*/ resourcePath, /*String*/ resourceType) { return libHandle.getResourceURL(resourcePath, resourceType); }; }; /*public class*/ function Library(/* [String runtimeName], String packageName, String version, String[] scripts, String[] styles*/) { var args = Array.prototype.slice.call(arguments); if (args.length == 5) { this.runtimeName = args.shift(); WebCom.ResourceLoader.makeNameSpace(this.runtimeName); //var libWrapper = new LibraryWrapper(this); //var constructorName = parts.join("_"); //eval(constructorName + ".prototype = libWrapper;"); // //eval(this.runtimeName + "= new " + constructorName + "();"); } this.packageName = args[0]; this.version = args[1]; this.scripts = args[2]; this.styles = args[3]; this.getRuntimeName = function () { return this.runtimeName; } this.getPackageName = function () { return this.packageName; }; this.getVersion = function () { return this.version; }; this.getScripts = function () { return this.scripts; }; this.getStyles = function () { return this.styles; }; this.getResourceURL = function (/*String*/ resourcePath) { return WebCom.ResourceLoader.getResourceURL(resourcePath, this); }; //TODO: review if we need to expose the defer flag as well this.loadResource = function (/*String*/ resourcePath, /*Object*/ statusHandler, /*String*/ _resourceType) { if (resourcePath == null) { throw new Error("resource path cannot be empty"); } var resourceType = _resourceType; if (resourceType != null) { if (!WebCom.ResourceLoader.isResourceSupported(resourceType)) { throw new Error("Unsuported resource type " + resourceType ); } } else { resourceType = WebCom.ResourceLoader.getResourceType(resourcePath); } //load it now. no deferral! WebCom.ResourceLoader._loadResource(this.packageName, this.version, resourceType, null, resourcePath, false, statusHandler); }; }; function WebCom_ResourceLoader() { var counter = 0; var RC_TYPE = { SCRIPT : "SCRIPT", STYLE : "STYLE" }; this.RC_TYPE = RC_TYPE; var C_LATEST_VERSION_IDENTIFIER = "latest"; var SHARED_URL = "http://assets.webservices.websitepros.com"; var SHARED_SECURE_URL = "https://secure.websitepros.com/assets.webservices.websitepros.com"; var versionsMixEnabled = false; var isShared = true; var isSecure = false; var resourceCache = {}; var librariesRegistry = {}; var resourcesQueue = []; var isDocumentClosed = false; var userAgent = navigator.userAgent.toLowerCase(); var browser = {msie: /msie/.test( userAgent ) && !/opera/.test( userAgent )}; var privateURI = ""; var queueInProgress = false; //holds the default extension per resource type var rcExtensionMap = {}; rcExtensionMap[RC_TYPE.SCRIPT] = "js"; rcExtensionMap[RC_TYPE.STYLE] = "css"; //holds the starting URI per resource type var rcBaseURIMap = {}; rcBaseURIMap[RC_TYPE.SCRIPT] = "javascript"; /** * Builds the locator for given named versioned resource. If <code>_isShared</code> * is not set then the loader's isShared member value is used. If shared the * resource will be relative to a shared URL. Otherwise it will be be relative * to the host page this loader was referenced from. Locator rules * * 1. Folders are per Java package convention * 2. Top package is appended per resource type (ie js/, css/) * 3. File name is built from last dot occurence till the end * * Examples: * * "com.jquery", null , false -> js/com/jquery/latest/jquery.js * "com.web.coolapp", null , false -> js/com/web/coolapp/coolapp.js * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param type * @param _isShared if true a shared URL will be used. otherwise the URL will * be relative to page this loader resides on */ /*private ResourceLocator*/ function getResourceLocator(/*string*/name, /*string*/ version, /*RC_TYPE*/ type, /*boolean*/ _isShared) { if (name == "") { throw new Error("Resource name cannot be empty!"); } if (typeof _isShared == 'undefined') { _isShared = isShared; } var url = ""; if (_isShared) { url = isSecure ? SHARED_SECURE_URL : SHARED_URL; } else { if (privateURI != "") { var location = window.location; url = location.protocol + "//" + location.host + ":" + location.port + "/" + privateURI; } else { url = window.location.toString(); url = url.substring(0, url.lastIndexOf("/")); } } var baseUri = ""; var baseName = ""; if (name.indexOf(".") != -1 ) { baseUri = name.replace(/\./g, '/'); var parts = name.split("."); baseName = parts[parts.length - 1]; } else { baseUri = baseName = name; } baseUri = url + "/" + rcBaseURIMap[type] + "/" + baseUri + "/" + version; return new ResourceLocator(baseUri, baseName + "." + rcExtensionMap[type]); }; function isResourceSupported(resourceType) { return resourceType !=null && resourceType.match(/^js|css$/) != null; }; function getResourceType (/*String*/ resourcePath) { if (resourcePath == null) { throw new Error("resource path cannot be empty"); } var extension; if (extension = resourcePath.match(/js|css$/) != null) { return (extension[0] == "js") ? RC_TYPE.SCRIPT : RC_TYPE.STYLE; } else { throw new Error("Unsuported resource type " + resourcePath ); } }; function loadResource(/*string*/ resourcePath) { var resource = new Resource(RC_TYPE.SCRIPT, new ResourceLocator(this.getResourceURL(resourcePath))); if (isDocumentClosed) { injectResourceIntoDOM_createElement(resource); } else { resourcesQueue.push( resource ); } }; /** * Loads the resource identified by <code>name</code>, <code>version</code> * and <code>relativePath</uri> into current DOM. If <code>deferred<code> is true the * loading will occur at a later time when {@link #flushResourcesQueue} is * invoked. * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param type * @param _isShared if true a shared URL will be used. otherwise the URL will * be relative to page this loader resides on * @param relativePath relative to baseURL of <code>name</code>/<code>version</code> * @param deferred whether to inject it now into DOM or deferr it for later * * @throws Error if mixing is currently disabled and an attempt to mix * different version of a library is detected */ /*private*/ function _loadResource (/*string*/name, /*string*/ version, /*RC_TYPE*/ type, /*boolean*/ _isShared, /*string*/ relativePath, /*boolean*/ deferred, /*Object*/ statusHandler) { if (name == "") { return; //nothing to do really w/ an empty component } if (version == null || version == "") { version = C_LATEST_VERSION_IDENTIFIER; //empty version we can handle } var libraryKey = name + "_" + version; var resourceKey = (relativePath != null && relativePath.length > 0) ? libraryKey + "_" + relativePath : libraryKey; if (resourceCache[libraryKey] != null) { if (!versionsMixEnabled && librariesRegistry[name] != version) { throw new Error("Version " + librariesRegistry[name] + " of " + name + " is already loaded. Cannot load " + version + " at the same time!" ); } if (resourceCache[resourceKey] == null) { resourceCache[resourceKey] = new ResourceLocator(resourceCache[libraryKey].getBaseURL(), relativePath); } else { return; } } else { if (libraryKey != resourceKey) { throw new Error("A dependent resource cannot be loaded w/o loading its parent library"); } librariesRegistry[name] = version; resourceCache[libraryKey] = getResourceLocator(name, version, type, _isShared); } if (deferred) { if (isDocumentClosed) { throw new Error("Cannot defer after the document is closed"); } resourcesQueue.push( new Resource(type, resourceCache[resourceKey] ) ); } else { injectResourceIntoDOM( new Resource(type, resourceCache[resourceKey], statusHandler ) ); } }; function getResourceURL(/*string*/ resourcePath, /*Library*/ library) { if (library != null) { var libraryKey = library.getPackageName() + "_" + library.getVersion(); if (resourceCache[libraryKey] != null) { return new ResourceLocator(resourceCache[libraryKey].getBaseURL(), resourcePath).getURL(); } else { throw new Error("Load the library first then ask for a dependent resource!"); } } else { return isSecure ? SHARED_SECURE_URL : SHARED_URL + "/" + resourcePath; } }; /** * Injects the <code>resource</code> into DOM by generating the appropriate * markup. Currently SCRIPT and STYLE elements are supported. * * @param resource */ /*private*/ function injectResourceIntoDOM(/*Resource*/ resource) { (isDocumentClosed) ? injectResourceIntoDOM_createElement(resource) : injectResourceIntoDOM_documentWrite(resource); }; /*private*/function injectResourceIntoDOM_documentWrite(/*Resource*/ resource) { if (resource.type == RC_TYPE.SCRIPT) { document.write("<script src='" + resource.getURL() + "'><\/script>"); } else if (resource.type == RC_TYPE.STYLE) { document.write("<link href='" + resource.getURL() + "' rel='stylesheet'></link>"); } }; /*private*/function injectResourceIntoDOM_createElement(/*Resource*/ resource) { var head = document.getElementsByTagName("head")[0] || document.documentElement; if (resource.type == RC_TYPE.SCRIPT) { var script = document.createElement("script"); script.type = "text/javascript"; script.src= resource.getURL(); //TODO: inject status handler support here head.insertBefore( script, head.firstChild ); } else if (resource.type == RC_TYPE.STYLE) { var style = document.createElement("link"); style.rel = "StyleSheet"; style.type = "text/css"; style.href = resource.getURL(); head.appendChild(style); } }; /** * Queues for DOM injection script dependency identified by <code>uri</code>. * The URI is relative to the library's base URL. * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param uri relative to library identified by <code>name</code> and <code>version</code> */ /*public*/ function loadScript (/*string*/name, /*string*/ version, /*string*/ uri ) { _loadResource(name, version, RC_TYPE.SCRIPT, null, uri, true); }; /** * Queues for DOM injection style dependency identified by <code>uri</code>. * The URI is relative to the library's base URL. * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param uri relative to library identified by <code>name</code> and <code>version</code> */ /*private*/ function loadStyle (/*string*/name, /*string*/ version, /*string*/ uri) { _loadResource(name, version, RC_TYPE.STYLE, null, uri, true); }; /** * Loads the library identified by <code>name</code> and <code>version</code> * into the current document. It will inject the lib's bootstraper into the * DOM synchronously * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param isShared if true a shared URL will be used. otherwise the URL will * be relative to page this loader resides on */ /*private*/ function loadLib (/*string*/name, /*string*/ version, /*boolean*/ isShared ) { _loadResource(name, version, RC_TYPE.SCRIPT, isShared, null, false); }; /** * This method is designed to be invoked from a library's bootstrap loader * loaded via loadLib (name, version, isShared) call. Dependent resources * will be queued for DOM injection. The actual injection occurs when calling * {@link #flushResourcesQueue}. This is mainly to ensure browsers load the * styles in the desired order. Two scripts blocks are generally needed. One * for the boostrapers and another one to flush the queue and load all the * dependent scripts and styles. * * @param name per Java package convention * @param version if null will default to 'latest' when resolving the URI * @param uri relative to library identified by <code>name</code> and <code>version</code> * * {@see Library} */ /*public*/ function importLib (/*Library*/ library) { var name = library.getPackageName(); var version = library.getVersion(); /* If library was loaded w/o a version simply use 'latest' as its version rather then actual version to satisfy all dependencies checks */ if (librariesRegistry[name] == C_LATEST_VERSION_IDENTIFIER) { version = C_LATEST_VERSION_IDENTIFIER; } var scripts = library.getScripts(); var i; for (i=0; i< scripts.length; i++) { loadScript(name, version, scripts[i]); } var styles = library.getStyles(); for (i=0; i < styles.length; i++) { loadStyle(name, version, styles[i]); } }; /** * Sets the secure flag. If set a secure URL will be used. * * @param _isSecure */ /*public*/ function setSecure (/*boolean*/ _isSecure) { isSecure = _isSecure; }; /** * Sets the shared flag. If shared all resources will be relative to a shared * URL unless private (non-shared) loading was requested explicitly for a * given resource. Otherwise they would be relative to host page this loader * was referenced from. This will allow storing/serving all resources self * contained under each website. * * @param isShared */ /*public*/ function setShared (/*boolean*/ _isShared) { isShared = _isShared; }; /** * Tells ResourceLoader the document is closed and it should use alternative * means for injecting resources into it rather then document.write * * @param isDocumentClosed */ /*public*/ function setDocumentClosed(/*boolean*/ _isDocumentClosed) { isDocumentClosed = _isDocumentClosed; } /** * Set this when the URL cannot be inferred from the host page (ie not all * the pages are in the same folder). <code>_privateURI</code> will be * appended to the domain of the host page if specified. * * @param _privateURI */ /*public*/ function setPrivateURI (/*string*/ _privateURI) { privateURI = _privateURI; }; /** * Sets the versions mix flag. If mixing is disabled then an error will be * generated when trying to load a different version of resource already * loaded at a different version * * @param _versionsMixEnabled */ /*public*/ function enableVersionsMix(/*boolean*/ _versionsMixEnabled) { versionsMixEnabled = _versionsMixEnabled; }; /** * Generates document writes for all resources queued so far for loading * */ /*public*/ function flushResourcesQueue () { if (queueInProgress ) { return; } queueInProgress = true; while ( resourcesQueue.length > 0) { injectResourceIntoDOM( resourcesQueue.shift() ); } queueInProgress = false; }; /*public*/ function makeNameSpace(/*String*/ packageName) { var parts = packageName.split("."); var pkgExists; var pkgName = ""; for (var i=0; i < parts.length; i++) { pkgName += ((pkgName != "") ? "." : "") + parts[i]; eval ("pkgExists = typeof " + pkgName + ";"); if (pkgExists != 'object') { eval (pkgName + " = {};"); } } }; this.flushResourcesQueue = flushResourcesQueue; this.setPrivateURI = setPrivateURI; this.enableVersionsMix = enableVersionsMix; this.setShared = setShared; this.setSecure = setSecure; this.loadLib = loadLib; this.importLib = importLib; this.loadScript = loadScript; this.loadResource = loadResource; this._loadResource = _loadResource; this.getResourceURL = getResourceURL; this.getResourceType = getResourceType; this.isResourceSupported = isResourceSupported; this.makeNameSpace = makeNameSpace; this.setDocumentClosed = setDocumentClosed; this.SHARED_URL = SHARED_URL; return this; }; //public static class WebCom.ResourceLoader = new WebCom_ResourceLoader(); WebCom.ResourceLoader.Library = Library; /* COMPONENT LOADER */ /*private class*/ function WebCom_ComponentLoader() { var components = []; /*public void*/function initComponent(name, version, className, data, onRenderComplete) { if(name) { //Add component to queue for init components.push({ 'name': name, 'className': className, 'version': version, 'data': data, 'onRenderComplete': onRenderComplete }); //Load the component JS file WebCom.ResourceLoader.loadLib(name, version, true); } }; /*public void*/function flushQueue() { for(var i=0;i<components.length;i++) { startComponent(components[i].className, components[i].data, components[i].onRenderComplete); } components = []; } /*private void*/function startComponent(className, data, onRenderComplete) { var componentClass = eval(className); if (componentClass && typeof(componentClass.initInstances) == 'function') { componentClass.initInstances(data , {listeners: {'renderComplete' : {handler: function() { if(typeof(onRenderComplete) == 'function') { onRenderComplete();}} }}}); } } this.initComponent = initComponent; this.flushQueue = flushQueue; return this; } //public static class WebCom.ComponentLoader = new WebCom_ComponentLoader(); }) (); В какую сторону копать/читать/поисковые запросы? Ногами не пинать плз, все мы в чём либо новички. Заранее благодарен. Файлы для этой формы
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy