Java script

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Java script

Post by pinehead18 »

I have a javascript script wich opens another window when i click on a link. HOwever this script requies the browser to also re-load the page the script was one. So when i use it on my search function it looses its search vars and resets the search.

Is their anyway to write this script without it requring the re-fresh of the page the link is one. Does anybody have any examples of this code (i am not a java script coder but it was the only script i managed to find)

Thank you
Anthony
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Store the search results in a $_SESSION variable, when the page reloads, check if that $_SESSION variable is set, and if so, use it. If not, not. :)
szms
Forum Contributor
Posts: 101
Joined: Thu Jun 26, 2003 12:23 pm

Post by szms »

Have you ever seen this kind of format when some information is visble when the mouse pointer points to a link without using title. If you have never seen seen then never mind.
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

Wrong topic. I believe you wanted to reply to this topic, szms:
viewtopic.php?p=84821
szms
Forum Contributor
Posts: 101
Joined: Thu Jun 26, 2003 12:23 pm

Post by szms »

WHAT DO YOU MEAN?
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

patrikG wrote:Wrong topic. I believe you wanted to reply to this topic, szms:
viewtopic.php?p=84821
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

pinehead, you'd really have to post the code. But, I suspect all of your problems can be solved by just adding "return false" to the end of your function call:

<a href="asdv" onclick="popup('whatever'); return false">click</a>
szms
Forum Contributor
Posts: 101
Joined: Thu Jun 26, 2003 12:23 pm

Post by szms »

I tried the following code and it works perfectly. I want to show a default info: please move the mouse on the highlited text. And whenever the mouse in on the high lighted text the description of the respective topic will be shown instead of the default info. How to do that according to my code.

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?> 
<!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"> 
<head> 
<title>Untitled Document</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<script language="JavaScript" type="text/JavaScript"> 
<!-- 
function MM_reloadPage(init) &#123;  //reloads the window if Nav4 resized 
  if (init==true) with (navigator) &#123;if ((appName=="Netscape")&&(parseInt(appVersion)==4)) &#123; 
   document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; &#125;&#125; 
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload(); 
&#125; 
MM_reloadPage(true); 
function MM_findObj(n, d) &#123; //v4.01 
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) &#123; 
   d=parent.frames&#1111;n.substring(p+1)].document; n=n.substring(0,p);&#125; 
  if(!(x=d&#1111;n])&&d.all) x=d.all&#1111;n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms&#1111;i]&#1111;n]; 
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers&#1111;i].document); 
  if(!x && d.getElementById) x=d.getElementById(n); return x; 
&#125; 
function MM_showHideLayers() &#123; //v6.0 
  var i,p,v,obj,args=MM_showHideLayers.arguments; 
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args&#1111;i]))!=null) &#123; v=args&#1111;i+2]; 
   if (obj.style) &#123; obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; &#125; 
   obj.visibility=v; &#125; 
&#125; 
//--> 
</script> 
</head> 
<body> 
<div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; left: 52px; top: 12px; background-color: #6699CC; layer-background-color: #6699CC; border: 1px none #000000;" onmouseover="MM_showHideLayers('Layer2','','show')" onmouseout="MM_showHideLayers('Layer2','','hide')"> 
  <p>This is something</p> 
  <p>(move mouse over this box to show the other box)</p> 
</div> 
<div id="Layer2" style="position:absolute; width:200px; height:115px; z-index:2; left: 52px; top: 136px; visibility: hidden; background-color: #CCCCCC; layer-background-color: #CCCCCC; border: 1px none #000000;"> 
  <p>this is something else</p> 
  <p>(this appears if you hover your mouse over the top box, and disappears when 
   moving the mouse away)</p> 
</div> 
<div id="Layer3" style="position:absolute; width:200px; height:115px; z-index:3; left: 276px; top: 12px; background-color: #0099CC; layer-background-color: #0099CC; border: 1px none #000000;" onmouseover="MM_showHideLayers('Layer4','','show')" onmouseout="MM_showHideLayers('Layer4','','hide')"> 
  <p>this is another something</p> 
  <p>(move mouse over and another box appears, not bugging the first one)</p> 
</div> 
<div id="Layer4" style="position:absolute; width:200px; height:115px; z-index:4; left: 277px; top: 139px; background-color: #00FFFF; layer-background-color: #00FFFF; border: 1px none #000000; visibility: hidden;">this 
  is the box that appears if you move the mouse over the above box. move mouse 
  away and this one disappears again.</div> 
</body> 
</html>
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

why are you trying so hard to hijack this thread?
Post Reply