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

لمن لهم الخبره في javascript ( ارجو سرعة الرد)

مغلق
بدأه Diver في 30 مارس 2005 · 3 رد · 594 مشاهدة · في منتدى تصميم صفحات الويب
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

اخواني : عندي مشكله بسيطه جدا - حسب اعتقادي -

المشكله كالتلي : :(

اذا كان عندي 2 رديو بتون وزر صبميت , اردي انه اذا اختار احد الاختيارات وليكن الريدو بتن 1 تطلعله مسج (كونفيرم) بحيث انه في حالة اختيار ل نعم سوف يذهب لعنوان محدد

اما في حالة اختياره للريو بتن 2 سوف يطلعله (كونفيرم ايظا) وفي حالة اختياره ل نعم سوف ينتقل لعنوان اخر ( خلاف الاول)

الذي عملته اني حطيت فنكشن فيها الكونفيرمز بحيث اني اسندت الفنكشن لـــ onsubmit التي في الفروم

ولكن :

بعد ذلك (هنا المشكله الاساسيه) عملت فنكشن اخرى تقوم بإرجاع العنوان (string) المطلوب بعد معاودت التشييك على checked التي في الرديو بتون واسندت هذه الفنكشن الى action

ولكن لم ينفذ الفنكشن ابداً :blink: !!

<html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language=javascript>

function GOTO(x)
{
  if(x.RD[0].checked== true )
    return "C:\Documents and Settings\Owner\Desktop\One.aspx";
else
   if(x.RD[1].checked==true)
         return "C:\Documents and Settings\Owner\Desktop\Two.aspx";
       	 
}
  
 function sure(x)
{
   if(x.RD[0].checked== true)
     return confirm("Are you sure That You Want to go to address one ");
   else
    if(x.RD[1].checked==true)
        return confirm("Are you sure That You Want to go to address two ");	
}
</script>
</head>

<body>
<form id=Form1 onsubmit="return sure(this)" action="return GOTO(this)" method=post runat=server>
<input type=radio value=0 name=RD>
<input type=radio value=1 name=RD>
<input type=submit value=GO>
</form>
</body>

</html>
#2

جرب هذا الكود يا أخى

<html dir="rtl">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language=javascript>
 function sure(x)
{
  if(x.RD[0].checked== true)
  {
 	 x.action = "one.aspx"
    return confirm("Are you sure That You Want to go to address one ");
    }
  else if(x.RD[1].checked==true)
    {   
 	 x.action = "two.aspx"
    return confirm("Are you sure That You Want to go to address two ");
       
    }
}

</script>
</head>

<body>
<form id="Form1" onsubmit="return sure(this);" method=post runat=server>
<input type=radio value=0 name=RD>
<input type=radio value=1 name=RD>
<input type=submit value=GO>
</form>
</body>

</html>

و على فكرة أظن أنك ينبغى أن تكتب عنوان الصفحة هكذا

http://localhost/desktop/one.aspx

و ليس هكذا

C:\Documents and Settings\Owner\Desktop\One.aspx

#3

هنا الخطأ :

action="return GOTO(this)"

action لا تقبل script method

بامكانك بكل سهولة في نفس الفنكشن GOTO أن تعطي أي قيمة لـ action ثم تعمل submit

فتكون الفنكشن كالتالي :

function sure(x)
{
  if(x.RD[0].checked== true){
    if(confirm("Are you sure That You Want to go to address one ");)
    {
         x.action = "C:\Documents and Settings\Owner\Desktop\One.aspx";
         x.submit();
    }
    }

  else
   if(x.RD[1].checked==true)
    {
       if(confirm("Are you sure That You Want to go to address two "))
         {
             x.action = "C:\Documents and Settings\Owner\Desktop\Two.aspx";
             x.submit();
         }
     }
}

والفورم يكون كالتالي :

<form id="Form1" onsubmit="sure(this);" action="" method=post runat=server>
#4

اشكركم اخواني : 'medmuseum' و خـالد على سرعة الرد :rolleyes:

واسف على التأخير بس لان جلست اجرب شغله هبلتني :wacko: والكورد بالاسفل راح ارفقه ...

الشي الأول : شالفرق بين id و name يا أخواني مره يظبط شغلي اذا حطيت id ومره لأ ومرة يظبط اذا حطيت name ومره لأ <_< اعتقد ان في قرابة بين id و runat دايم اشوفهم حول بعض . B) الله يدوم المحبه "بس مو على حساب الشغل الله يخليكم" خلو البرنامج يتنفذ أول" :lol:

الشئ الثاني : ان عندي نفس القصة السابقة بس هالمره انها مو راضيه تتنفذ , يطلعلي ERROR IN ViewState

"ياحبي لها الكمبيوتر :rolleyes: ماينضحك عليه"

الشي الثالث : اني غير ال id الي name وحذفت runat وسحبان الله نفذ البرنامج بس لاحظت اني اذا حطيت cancel بالـ confirm MSG ان الصفحة ترجع تتحمل <_< . فقلت أرجعلكم قبل لا اتفاهم مع الكمبيوتر ....

ملاحظه: شغال على مشورع التخرج فالله يعافيكم افيدوني بأقرب وقت .... ودمتم (اكشخ (h) )

<HTML>

<HEAD>

<title>ONE</title>

<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">

<meta name="CODE_LANGUAGE" Content="C#">

<meta name="vs_defaultClientScript" content="JavaScript">

<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">

<script language="javascript">

function Check(x)

{

if(x.RD[1].checked==true)

{

if( confirm("Are you sure that you want to REJECT !!") )

{

x.action="Home.aspx"

document.Form1.submit();

}

}

else

if(x.RD[0].checked==true)

{

x.action ="NextStep.aspx"

x.submit();

}

}

</script>

</HEAD>

<body MS_POSITIONING="GridLayout">

<form id="Form1" method="post" runat="server" onsubmit="return Check(this)">

Accept<input type="radio" name="RD" checked><br>

Reject<input type="radio" name="RD"><br>

<input type="submit" value="NEXT">

</form>

</body>

</HTML>

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

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