PDA

View Full Version : ASP / Javascript


chinnababu
06-10-2003, 09:49 AM
I display ASP records like the following,
when I mouseOver on ID,
I want to POPUP a new window
displaying that record's, ADDRESS, CITY, STATE, ZIP, COUNTRY, etc..
I need to do this in Javascript.
Any code help will be helpful. Thanks.

ID NAME PHONE
1 Bob 8008008888
2 Jack 9009009999
3 Liz 6666666666
4 Bill 4444444444
5 Ron 1111111111

amir
06-10-2003, 12:18 PM
personally i thing poping up a new window on mouseover is wrong.

here is how i'd go about it.

add this to the head section of the page

function cursor(text)
{
trail.innerHTML=text
trail.style.visibility="visible"
trail.style.position="absolute"
trail.style.left=event.clientX+10
trail.style.top=event.clientY
}

function hidecursor()
{
trail.style.visibility="hidden"
}
</script>
<style>
body
{
background:#FFFFFF;
color:#191970;
font-weight:bold;
}
a{color:#FF8C00;}
</style>

now, say the "ID" is displayed in a <th> tag of a table.
so in that <th>:

<th onmouseover="cursor("whatever you need to diplay")" onmouseout="hidecursor()">ID</th>

then at the end of the document:

<div id="trail" style="visibility:hidden" >Hello</div>
</body>
</html>

try it out, if you stiil want to open a new window the basic syntaxt is :

<script language=javascript>
function openwindow()
{
window.open("http://www.cisco.com")
}
</script>

chinnababu
06-10-2003, 12:37 PM
I am looking for,
I have to access database data using ODBC,
through ASP. When I mouseover or onClick, grab that Id,
basing on that Id, get and display rest of the data.

Thanks.

Angelika
06-10-2003, 01:44 PM
play with this code

1stPage
<%

strSQL="select ID,NAME,PHONE from Table_Name "
rs.open strSQL,conn
CustomerArray=lors.GetRows
lors.close
%>

<body>

<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="33%">ID</td>
<td width="33%">Name</td>
<td width="34%">Phone</td>
</tr>


<%
For i=0 to Ubound(CustomerArray,2)
CustomeID=CustomerArray(0,i)
CustomeName=CustomerArray(1,i)
CustomePhone=CustomerArray(2,i)

%>
<tr>
<td width="33%"><a href="test1.asp?CustomerID=<%=CustomeID%>"
onmouseover="window.open ('test1.asp?CustomeID=<%=CustomeID%>', 'newWin', 'scrollbars=yes,status=yes,width=400,height=400');return true">
<%=CustomeID%></a>
</td>
<td width="33%"><%=CustomeName%></td>
<td width="34%"><%=CustomePhone%></td>
</tr>

<% Next%>
</table>



'***test1-your new window*****
<%
CustomeID=request.QueryString("CustomeID")
strSQL="select * from table_name Where ID="&CustomeID&""
rs.open strSQL,loconn
ADDRESS=rs("ADDRESS")
CITY=rs("CITY")
STATE=rs("STATE")
ZIP=rs("ZIP")
COUNTRY=rs("COUNTRY")
rs.close

'***You can writethis code into body********
response.write ADDRESS & "<BR>"
response.write CITY & "<BR>"
......
.......
%>
'into body:

<BODY onMouseOut="window.close()">