Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7532675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:31:21+00:00 2026-05-30T05:31:21+00:00

I’m having some javascript conflict problem, and hope someone can help me out. I’m

  • 0

I’m having some javascript conflict problem, and hope someone can help me out. I’m creating a page using a photoslide, so there are 3 divs on the page eg div id #item 1, 2 and 3. When each div is clicked, the page will goes to the next like a photoslide demo.

On my second div item2, there are 3 buttons, when each button is clicked, an email will be sent to an appropriate department eg music or math@example.com and then the page should slide to the next div #item3.

My problem is that I can either make the email to be sent when a button is clicked but the slide is not working or the slide is working but the email is not sent, depending on where I place the a tag in the list in div item2 (before the form or after the form).

I will leave some of my code below, any suggestion to make the code better/working would be really appreciated. Please let me know if I need supply more info. Thanks.

this is the basic page structure

<div id="wrapper">
<div id="mask">
//div #item 1
<div id="item1" class="item">   
        <div class="content">   <a href="#item2" class="panel">Go</a>
        </div>
 </div>

//div #item 2 where the buttons are problem starts here
<div id="item2" class="item">   
<div class="content">   
<div id="back">
      <ul id="awesome-menu">

      <li>  
         <form action="" id="aboard" method="post">
         <input type="hidden" name="aboard" value="aboard" />
         </form>
         <a href="#item3" onclick="formSubmit('aboard')" id="aboard" class="panel">aboard</a>
         </li>  


         <li>
        <form action="" id="asian" method="post">
        <input type="hidden" name="asian" value="asian" />
        </form>
         <a href="#item3" onclick="formSubmit('asian')" id="asian" class="panel">Asian</a>
        </li>   

       <li>
      <form action="" id="national" method="post">
       <input type="hidden" name="national" value="national" />
      </form>
       <a href="#item3" onclick="formSubmit('national')" id="national" class="panel">National</a>
      </li> 

       </ul>

    </div>  
    </div>
</div>


//div #item 3
<div id="item3" class="item">
        <a name="item3"></a>
        <div class="content"><a href="#item1" class="panel"><img src="images/Thankyou_screen.jpg" alt="Thank you" /></a></div>
    </div>  
</div>
</div>

This is for the slide affect

<script>
$(document).ready(function() {

//get all link with class panel
$('a.panel').click(function () {

            //reset and highlight the clicked link
    $('a.panel').removeClass('selected');
    $(this).addClass('selected');

    //grab the current item, to be used in resize function
    current = $(this);

            //scroll it to the destination
    //$('#wrapper').scrollTo($(this).attr('href'), 800);     
    $('#wrapper').scrollTo($(this).attr('href'), 2000,{
        onAfter: function(id){
            if (id === '#item3'){
                setTimeout(function(){
                    $(id).find('.panel').click();
                }, 5000);
            }
        }
    });

            //cancel the link default behavior
    return false;
   });


//resize all the items according to the new browser size
$(window).resize(function () {

    //call the resizePanel function
    resizePanel();
 });

 });


function resizePanel() {

//get the browser width and height
width = $(window).width();
height = $(window).height();

//get the mask width: width * total of items
mask_width = width * $('.item').length;

//set the dimension
$('#wrapper, .item').css({width: width, height: height});
$('#mask').css({width: mask_width, height: height});

//if the item is displayed incorrectly, set it to the corrent pos
$('#wrapper').scrollTo($('a.selected').attr('href'), 0);

}

This is for sending the form

<script type="text/javascript">
function formSubmit(name)
{
      if (name == 'aboard') {
          document.getElementById("aboard").submit();
      } else if (name == 'asian') {
          document.getElementById("asian").submit();
      } else if (name == 'national') {
          document.getElementById("national").submit();
      } 

}
</script>


<?php

if(isset($_POST['aboard']))
{
$to      = 'xxx@site.com';
$subject = 'the subject_aboard';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


}



if(isset($_POST['asian']))
{
$to      = 'xxx@site.com';
$subject = 'the subject_Asian';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


}

if(isset($_POST['national']))
{
$to      = 'xxx@site.com';
$subject = 'the subject_National';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T05:31:22+00:00Added an answer on May 30, 2026 at 5:31 am

    Assuming that you are using jquery (based on the code you have listed) you could use ajax to call the email function without having to refresh/redirect the page (which is what happens when you submit the form right now)

    Here is an example:

    function aboardSubmit() {
        $.ajax({
            type: "POST",
            url: "example.php", // Change this to the path of your email script
            data: "aboard=aboard", // This is just an example, but you would fill it in with correct data
        });
    }
    

    Then in the html just remove the forms completely and place the following on your tags:

    onclick="aboardSubmit()"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I am reading a book about Javascript and jQuery and using one of the
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a jquery bug and I've been looking for hours now, I can't
Basically, what I'm trying to create is a page of div tags, each has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.