Results 1 to 2 of 2

Thread: script adding symbole with no reason

  1. #1
    Join Date
    Feb 2011

    script adding symbole with no reason


    I have written the upper page.

    It is long but the script is very short and simple.
    It is in the bottom of the file:
    HTML Code:
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>       <script type="text/javascript">
               function changepage(page){
                    // Create a variable to refer to our request object:
                    var xmlhttp;
                    if (window.XMLHttpRequest){
                             // code for IE7+, Firefox, Chrome, Opera, Safari
                            xmlhttp=new XMLHttpRequest();
                            // code for IE6, IE5
                            xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                      xmlhttp.onreadystatechange = function(){
                          // This code will be executed each time the readyState changes
                           if (xmlhttp.readyState==4 && xmlhttp.status==200){
                                // This code will be executed if our request
                                // is completed
                      var request='?';
                                             $('#next-page').on('click',changepage( 2 )); 
    Now you can see in the bottom of the page the symbol
    2 ?>
    but you wont find them in the source.

    I have searched for them, they are not there.
    So it must be the script that did.

    But as far as I understand it, creating listener should change nothing in the content of the page until the event happened.

    But you see this symbol before you clicked on anything.

    So where is my mistake?

    What in my code is wrong?

  2. #2
    Join Date
    Feb 2011
    well I know where is the problem.
    the following line:
     $('#next-page').on('click',changepage( 2 ));
    It run the function changepage even if I don't click on the element with the id nextpage.
    Why is that?

    I mean is suppose to run the function only when I click the nextpage element.

    Why it is run the function immediatly after the page finished to load?
    Last edited by programAngel; 03-11-2012 at 02:47 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center