الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

قائمة باستخدام جافاسكريبت، جاهزة لكن من مشكلة بسيطة

مغلق
بدأه إبراهيم دويكات في 21 يونيو 2006 · 3 رد · 602 مشاهدة · في منتدى تصميم صفحات الويب
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

قائمة باستخدام جافاسكريبت، جاهزة لكن من مشكلة بسيطة

السلام عليكم ورحمة الله وبركاته

هي المرفقات مشروع صغير عن كيفية استخدام قائمة في الجافاسكريبت....

المشروع يتكون من صفحة رئيسية اسمها index تكون مخزنة على الدليل الجذر للموقع root

بالاضافة إلى الصفحات الاخرى الداخلية (في هذا المثال صفحتان) وتكونان محفوظتان في مجلد texts

أيضا هناك ملفا الجافاسكريبت موجودان في المجلد root

لنبدأ في تجربة المثال لنكتشف المشكلة

أولا نشغل الصفحة Index فتعمل بشكل جيد وتظهر القائمة

من القائمة نختار الصفحات ثم الصفحة 1 فتظهر الصفحة المسماة page1

الان نختار من القائمة الصفحات ثم الصفحة 2 فتظهر مشكلة File not found

نرجع الى الخلف مرتين باستخدم المتصفح لنعود للصفحة الرئيسية ونختار من القائمة الصفحات ثم الصفحة 2 فتظهر الصفخة page2

الان أتوقع أن المشكلة قد توضحت لكم....

المشكلة بالضبط هي أنه عندما يتغير المجلد الذي تم تخزين الصفحة عليه فإن الرابط يصبح غير صحيح

للتوضيح أكثر

في الملف menu_array.JS تم تخزين أسماء الصفحات كالتالي:

الصفحة الرئيسية: index.htm

صفحة 1: texts/page1.html

صفحة 2: texts/page2.html

وبالتالي فإنه عندما نضغط على صفحة 1 من القائمة فإن عنوانها صحيح

لكن عندما نصبح داخل صفحة 1 فإن عنوان صفحة 2 هو texts/page2.html وهذا غير صحيح لان عنوان صفحة 1 بالنسبة لصفحة 1 يجب أن يكونpage2.html

أعتقد أن المشكلة قد أصبحت واضحة

يوجد للموضوع حلان وأنا لا أريد استخدامهما

الاول هو عمل نسختين من ملفات الجافاسكريبت، واحد داخل المجلد الذي يحتوي على index والاخر داخل المجلد الذي يحتوي الصفحات الاخرى، والمشكلة ان النسختين ستكونان مختلفتان مما يكلف وقتا وجهدا عند عمل التعديلات، وهذا ليس من أهداف الجافاسكربيت وهذا النوع من القوائم

الحل الاخر هو وضع كل الصفحات ونقلها من المجلد texts إلى المجلد الجذري root وهذا يسبب الفوضى في ترتيب الموقع (تصبح الصفحات غير مرتبة)

طبعا هدفي من هذه القائمة هو استخدامها في موقع موجود حاليا ويحتوي على أكثر من 70 صفحة، كل صفحة تحتوي على عدد من الصور وبالتالي فإن استخدام الحل الثاني هو شيء صعب جدا جدا.....

أريد ممن لديه حل ثالث أن يسعفني به، وأنا في الانتظار

وأعتذر عن الاطالة..........

MenuTest.rar

تم تعديل هذه المشاركة بواسطة إبراهيم دويكات في 21 يونيو 2006 في 20:18

My_Sign.jpg
#2

حيا الله أهل نابلس أولاً

بالنسبة لموضوعك يا أخي:

المشكلة هي في البرنامج اللي انت بتستخدمة.. أنا اطلعت على السكريبت.. ولقيت انه معمول على برنامج

DHTML menu

حيث يقوم بتخزين المسار كما يقوم بتخزين اسم الملف كما انت حددته

لذلك يقوم بكتابة اسم المجلد ثم كتابة اسم الملف الذي يحتوي أيضاً على اسم الجلد.. لذلك تكوزن النتيجة أن الملف غير موجود.

في هذه الحالة عليك وضع الملفات في نفس المجلد لتجنب مثل هذه الاخطاء

أو القيام بعمل القائمة يدوياً.. وهذا أمر صعب لكن مع الوقت يصبح سهلا جداً.

وبالتوفيق

للمزيد من المعلومات

الاتصال على الموقع الخاص

http://aladdins.co.nr

#3

الله يحييك أخ computer_rover

انا لم استخدم أي برنامج........وجدت هذا الكود في أحد المواقع وقمت بتعديله بواسطة notepad

أعتقد أن الحل الذي طرحته من قبل وهو عمل نسختين من ملفات الجافاسكريبت، واحد داخل المجلد الذي يحتوي على index والاخر داخل المجلد الذي يحتوي الصفحات الاخرى، هو الحل الافضل مبدأيا....

My_Sign.jpg
#4

alslam 3alaykom

this is menu_array.js after updete

/*
 DHTML Menu version 3.3.19
 Written by Andy Woolley
 Copyright 2002 (c) Milonic Solutions. All Rights Reserved.
 Plase vist http://www.milonic.co.uk/menu or e-mail menu3@milonic.com
 You may use this menu on your web site free of charge as long as you place prominent links to http://www.milonic.co.uk/menu and
 your inform us of your intentions with your URL AND ALL copyright notices remain in place in all files including your home page
 Comercial support contracts are available on request if you cannot comply with the above rules.
 This script featured on Dynamic Drive (http://www.dynamicdrive.com)
 */

//The following line is critical for menu operation, and MUST APPEAR ONLY ONCE. If you have more than one menu_array.js file rem out this line in subsequent files
menunum=0;menus=new Array();
_d=document;
function addmenu()
{menunum++;menus[menunum]=menu;
}
function dumpmenus()
{mt="<script language=javascript>";
for(a=1;a<menus.length;a++)
{mt+=" menu"+a+"=menus["+a+"];"}mt+="<\/script>";_d.write(mt)
}
//Please leave the above line intact. The above also needs to be enabled if it not already enabled unless this file is part of a multi pack.



////////////////////////////////////
// Editable properties START here //
////////////////////////////////////

// Special effect string for IE5.5 or above please visit http://www.milonic.co.uk/menu/filters_sample.php for more filters
if(navigator.appVersion.indexOf("MSIE 6.0")>0)
{
	effect = "Fade(duration=0.2);Alpha(style=0,opacity=88);Shadow(color='#777777', Direction=135, Strength=5)"
}
else
{
	effect = "Shadow(color='#777777', Direction=135, Strength=5)" // Stop IE5.5 bug when using more than one filter
}


timegap=500				// The time delay for menus to remain visible
followspeed=5			// Follow Scrolling speed
followrate=40			// Follow Scrolling Rate
suboffset_top=10;		// Sub menu offset Top position 
suboffset_left=10;		// Sub menu offset Left position

style1=[				// style1 is an array of properties. You can have as many property arrays as you need. This means that menus can have their own style.
"white",//"navy",					// Mouse Off Font Color
"6983D0",//"ccccff",				// Mouse Off Background Color
"ffebdc",				// Mouse On Font Color
"3B489C",//"4b0082",				// Mouse On Background Color
"6983D0",//"000000",				// Menu Border Color 
14,//12,						// Font Size in pixels
"normal",				// Font Style (italic or normal)
"bold",					// Font Weight (bold or normal)
"Verdana, Arial",		// Font Name
4,						// Menu Item Padding
"arrow.gif",			// Sub Menu Image (Leave this blank if not needed)
,						// 3D Border & Separator bar
"66ffff",				// 3D High Color
"000099",				// 3D Low Color
"Purple",				// Current Page Item Font Color (leave this blank to disable)
"70B2F7",//"pink",					// Current Page Item Background Color (leave this blank to disable)
"arrowdn.gif",			// Top Bar image (Leave this blank to disable)
"ffffff",				// Menu Header Font Color (Leave blank if headers are not needed)
"000099",				// Menu Header Background Color (Leave blank if headers are not needed)
]


 var BaseFolder="MenuTest".toLowerCase();
 var cmdL=new String(document.location.href);   
 var int_indx=cmdL.indexOf("?",0);
 if (int_indx!=-1)
	 cmdL=cmdL.substr(0,int_indx);
 int_indx=cmdL.indexOf("#",0);
 if (int_indx!=-1)
	 cmdL=cmdL.substr(0,int_indx);
	 var curFolder=new String(cmdL);
	 while(curFolder.indexOf("\\",0)!=-1)
		   {curFolder=curFolder.replace("\\","/");}
	 curFolder=curFolder.substr(0, curFolder.lastIndexOf("/")+1)
	 if(curFolder.toLowerCase().indexOf("/"+BaseFolder+"/",0)!= -1)
	   {BaseFolder=curFolder.substr(0,curFolder.toLowerCase().indexOf("/"+BaseFolder+"/",0))+"/"+BaseFolder;}
	 else
	   {BaseFolder=curFolder;}	
	 BaseFolder+="/";


addmenu(menu=[		// This is the array that contains your menu properties and details
"mainmenu",			// Menu Name - This is needed in order for the menu to be called
220,///20,					// Menu Top - The Top position of the menu in pixels
612,///				// Menu Left - The Left position of the menu in pixels
158,//,//width					// Menu Width - Menus width in pixels
1,					// Menu Border Width 
,//"right",//,					// Screen Position - here you can use "center;left;right;middle;top;bottom" or a combination of "center:middle"
style1,				// Properties Array - this is set higher up, as above
1,					// Always Visible - allows the menu item to be visible at all time (1=on/0=off)
"right",//"center",				// Alignment - sets the menu elements text alignment, values valid here are: left, right or center
effect,				// Filter - Text variable for setting transitional effects on menu activation - see above for more info
,					// Follow Scrolling - Tells the menu item to follow the user down the screen (visible at all times) (1=on/0=off)
0,/// 					// Horizontal Menu - Tells the menu to become horizontal instead of top to bottom style (1=on/0=off)
,					// Keep Alive - Keeps the menu visible until the user moves over another menu or clicks elsewhere on the page (1=on/0=off)
"left",//,					// Position of TOP sub image left:center:right
,					// Set the Overall Width of Horizontal Menu to 100% and height to the specified amount (Leave blank to disable)
1,					// Right To Left - Used in Hebrew for example. (1=on/0=off)
,					// Open the Menus OnClick - leave blank for OnMouseover (1=on/0=off)
,					// ID of the div you want to hide on MouseOver (useful for hiding form elements)
,					// Reserved for future use
,					// Reserved for future use
,					// Reserved for future use




,"الصفحة الرئيسية",BaseFolder+"index.htm",,"",1
,"الصفحات","show-menu=pg",,"",1
,"الفريق العربي","",,"",1

])


	addmenu(menu=["pg",
	,,150,1,"",style1,,"right",effect,,,,"left",,,,,,,,
	,"صفحة 1",BaseFolder+"texts/page1.html",,,0
	,"صفحة2",BaseFolder+"texts/page2.html",,,0

	])






dumpmenus()

menu_array.rar

سبحانك اللهم وبحمدك أشهد ان لا اله الا أنت

أستغفرك وأتوب اليك

الهم صلي وسلم وبارك على سيدنا وحبيبنا محمد

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…