www.webdeveloper.com
Results 1 to 5 of 5

Thread: Can u help me with my JS project please?

  1. #1
    Join Date
    Jan 2010
    Posts
    2

    Can u help me with my JS project please?

    I used JS in a html document to change inner html of a table cell but when i click link, only one moment it changes and then the page returns to its previous state like it was loded first!!! i uploded files on internet but problem not solved.
    this happens at Opera and Firefox but IE7 works well and changes are stable.

    JS code i used:
    Code:
    <html>
    <head>
    <title>آزمون آنلاين</title>
    <script type="text/javascript" language="javascript">
    function LoadQs(CourseParam)
    {
    
    var Title = document.getElementById('TitleCell');
    
    if (CourseParam == 0)
    Title.innerHTML = "ويژوال بيسيك";
    else if (CourseParam == 1)
    Title.innerHTML = "ويژوال بيسيك";
    
    return;
    }
    </script>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8;charset=utf-8"/>
    <meta name="keywords" content="مجازی ، آموزش ، علمی, آزمون" />
    <meta name="keywords" content="portal , Virtual Learning , Virtual , Education "/>
    <link href="Style.css" type="text/css" rel="stylesheet" />
    </head>

    Event that changes inner html or text:
    Code:
    <li><a href="" onClick="LoadQs(0)">مباني شبكه</a></li>
    You can test it online at this address:
    http://dotnetdeveloper.gigfa.com/Exam.htm
    click on links located at middle of page:
    مباني شبكه
    ويژوال بيسيك

    Any help appreciated!

  2. #2
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,350

    Question Question ...

    What does your <form ...> tag content look like?

  3. #3
    Join Date
    Jun 2007
    Posts
    667
    Quote Originally Posted by jsNovice2010 View Post
    Event that changes inner html or text:
    Code:
    <li><a href="" onClick="LoadQs(0)">مباني شبكه</a></li>
    Try it like this:
    Code:
    <li><a href="#" onClick="LoadQs(0);return false;">مباني شبكه</a></li>
    Y_U U_G_A_E_U_ B_S_A_D_

  4. #4
    Join Date
    Jan 2010
    Posts
    2
    Hi sterling,
    Your suggestion worked. thank you, but can u tell me why this happens? I've used return false at the end of my Func already.

  5. #5
    Join Date
    Jun 2007
    Posts
    667
    Quote Originally Posted by jsNovice2010 View Post
    Hi sterling,
    Your suggestion worked. thank you, but can u tell me why this happens? I've used return false at the end of my Func already.
    The handler itself must return false. If your function returns false you could just have:
    Code:
    onClick="return LoadQs(0)"
    Y_U U_G_A_E_U_ B_S_A_D_

Thread Information

Users Browsing this Thread

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

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



Recent Articles