JavaCsript function call not working with <a href="">

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mianmajidali
Forum Commoner
Posts: 30
Joined: Tue Dec 01, 2009 8:05 pm

JavaCsript function call not working with <a href="">

Post by mianmajidali »

hi to all,
i m giving below the code of my web page, here is javascript function not working with <a href="javascript:functioncall()">
Please guide me.
thanks alot
--------------------------------------------------------------------------------------------------------------
<?
session_start();
session_register('s_id');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<link rel="stylesheet" type="text/css" href="global.css" title="os-co.biz"/>
<title>Untitled</title>
<link rel="icon" href="images/os-co.png">
<script src="global.js" type="text/javascript"></script>

</head>

<body>
<div class="main">
<div class="header">
<img src="images/home-header.jpg"/>
</div>
<div class="top-nev">
<table cellspacing="0" width="990" align="center">
<tr height="41" align="center">
<td width="11%"><a href="">Home</a></td>

<td width="16%"><a href="mission.html">Mission Statement</a></td>

<td width="11%"><a href="processing.html">Processing</a></td>

<td width="11%"><a href="products.html">Products</a></td>

<td width="11%"><a href="contacts.html">Contact us</a></td>

<td width="11%"><a href="query.html">Query</a></td>

<td width="11%"><a href="site_map.html">Site Map</a></td>


<td width="11%">
<?
if($_SESSION['s_id']!=1122)
{
?>

<a href="javascript:showDiv()">Login</a> ___This is not working

<span id="main" style="visibility:hidden">
<span id="hideshow">
<span class="front">
<form name="form1" method="post" action="check_login.php">
<table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr valign="top">
<td align="left"><img src="images/login-icon.jpg"/></td>
<td>&nbsp;</td>
<td align="right"><a href="javascript:hideDiv()">Close</a></td>
</tr>

<tr align="center" valign="top">
<td colspan="3" ><strong> </strong></td>
</tr>
<tr align="center" valign="top">
<td colspan="3">&nbsp;</td>
</tr>
<tr align="center" valign="top">
<td width="78" align="right">Username</td>
<td width="6">&nbsp;</td>
<td width="294"><input name="name" type="text" id="name"></td>
</tr>
<tr align="center" valign="top">
<td align="right">Password</td>
<td>&nbsp;</td>
<td><input name="pass" type="password" id="pass"></td>
</tr>
<tr align="center" valign="baseline">
<td colspan="3" align="center">
<input type="submit" name="Submit" value="Login" onlclick="javascript:hideDiv()"> </td>
</tr>
</table>
</form>
</span>
</span>
</span>

<?

}
else
{
?>

<a href="logout.php">Logout</a>
</td>
<td width="13%">
<a href="data.php">DataBase</a>
</td>
<?
}
?>
</tr>
</table>
</div>
</body>
</html>
mianmajidali
Forum Commoner
Posts: 30
Joined: Tue Dec 01, 2009 8:05 pm

Re: JavaCsript function call not working with <a href="">

Post by mianmajidali »

when i disable the CSS link, this link does work, if CSS link enable...it does not work.
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: JavaCsript function call not working with <a href="">

Post by AbraCadaver »

Your page is not valid HTML or XHTML. You self close some tags but not all, you have tags that should be in the head but are not, yada yada. If you clean it up it may work.

Also, what's in the style sheet?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
User avatar
SimpleManWeb
Forum Commoner
Posts: 57
Joined: Wed Dec 30, 2009 4:15 pm
Location: New Hampshire, USA

Re: JavaCsript function call not working with <a href="">

Post by SimpleManWeb »

You need to provide some more info before we can really help you with this. Can you post your Javascript file? Do you have this site live somewhere? I copied and pasted your code onto my server, created a global.js file and wrote a function called "showDiv" that simply alerted 'Hello' and it worked without error. My guess is that the issue is being caused by your javascript code, not your HTML or CSS.
Post Reply