Page 1 of 1

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

Posted: Tue Dec 29, 2009 10:57 am
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>

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

Posted: Tue Dec 29, 2009 11:16 am
by mianmajidali
when i disable the CSS link, this link does work, if CSS link enable...it does not work.

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

Posted: Tue Dec 29, 2009 1:34 pm
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?

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

Posted: Wed Dec 30, 2009 4:46 pm
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.