View Full Version : attach کردن فایل در سایت توسط javascript
vahidsadeqi
شنبه 06 مرداد 1386, 16:37 عصر
سلام دوستان،
من می خوام تو سایتم امکان attach کردن فایل برای کاربر را قرار دهم،
ممکنه راهنمایی کنین،
اگه کد شو دارین ممنون می شم در اختیارم قرار بدین.
vahidsadeqi
شنبه 06 مرداد 1386, 16:59 عصر
من این کد رو نوشتم ،ولی درست کار نمیکنه،ایرادش کجاست؟
var SibSite = { activeClass : 'formactive', addFormHighlighter : function(formName, other) { //retrieve active color /*console.log("setting color"); for(i=0; i<document.styleSheets.length; i++) { if(document.styleSheets[i].href.match('admin.css') != null) { for(j=0; j<document.styleSheets[i].cssRules.length; j++) { if(document.styleSheets[i].cssRules[j].selectorText == 'formactive') { this.activeClassColor = document.styleSheets[i].cssRules[j].style.backgroundColor; break; } } break; } }*/ allNodes = Form.getElements(formName); //If there is another element passed in, at it to the end of the allNodes array if (other != undefined) { allNodes[allNodes.length] = $(other); } for(i = 0; i < allNodes.length; i++) { allNodes[i].onfocus = function() { node = $(this).up('li'); node.className = SibSite.activeClass; node.focused = this.id; }; allNodes[i].onblur = function() { node = $(this).up('li'); //make sure we're not unsetting the active class if someone else has already focused if(node.focused == this.id) { node.className = ""; } }; } }, //Sets up calendar and also alters the Calendar show() and hide() functions to deal with highlighting correctly setupCalendar : function(field,button) { Calendar.setup({ inputField : field, ifFormat : "%d/%m/%Y", button : button, align : "Tl" }); Calendar.prototype.oldShow = Calendar.prototype.show; Calendar.prototype.show = function show() { $(field).parentNode.parentNode.parentNode.classNam e = SibSite.activeClassName; this.oldShow(); } Calendar.prototype.oldHide = Calendar.prototype.hide; Calendar.prototype.hide = function hide() { $(field).parentNode.parentNode.parentNode.classNam e = ""; this.oldHide(); $(field).focus(); } }, setupEditors : function(field1, field2, basepath, lang) { var editor = new FCKeditor( field1 ); editor.BasePath = basepath+"/fckeditor/"; editor.ToolbarSet = "SIB"; editor.Width = 700; editor.Height = 400; editor.Config["DefaultLanguage"] = lang; editor.ReplaceTextarea(); editor = new FCKeditor( field2 ); editor.BasePath = basepath+"/fckeditor/"; editor.ToolbarSet = "SIB"; editor.Width = 700; editor.Height = 400; editor.Config["DefaultLanguage"] = lang; editor.ReplaceTextarea(); }}/** * Next three functions ensure editors call the underlying form object focus and blur events.* Used to ensure that events applied to every element in a form still work after the elements* have been replaced by an editor.*/function FCKeditor_OnComplete( editorInstance ) { editorInstance.Events.AttachEvent( 'OnBlur' , FCKeditor_OnBlur ) ; editorInstance.Events.AttachEvent( 'OnFocus', FCKeditor_OnFocus ) ;}function FCKeditor_OnBlur( editorInstance ) { $(editorInstance.Name).onblur();}function FCKeditor_OnFocus( editorInstance ) { $(editorInstance.Name).onfocus();}
Business Analyst
یک شنبه 07 مرداد 1386, 02:52 صبح
یه سریبه سایت زیر بزن ببین چیز ی پیدا میکنی یکم حوصله میخواد
www.JavaScript.com (http://www.JavaScript.com)
vahidsadeqi
چهارشنبه 10 مرداد 1386, 21:43 عصر
با javascript نتونستم گیر بیارم ولی با xhtml یه چیزایی گیر اوردم،ممنون.
<form method="post" action="upload.cgi" enctype="multipart/form-data">???? ?????
<input type="file" name="title" size="30"/>
</form>
vBulletin® v4.2.5, Copyright ©2000-1404, Jelsoft Enterprises Ltd.