עבור לתוכן
View in the app

A better way to browse. Learn more.

HWzone

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

שתי כפתורי submit עם אותו שם- JAVASCRIPT

Featured Replies

פורסם

שלום.

יש לי טופס עם שתי כפתורי submit שניהם בעלי אותו שם submit - אבל כל אחד עם ערך שונה.

אני מעוניין להשאיר את שתי הכפתורים עם אותו שם (בשביל עיבוד בPHP) אבל לפני שאני שולח את הטופס לעיבוד בPHP אני רוצה

לברר בJavascript על איזה כפתור המשתמש לחץ.

ניסיתי לעשות בדיקה: (בפונקציה שמופעלת בonsubmit של הטופס)

if document.form1.submit.value == 'value1'

אבל זה לא עובד- ניסיתי להוסיף עוד שדה של hidden (נגיד בשם:bu_value )שבonclick של הכפתורים מופעלת הפונקציה:

document.form1.bu_value.value = this.value

ואז לבדוק בפונקציה הראשונה מה הערך של השדה hidden. אבל זה גם כן לא הלך.

יש הצעות?

פורסם

http://www.codingforums.com/showpost.php?p=156384&postcount=6


function validateForm(oForm){
if (cancelAction) {
location.href="somepage.htm";
return false;
}
//continue here
}
...
<form name="myForm" action="myPage" onsubmit="return validateForm(this);">
<input type="submit" name="add" value="Add this" onclick="cancelAction=false">
<input type="submit" name="cancel" value="Cancel this" onclick="cancelAction=true">

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.