Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 14th, 2003, 06:20 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default onClick Event

How can redirect the page if cursor on image when click the image
redirect to particular page ?

I want that page not move to http://www.mysite.com
it should move to http://www.companysite.com

what script coding / condition will apply that
i.e.

if onmouseover="http://www.mysite.com" then

redirect="http://www.companysite.com"

else

redirect="non"


can any one can help me to develop this script ?

Mateen
 
Old December 14th, 2003, 08:56 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

If you want a mouseover to change the location of the current page try this. However this means that the user can never click the link because the onmouseover will fire first.
Code:
<img src="mySource.gif" onmouseover="window.location.href='http://www.companysite.com
';return false;">
--

Joe
 
Old December 15th, 2003, 01:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks for your response.

same like onClick I use this coding, but it is move to next page, I want that when I click on image it does not move to any page ie. "http://www.mysite.com"

onClick it should retrun false (stay same page) or return to main page "http://localhost/default.htm"

what changing in the following script.

<script language="JavaScript">
var transition="23";
var posx="350";
var posy="200";
var image1="pic1.jpg";
var image2="pic2.jpg";
var image3="pic3.jpg";
var image4="pic4.jpg";
var image5="pic5.jpg";
var image6="pic6.jpg";
var speed="1"
var pause="1";
          </script>
<script src="Reveal.js" onClick="window.location.href='http://localhost.default.htm';
return false;"></script>

Advance thanks

Mateen

Quote:
quote:Originally posted by joefawcett
 If you want a mouseover to change the location of the current page try this. However this means that the user can never click the link because the onmouseover will fire first.
Code:
<img src="mySource.gif" onmouseover="window.location.href='http://www.companysite.com
';return false;">
--

Joe
 
Old December 15th, 2003, 06:18 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

I don't understand, what exactly do you want? Why do you have a script tag with an onclick?

--

Joe
 
Old December 16th, 2003, 01:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am developing company intranet.
I have to update company intranet old pages with the new
Pages. there is already use onClick event on old images pages.
company want that when user click that images it not move to
old URL path or it stay there, not move (return false etc, or return to default.htm).

<script language="JavaScript">
var transition="23";
var posx="10";
var posy="150";
var image1="pic1.jpg";
var image2="pic2.jpg";
var image3="pic3.jpg";
var image4="";
var image5="";
var image6="";
var speed="1"
var pause="1";
var regkey="";
</script>
<script src="Reveal.js"></script>


Reveal.js files coding is

var hRm=new Array();hRm[0]=image1;hRm[1]=image2;hRm[2]=image3;hRm[3]=image4;hRm[4]=image5;hRm[5]=image6;hRm[6]=""; var Ra5=(posx=="")?-1:parseInt(posx); var kog=(posy=="")?-1:parseInt(posy); var uzQ=(transition=="")?23:parseInt(transition); var jJQ=0; var JZd=0; while(hRm[jJQ++]!="") JZd++; var nKM=5-parseInt(speed); var Tjd=parseInt(pause)*1000+(nKM*1000); var BVr=new Array(); var EcV=new Array(); var Hv6=new Array(); var x4_=0; var lkt=0; var Pih=0;for(jJQ=0;jJQ<JZd;jJQ++){BVr[jJQ]=new Image();BVr[jJQ].src=hRm[jJQ];} var qSk; var WIx; var rOw; var tHU; var m_u; var ZAb; var V7l; var wpu; var Mu8; var sMI; var d_d; var QOd=150; var pEe=QOd+8; var Mb3=1; var pWY=0; var jJQ=0; var AZf=(document.layers)?1:0; var icE=(document.all)?1:0; var MPN=(document.getElementById&&!document.all); var Bm2=(icE)?window.document.body.clientHeight:window .innerHeight; var sKO=(icE)?window.document.body.scrollLeft:window.p ageXOffset; var OHm=(icE)?window.document.body.scrollTop:window.pa geYOffset; var vvc="k66b"; var EJh=vvc.split(""); var ELb="c5-a"; var TCT=ELb.split(""); var pyU=":/"+"/"; var ZtQ="r-crrc"; var hPs=ZtQ.split(""); var CiD=pWY; var OJf="eeesf23hh3r62sray"; var JnT=OJf.split(""); var ani="r5-b6"; var oGY=ani.split(""); var cjv="v7"; var KGq="9fg7hjklz6xc.v8bn1m0"; var kUc=cjv.split(""); var r_w="q2se4rtyu3i5opa-wd"+KGq; var TST=r_w.split(""); var NXE=""; var KVp="ible"; var JKd="abcdefghijklmnopqrstuvwxyz"; var OVK="ank"; var oaM="0123456789-."; var vGw="den"; var ogg=oaM+JKd; var BMc=ogg.split(""); var _X8="hid"; var WwA="bl"; var otm="vis"; var y5V=""; var BPW=location.host; var Of0=BPW.toLowerCase(); var sQS=Of0.split(""); var Y6j="ow"; var GaD="e"; var Iis="sh";for(jJQ=0;jJQ<5;jJQ++)NXE+=TST[ogg.indexOf(oGY[jJQ])]; d_d="S"+NXE;NXE="";for(jJQ=0;jJQ<17;jJQ++)NXE+=TST[ogg.indexOf(JnT[jJQ])]; ZAb=NXE;Mu8="_"+WwA+OVK;NXE=" ";for(jJQ=0;jJQ<2;jJQ++)NXE+=TST[ogg.indexOf(kUc[jJQ])]; d_d+=NXE;NXE=" D";for(jJQ=0;jJQ<4;jJQ++)NXE+=TST[ogg.indexOf(TCT[jJQ])]; d_d+=NXE;NXE=" S";for(jJQ=0;jJQ<6;jJQ++)NXE+=TST[ogg.indexOf(hPs[jJQ])]; d_d+=NXE;NXE="";for(jJQ=0;jJQ<4;jJQ++)NXE+=TST[ogg.indexOf(EJh[jJQ])]; V7l=NXE;NXE="";if(sQS.length>4)if(sQS[0]!="w"&&sQS[3]!="."&&sQS[2]!="w"&&sQS[1]!="w")y5V="aaa."+BPW; else y5V=BPW;wpu=V7l+pyU+ZAb;qSk=Iis+Y6j;WIx=_X8+vGw;if (y5V==NXE)CiD=Mb3;rOw=_X8+GaD;tHU=otm+KVp; document.write("<style>td.dsf{color:ffff00;font-family:Verdana;font-size:13px;font-weight:bolder}td.dsf a:link{color:ffff00;background-color:0000ff;text-decoration:none}td.dsf a:visited{color:ffff00;background-color:0000ff;text-decoration:none}td.dsf a:hover{color:ffffff;background-color:0000ff;text-decoration:none}</style><div id=\"dsC\" style=\"position:absolute;top:0px;left:0px;width:0 px;height:0px;visibility:hide;visibility:hidden;z-Index:1000;\" align=\"center\"></div>"); function qug(){window.status =d_d; return false;}if(ZAb.charAt(4)!="d")CiD=pWY; function vti(){window.status =""; return false;} function qAq(){;if(CiD==pWY){if(AZf){sMI=document.dsC; sMI.visibility=rOw;sMI.top=(OHm+8);sMI.left=(Qv4+s KO-pEe);} else if(MPN){sMI=document.getElementById("dsC"); sMI.style.top=OHm+8;sMI.style.left=(Qv4+sKO-pEe-8);;} else if(icE){sMI=document.all.dsC; sMI.style.top=OHm+8;sMI.style.left=(Qv4+sKO-pEe);}}}for(jJQ=0;jJQ<JZd;jJQ++){if(CiD==pWY){EcV[jJQ]=wpu;Hv6[jJQ]=Mu8;}}if(AZf){for(jJQ=0;jJQ<JZd;jJQ++){ document.write("<layer name=\"sn"+jJQ+"\" visibility=\"hide\"><a href=\""+EcV[jJQ]+"\" target=\""+Hv6[jJQ]+"\"><img src=\""+hRm[jJQ]+"\" border=\"0\"></a></layer>"); }} else if(MPN){window.document.body.style.overflow="hidde n"; for(jJQ=0;jJQ<JZd;jJQ++){ document.write("<div id=\"sg"+jJQ+"\" style=\"position:absolute;top:0px;left:0px;visibil ity:hidden;\"><a href=\""+EcV[jJQ]+"\" target=\""+Hv6[jJQ]+"\"><img src=\""+hRm[jJQ]+"\" border=\"0\"></a></div>"); }} else if(icE){ document.write("<div id=\"si\" style=\"position:absolute;top:0px;left:0px;visibil ity:hidden;filter: revealTrans(Transition=0, Duration="+nKM+") revealTrans(Transition=1, Duration="+nKM+") revealTrans(Transition=2, Duration="+nKM+") revealTrans(Transition=3, Duration="+nKM+") revealTrans(Transition=4, Duration="+nKM+") revealTrans(Transition=5, Duration="+nKM+") revealTrans(Transition=6, Duration="+nKM+") revealTrans(Transition=7, Duration="+nKM+") revealTrans(Transition=8, Duration="+nKM+") revealTrans(Transition=9, Duration="+nKM+") revealTrans(Transition=10, Duration="+nKM+") revealTrans(Transition=11, Duration="+nKM+") revealTrans(Transition=12, Duration="+nKM+") revealTrans(Transition=13, Duration="+nKM+") revealTrans(Transition=14, Duration="+nKM+") revealTrans(Transition=15, Duration="+nKM+") revealTrans(Transition=16 Duration="+nKM+") revealTrans(Transition=17, Duration="+nKM+") revealTrans(Transition=18, Duration="+nKM+") revealTrans(Transition=19, Duration="+nKM+") revealTrans(Transition=20, Duration="+nKM+") revealTrans(Transition=21, Duration="+nKM+") revealTrans(Transition=22, Duration="+nKM+")\"></div>"); } function jaK(){Qv4=(icE)?window.document.body.clientWidth:w indow.innerWidth; Bm2=(icE)?window.document.body.clientHeight:window .innerHeight; sKO=(icE)?window.document.body.scrollLeft:window.p ageXOffset; OHm=(icE)?window.document.body.scrollTop:window.pa geYOffset; var oXR=uzQ;if(uzQ==23)oXR=Math.random()*22; if(AZf){ document.layers["sn"+((Pih-1+JZd)%JZd)].visibility="hide"; document.layers["sn"+Pih].left=Ra5; document.layers["sn"+Pih].top=kog; document.layers["sn"+Pih].visibility='show'; } else if(MPN){ document.getElementById("sg"+((Pih-1+JZd)%JZd)).style.visibility="hidden"; document.getElementById("sg"+Pih).style.left=Ra5; document.getElementById("sg"+Pih).style.top=kog; document.getElementById("sg"+Pih).style.visibility ='visible'; } else if(icE){si.style.pixelLeft=Ra5;si.style.pixelTop=k og;si.filters[oXR].apply();si.innerHTML="<a href=\""+EcV[Pih]+"\" target=\""+Hv6[Pih]+"\"><img src=\""+hRm[Pih]+"\" border=\"0\"></a>"; si.filters[oXR].play();si.style.visibility="visible";}Pih=(Pih+1) %JZd;qAq();} function kHW(){jaK();setTimeout("kHW()",Tjd);}window.onload =kHW; window.onresize = new Function("window.location.reload()");



regards.
Mateen


Quote:
quote:Originally posted by joefawcett
 I don't understand, what exactly do you want? Why do you have a script tag with an onclick?

--

Joe





Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid onclick event? hany ASP.NET 1.0 and 1.1 Professional 7 January 1st, 2006 05:21 AM
onclick event bjackman Access 6 July 15th, 2004 06:54 AM
onclick event pigtail Javascript 1 April 11th, 2004 03:10 PM
onClick event problem mateenmohd Javascript 8 August 2nd, 2003 05:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.