/    Sign up×
Community /Pin to ProfileBookmark

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>&#1570;&#1586;&#1605;&#1608;&#1606; &#1570;&#1606;&#1604;&#1575;&#1610;&#1606;</title>
<script type=”text/javascript” language=”javascript”>
function LoadQs(CourseParam)
{

var Title = document.getElementById(‘TitleCell’);

if (CourseParam == 0)
Title.innerHTML = “&#1608;&#1610;&#1688;&#1608;&#1575;&#1604; &#1576;&#1610;&#1587;&#1610;&#1603;”;
else if (CourseParam == 1)
Title.innerHTML = “&#1608;&#1610;&#1688;&#1608;&#1575;&#1604; &#1576;&#1610;&#1587;&#1610;&#1603;”;

return;
}
</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8;charset=utf-8″/>
<meta name=”keywords” content=”&#1605;&#1580;&#1575;&#1586;&#1740; &#1548; &#1570;&#1605;&#1608;&#1586;&#1588; &#1548; &#1593;&#1604;&#1605;&#1740;, &#1570;&#1586;&#1605;&#1608;&#1606;” />
<meta name=”keywords” content=”portal , Virtual Learning , Virtual , Education “/>
<link href=”Style.css” type=”text/css” rel=”stylesheet” />
</head>
[/CODE]

Event that changes inner html or text:

[CODE]
<li><a href=”” onClick=”LoadQs(0)”>&#1605;&#1576;&#1575;&#1606;&#1610; &#1588;&#1576;&#1603;&#1607;</a></li>
[/CODE]

You can test it online at this address:
http://dotnetdeveloper.gigfa.com/Exam.htm
click on links located at middle of page:
&#1605;&#1576;&#1575;&#1606;&#1610; &#1588;&#1576;&#1603;&#1607;
&#1608;&#1610;&#1688;&#1608;&#1575;&#1604; &#1576;&#1610;&#1587;&#1610;&#1603;

Any help appreciated!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERJan 10.2010 — What does your <form ...> tag content look like?
Copy linkTweet thisAlerts:
@Sterling_IsfineJan 10.2010 — 
Event that changes inner html or text:
[CODE]
<li><a href="" onClick="LoadQs(0)">&#1605;&#1576;&#1575;&#1606;&#1610; &#1588;&#1576;&#1603;&#1607;</a></li>
[/CODE]
[/QUOTE]


Try it like this:
[CODE]
<li><a href="[b]#[/b]" onClick="LoadQs(0);[B]return false;[/B]">&#1605;&#1576;&#1575;&#1606;&#1610; &#1588;&#1576;&#1603;&#1607;</a></li>
[/CODE]
Copy linkTweet thisAlerts:
@jsNovice2010authorJan 11.2010 — 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.
Copy linkTweet thisAlerts:
@Sterling_IsfineJan 11.2010 — 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.[/QUOTE]


The handler itself must return false. If your function returns false you could just have:[CODE]onClick="return LoadQs(0)"[/CODE]
×

Success!

Help @jsNovice2010 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...