Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open page when link hover 1

Status
Not open for further replies.

willgr

ISP
May 12, 2007
3
GB
Hi,

I was wondering if it is possible to use JavaScript for this function:

- User hovers the mouse over a link

- JavaScript submits the link as a query to my database

- Database search result appears in i-frame on same page

Hope I described it OK.

Best Regards,

Will
 
Hi

Code:
<html>
<head>
<style>a { background-color: silver; }</style>
<script>
window.onload=function() {
a=document.getElementsByTagName('a')
for (i=0;i<a.length;i++) a[i].onmouseover=function() { glossary.location='/cgi-bin/glossary.sh?'+this.innerHTML }
}
</script>
</head>
<body>
This page was made with <a href="[URL unfurl="true"]http://w3c.org/MarkUp/">HTML</a>[/URL] and <a href="[URL unfurl="true"]http://w3c.org/Style/CSS/">CSS</a>.[/URL]
The glossary search is powered by <a href="[URL unfurl="true"]http://gnu.org/software/bash/">Bash</a>.[/URL]
<hr><iframe name="glossary"></iframe>
</body>
</html>
Code:
#!/usr/bin/bash
echo -e "Content-type: text/plain\r\n\r";
grep -i "$QUERY_STRING" glossary.txt ||
echo "'$QUERY_STRING' not found in the glossary"
Code:
CSS	Cascading Style Sheet
HTML	HyperText Markup Language
BASH	Bourne-Again SHell
Tested with FireFox 2.0.0.3, SeaMonkey 1.1, Opera 9.20 and Explorer 6.

Feherke.
 
Hi, Thanks for you feedback. I get this error:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
................
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request."


When looking into the error logs, I get:


"error: file has no execute permission:"


I have tried changing the various chmod permissions (e.g. 755 and 777) but it seems not to work. Thanks for all your help so far but do you know what causes this kind of problem?
 
Hi

The code for you was the JavaScript one. The CGI is just to show what I used. Anyway you did not asked for and did not gave detail about your server configuration.

I used LightTPD running in CygWin. It has [tt]mod_cgi[/tt] loaded and is configured for "old cgi-bin behavior of apache" according to the [tt]mod-cgi[/tt] documentation. The files are located in the document root as follows, with permissions for the web server's user :

[tt]/
|- any.htm [gray]r--[/gray]
+- cgi-bin [gray]r-x[/gray]
|- glossary.sh [gray]r-x[/gray]
+- glossary.txt [gray]r--[/gray][/tt]


Feherke.
 
Yes. I've adapted the script. Thanks for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top