JavaScript - Modifying A Java Script.
Hi,
I am using this image rotation tool on my website but I would like to alter it slightly http://www.zurb.com/playground/orbit...y-image-slider See the small navigation dots under the images to select individual pages there are 4 of them (more if you add more images) - on 1 horizontal line. I would like to alter the code if possible so that the dots are in pairs going down the page (I wont bore you with the reason why) ie: o o o o o o o o etc The code the handles the dots is this: Code: // ================== // ! BULLET NAV // ================== //Bullet Nav Setup if(options.bullets) { var bulletHTML = '<ul class="orbit-bullets"></ul>'; orbitWrapper.append(bulletHTML); var bullets = orbitWrapper.children('ul.orbit-bullets'); for(i=0; i<numberSlides; i++) { var liMarkup = $('<li>'+(i+1)+'</li>'); if(options.bulletThumbs) { var thumbName = slides.eq(i).data('thumb'); if(thumbName) { var liMarkup = $('<li class="has-thumb">'+i+'</li>') liMarkup.css({"background" : "url("+options.bulletThumbLocation+thumbName+") no-repeat"}); } } orbitWrapper.children('ul.orbit-bullets').append(liMarkup); liMarkup.data('index',i); liMarkup.click(function() { stopClock(); shift($(this).data('index')); }); } setActiveBullet(); } //Bullet Nav Execution function setActiveBullet() { if(!options.bullets) { return false; } else { bullets.children('li').removeClass('active').eq(activeSlide).addClass('active'); } } The CSS for this is: Code: /* BULLET NAV ================================================== */ .orbit-bullets { position: absolute; z-index: 1000; list-style: none; bottom: 150px; left: 0%; margin-left: 0px; padding: 0; } .orbit-bullets li { float: left; margin-left: 5px; cursor: pointer; color: #999; text-indent: -9999px; background: url(bullets.png) no-repeat 4px 0; width: 13px; height: 12px; overflow: hidden; } .orbit-bullets li.active { color: #222; background-position: -8px 0; } .orbit-bullets li.has-thumb { background: none; width: 100px; height: 75px; } .orbit-bullets li.active.has-thumb { background-position: 0 0; border-top: 2px solid #000; } The image file for the small dots is this: I'm afraid I'm not a Java person at all and know little about it so I would be very grateful if you could help me out with it... if it's possible. Thanks. PP. Similar TutorialsHere is the style and js for my menu that I got from Dynamic Drive. I have it working as it is suppose to on my site. But I need my menus to have submenus and even have a couple of sub-submenus. Can someone help me with this. Code: YOffset=150; // no quotes!! XOffset=0; staticYOffset=30; // no quotes!! slideSpeed=20 // no quotes!! waitTime=100; // no quotes!! this sets the time the menu stays out for after the mouse goes off it. menuBGColor="black"; menuIsStatic="yes"; //this sets whether menu should stay static on the screen menuWidth=180; // Must be a multiple of 10! no quotes!! menuCols=2; hdrFontFamily="verdana"; hdrFontSize="2"; hdrFontColor="white"; hdrBGColor="#170088"; hdrAlign="left"; hdrVAlign="center"; hdrHeight="15"; linkFontFamily="Verdana"; linkFontSize="2"; linkBGColor="white"; linkOverBGColor="#FFFF99"; linkTarget="_top"; linkAlign="Left"; barBGColor="#FF0000"; barFontFamily="Verdana"; barFontSize="3"; barFontColor="white"; barVAlign="center"; barWidth=45; // no quotes!! barText="Menu Navigation"; // <IMG> tag supported. Put exact html for an image to show. /////////////////////////// // ssmItems[...]=[name, link, target, colspan, endrow?] - leave 'link' and 'target' blank to make a header ssmItems[0]=["Menu"] //create header ssmItems[1]=["About Our Diocese", "http://www.ptdiocese.org/about-us/about-us.shtml, ""] ssmItems[2]=["Parishes", "http://www.ptdiocese.org/parishes/parish.shtml",""] ssmItems[3]=["Schools", "http://www.ptdiocese.org/schools/schools.shtml", ""] ssmItems[4]=["Ministries", "http://www.ptdiocese.org/christian-formation/christian-formation.shtml", "_new"] ssmItems[5]=["Clergy and Religous", "http://www.ptdiocese.org/clergy-religious/clergy-religious.shtml", ""] ssmItems[6]=["Protecting God's Children", "http://www.ptdiocese.org/protecting-children/protecting-children.shtml", ""] ssmItems[7]=["For Those In Need", "http://www.ptdiocese.org/in-need/in-need.shtml", ""] ssmItems[8]=["Tribunal", "http://www.ptdiocese.org/tribunal/tribunal.shtml", ""] ssmItems[9]=["Contact Us"] //ssmItems[7]=["Tribunal", "http://www.ptdiocese.org", "", 1, "no"] //create two column row //ssmItems[8]=["Contact Us", "http://www.ptdiocese.org", "",1] ssmItems[10]=["External Links", "", ""] //create header ssmItems[11]=["Test", "http://www.javascriptkit.com", ""] ssmItems[12]=["Test", "http://www.freewarejava.com", ""] ssmItems[13]=["Test", "http://www.codingforums.com", ""] buildMenu(); //--> NS6 = (document.getElementById&&!document.all) IE = (document.all) NS = (navigator.appName=="Netscape" && navigator.appVersion.charAt(0)=="4") tempBar='';barBuilt=0;ssmItems=new Array(); function truebody(){ return (document.compatMode!="BackCompat")? document.documentElement : document.body } moving=setTimeout('null',1) function moveOut() { if ((NS6||NS)&&parseInt(ssm.left)<0 || IE && ssm.pixelLeft<0) { clearTimeout(moving);moving = setTimeout('moveOut()', slideSpeed);slideMenu(10)} else {clearTimeout(moving);moving=setTimeout('null',1)}}; function moveBack() {clearTimeout(moving);moving = setTimeout('moveBack1()', waitTime)} function moveBack1() { if ((NS6||NS) && parseInt(ssm.left)>(-menuWidth) || IE && ssm.pixelLeft>(-menuWidth)) { clearTimeout(moving);moving = setTimeout('moveBack1()', slideSpeed);slideMenu(-10)} else {clearTimeout(moving);moving=setTimeout('null',1)}} function slideMenu(num){ if (IE) {ssm.pixelLeft += num;} if (NS6) {ssm.left = parseInt(ssm.left)+num+"px";} if (NS) {ssm.left = parseInt(ssm.left)+num; bssm.clip.right+=num;bssm2.clip.right+=num;}} function makeStatic() { if (NS||NS6) {winY = window.pageYOffset;} if (IE) {winY = truebody().scrollTop;} if (NS6||IE||NS) { if (winY!=lastY&&winY>YOffset-staticYOffset) { smooth = .2 * (winY - lastY - YOffset + staticYOffset);} else if (YOffset-staticYOffset+lastY>YOffset-staticYOffset) { smooth = .2 * (winY - lastY - (YOffset-(YOffset-winY)));} else {smooth=0} if(smooth > 0) smooth = Math.ceil(smooth); else smooth = Math.floor(smooth); if (IE) bssm.pixelTop+=smooth; if (NS6) bssm.top=parseInt(bssm.top)+smooth+"px" if (NS) bssm.top=parseInt(bssm.top)+smooth lastY = lastY+smooth; setTimeout('makeStatic()', 1)}} function buildBar() { if(barText.indexOf('<IMG')>-1) {tempBar=barText} else{for (b=0;b<barText.length;b++) {tempBar+=barText.charAt(b)+"<BR>"}} document.write('<td align="center" rowspan="100" width="'+barWidth+'" bgcolor="'+barBGColor+'" valign="'+barVAlign+'"><p align="center"><font face="'+barFontFamily+'" Size="'+barFontSize+'" COLOR="'+barFontColor+'"><B>'+tempBar+'</B></font></p></TD>')} function initSlide() { if (NS6){ssm=document.getElementById("thessm").style;bssm=document.getElementById("basessm").style; bssm.clip="rect(0 "+document.getElementById("thessm").offsetWidth+" "+document.getElementById("thessm").offsetHeight+" 0)";ssm.visibility="visible";} else if (IE) {ssm=document.all("thessm").style;bssm=document.all("basessm").style bssm.visibility = "visible";} else if (NS) {bssm=document.layers["basessm1"]; bssm2=bssm.document.layers["basessm2"];ssm=bssm2.document.layers["thessm"]; bssm2.clip.left=0;ssm.visibility = "show";} if (menuIsStatic=="yes") makeStatic();} function buildMenu() { if (IE||NS6) {document.write('<DIV ID="basessm" style="visibility:hidden;Position : Absolute ;Left : '+XOffset+'px ;Top : '+YOffset+'px ;Z-Index : 20;width:'+(menuWidth+barWidth+10)+'px"><DIV ID="thessm" style="Position : Absolute ;Left : '+(-menuWidth)+'px ;Top : 0 ;Z-Index : 20;" onmouseover="moveOut()" onmouseout="moveBack()">')} if (NS) {document.write('<LAYER name="basessm1" top="'+YOffset+'" LEFT='+XOffset+' visibility="show"><ILAYER name="basessm2"><LAYER visibility="hide" name="thessm" bgcolor="'+menuBGColor+'" left="'+(-menuWidth)+'" onmouseover="moveOut()" onmouseout="moveBack()">')} if (NS6){document.write('<table border="0" cellpadding="0" cellspacing="0" width="'+(menuWidth+barWidth+2)+'px" bgcolor="'+menuBGColor+'"><TR><TD>')} document.write('<table border="0" cellpadding="0" cellspacing="1" width="'+(menuWidth+barWidth+2)+'px" bgcolor="'+menuBGColor+'">'); for(i=0;i<ssmItems.length;i++) { if(!ssmItems[i][3]){ssmItems[i][3]=menuCols;ssmItems[i][5]=menuWidth-1} else if(ssmItems[i][3]!=menuCols)ssmItems[i][5]=Math.round(menuWidth*(ssmItems[i][3]/menuCols)-1); if(ssmItems[i-1]&&ssmItems[i-1][4]!="no"){document.write('<TR>')} if(!ssmItems[i][1]){ document.write('<td bgcolor="'+hdrBGColor+'" HEIGHT="'+hdrHeight+'px" ALIGN="'+hdrAlign+'" VALIGN="'+hdrVAlign+'" WIDTH="'+ssmItems[i][5]+'" COLSPAN="'+ssmItems[i][3]+'"> <font face="'+hdrFontFamily+'" Size="'+hdrFontSize+'" COLOR="'+hdrFontColor+'"><b>'+ssmItems[i][0]+'</b></font></td>')} else {if(!ssmItems[i][2])ssmItems[i][2]=linkTarget; document.write('<TD BGCOLOR="'+linkBGColor+'" onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="'+ssmItems[i][5]+'px" COLSPAN="'+ssmItems[i][3]+'"><ILAYER><LAYER onmouseover="bgColor=\''+linkOverBGColor+'\'" onmouseout="bgColor=\''+linkBGColor+'\'" WIDTH="100%" ALIGN="'+linkAlign+'"><DIV ALIGN="'+linkAlign+'"><FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"> <A HREF="'+ssmItems[i][1]+'" target="'+ssmItems[i][2]+'" CLASS="ssmItems">'+ssmItems[i][0]+'</DIV></LAYER></ILAYER></TD>')} if(ssmItems[i][4]!="no"&&barBuilt==0){buildBar();barBuilt=1} if(ssmItems[i][4]!="no"){document.write('</TR>')}} document.write('</table>') if (NS6){document.write('</TD></TR></TABLE>')} if (IE||NS6) {document.write('</DIV></DIV>')} if (NS) {document.write('</LAYER></ILAYER></LAYER>')} theleft=-menuWidth;lastY=0;setTimeout('initSlide();', 1)} Hi all, I found a small fading script online which suits my needs though I need some help changing it around a bit as it seems to only work once in a page (i.e. a second occurance of the code doesn't work though the first one continues). Also, I'm not quite sure how to put it into a .js external page and then call the specific function as many times as I want in the body and have it all work. Please advise on this issue (i.e. Putting the code in an external file and then calling the fadeIn() function as many times as I want in the body). Thanks. BTW, the concept is a fixed imaged with the js fading another image over the top of that first image in and out over and over again. All the images and application of the js will be the same for all occurrences on the page (don't know if that's relevant to the solution I'm asking for but throwing it in there just in case). Here is the code: Code: <html> <body style="background:#000;"> <div style="float:left;"> <img style="float:left;" id="me" src="fade_arrow2.png"/> <img style="float:left;margin-left:-44px;" src="fade_arrow1.png"/> <script type="text/javascript"> var element = document.getElementById('me') ; var duration = 4000; /* 1000 millisecond fade = 1 sec */ var steps = 20; /* number of opacity intervals */ var delay = 5000; /* 5 sec delay before fading out */ /* set the opacity of the element (between 0.0 and 1.0) */ function setOpacity(level) { element.style.opacity = level; element.style.MozOpacity = level; element.style.KhtmlOpacity = level; element.style.filter = "alpha(opacity=" + (level * 100) + ");"; } function fadeIn(){ for (i = 0; i <= 1; i += (1 / steps)) { setTimeout("setOpacity(" + i + ")", i * duration); } setTimeout("fadeOut()", delay); } function fadeOut() { for (i = 0; i <= 1; i += (1 / steps)) { setTimeout("setOpacity(" + (1 - i) + ")", i * duration); } setTimeout("fadeIn()", duration); } /* start the effect */ fadeIn(); </script> </div> </body> </html> Hello, I have a script that makes a link a different color on click, i would like to add a hover color to the links that are NOT active. Script below. Thanks in advance! Code: function activate(el) { var links=document.getElementsByTagName("a"); for(i=0;i<links.length;i++) { if(links[i].className=="toggle") { links[i].style.color="#999"; } } el.style.color="#DF8700"; } Hi, I want to take this redirect script and modify it so that it rotates a banner image instead of sending the user to another page. The script works so that if the window is out of focus for 10 seconds, it redirects. The images are defined in an external style sheet so I guess I'll have to move that into the document. Also, I want it to be able to work more than once with multiple images, like if the user opens a new tab, comes back, goes to a different tab, the image should change twice. Here's the script: Code: <script type="text/javascript"> var xScroll, yScroll, timerPoll, timerRedirect, timerClock; function initRedirect(){ if (typeof document.body.scrollTop != "undefined"){ //IE,NS7,Moz xScroll = document.body.scrollLeft; yScroll = document.body.scrollTop; clearInterval(timerPoll); //stop polling scroll move clearInterval(timerRedirect); //stop timed redirect timerPoll = setInterval("pollActivity()",1); //poll scrolling timerRedirect = setInterval("location.href='http://www.google.com",10000); //set timed redirect } else if (typeof window.pageYOffset != "undefined"){ //other browsers that support pageYOffset/pageXOffset instead xScroll = window.pageXOffset; yScroll = window.pageYOffset; clearInterval(timerPoll); //stop polling scroll move clearInterval(timerRedirect); //stop timed redirect timerPoll = setInterval("pollActivity()",1); //poll scrolling timerRedirect = setInterval("location.href='http://www.google.com'",10000); //set timed redirect } //else do nothing } function pollActivity(){ if ((typeof document.body.scrollTop != "undefined" && (xScroll!=document.body.scrollLeft || yScroll!=document.body.scrollTop)) //IE/NS7/Moz || (typeof window.pageYOffset != "undefined" && (xScroll!=window.pageXOffset || yScroll!=window.pageYOffset))) { //other browsers initRedirect(); //reset polling scroll position } } document.onmousemove=initRedirect; document.onclick=initRedirect; document.onkeydown=initRedirect; window.onload=initRedirect; window.onresize=initRedirect; </script> The image is defined in Code: <div id="home" style="background: url(images/banner.png) no-repeat;"></div> I'm thinking I should replace banner.png with a variable or array name that has the image names defined somewhere and using a loop to choose the next image in the array. I took a C++ class but I don't know any JS, sorry for not doing homework. Thanks for reading this I am trying to modify a popup script to popup a lightbox on page load instead of a new window. The script identifies if the user is a new visitor and displays the popup only to new visitors. Typically, the lightbox is triggered by an a:link. I would like to trigger it using this script so that the lightbox pops up automatically for new visitors only. Here is the popup script: Code: <SCRIPT LANGUAGE="JavaScript"> <!-- function GetCookie(name) { var arg=name+"="; var alen=arg.length; var clen=document.cookie.length; var i=0; while (i<clen) { var j=i+alen; if (document.cookie.substring(i,j)==arg) return "here"; i=document.cookie.indexOf(" ",i)+1; if (i==0) break; } return null; } var visit=GetCookie("COOKIE1"); if (visit==null){ var expire=new Date(); window.name = "thiswin"; newwin=open("http://www.pccmedia.net/P25_60sec.php", "dispwin", "width=350,height=350,scrollbars=yes,menubar=no"); expire=new Date(expire.getTime()+7776000000); document.cookie="COOKIE1=here; expires="+expire; } // --> </SCRIPT> I want to replace the newwin=open... command with something that will trigger the lightbox. The section of the lightbox script that receives the trigger and variables is.... Code: Mediabox.scanPage = function() { // $$('#mb_').each(function(hide) { hide.set('display', 'none'); }); var links = $$("a").filter(function(el) { return el.rel && el.rel.test(/^lightbox/i); }); $$(links).mediabox({/* Put custom options here */}, null, function(el) { var rel0 = this.rel.replace(/[[]|]/gi," "); var relsize = rel0.split(" "); return (this == el) || ((this.rel.length > 8) && el.rel.match(relsize[1])); }); }; window.addEvent("domready", Mediabox.scanPage); An example of the typical HTML tag that triggers the lightbox and feeds the variables is Code: <a href="http://www.pccmedia.net/other/P25_60sec.mp4" rel="lightbox[set 720 405]" title="Project 25" onClick="stop1()"/> The rel=lightbox... is the trigger for the lightbox. The stop1() function refers to a separate script that plays background music on the website. This also needs to be included in the new visitor popup script, but is a separate issue..... I'm not familiar enough with JS to be able to figure this out. Any help would be GREATLY appreciated. Hi everyone, I have a countdown script I'd like to modify so that the countdown ends at a specific hour, and not on a particular day at midnight. I'm new to coding (Ruby), so still trying to get the hang of Javascript: Code: var current="Expired" var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec") function countdown(yr,m,d){ theyear=yr;themonth=m;theday=d var today=new Date() var todayy=today.getYear() if (todayy < 1000) todayy+=1900 var todaym=today.getMonth() var todayd=today.getDate() var todayh=today.getHours() var todaymin=today.getMinutes() var todaysec=today.getSeconds() var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec futurestring=montharray[m-1]+" "+d+", "+yr dd=Date.parse(futurestring)-Date.parse(todaystring) dday=Math.floor(dd/(60*60*1000*24)*1) dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1) dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1) dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1) if(dday==0&&dhour==0&&dmin==0&&dsec==1){ document.getElementById('counter').style.display='none'; document.getElementById('expired').style.display='block'; return } else{ document.getElementById('countdown_day').innerHTML=dday; document.getElementById('countdown_hour').innerHTML=dhour; document.getElementById('countdown_min').innerHTML=dmin; document.getElementById('countdown_sec').innerHTML=dsec; setTimeout("countdown(theyear,themonth,theday)",1000) } } //MODIFY THIS LINE: enter the count down date using the format year/month/day //e.g. countdown(2009, 03, 23); countdown(2011, 12, 24); I've tried to play with it by changing the following in green: Code: function countdown(yr,m,d, h ){ theyear=yr;themonth=m;theday=d; thehour=h . . . setTimeout("countdown(theyear,themonth,theday, thehour )",1000) . . countdown(2011, 12, 24, 10 ) But I don't seem to be getting anywhere. Any tips or pointers to push me in the right direction is much appreciated. Thanks! Hi all, I have been using a border-fading script to give the impression of onmouseover fading underline, and I wish to tweak it a bit to give a slightly different effect I have two scripts that do virtually the same thing, although the second has a display bug in FF both have their advantages and I don't have my heart set on using either one, although Vic's scripts are being used all over the page i'm creating so his has first dibs here they are, and I will describe what I need to do below: first script: Code: startColor = "FFFFFF"; // MouseOut link color endColor = "000000"; // MouseOver link color stepIn = 20; // delay when fading in stepOut = 30; // delay when fading out var fading=new Array(); fading['now']=startColor; function initLinkFade() { var links = document.getElementById('pageHolder').getElementsByTagName('A'); for(var i=0;i<links.length;i++){ links[i].onmouseover = domouseover; links[i].onmouseout = domouseout; } } if(document.getElementsByTagName){ window.onload = initLinkFade; document.write("<style type='text/css'>#pageHolder a{text-decoration:none}</style>"); } function domouseover() { var rel="nofollow" target=arguments[0]?arguments[0].target:event.srcElement; if(target.nodeName!='A')return; for(var i=0;i<fading.length;i++) clearTimeout(fading[i]); if(fading['el']!=target && fading['el']){ fading['el'].style.borderBottom = "1px solid #"+startColor; linkFade(startColor,endColor,target,stepIn); } else linkFade(fading['now'],endColor,target,stepIn); } function domouseout() { var rel="nofollow" target=arguments[0]?arguments[0].target:event.srcElement; if(target.nodeName!='A')return; for(var i=0;i<fading.length;i++) clearTimeout(fading[i]); if(fading['el']!=target && fading['el']){ fading['el'].style.borderBottom = "1px solid #"+startColor; linkFade(endColor,startColor,target,stepOut); } else linkFade(fading['now'],startColor,target,stepOut); } function hex(i) { var s=Math.floor(i).toString(16); return s.length==2?s:"0"+s; } function linkFade(s,e,element,step){ fading['el']=element; var sr=parseInt(s.substr(0,2),16); var sg=parseInt(s.substr(2,2),16); var sb=parseInt(s.substr(4,2),16); var er=parseInt(e.substr(0,2),16); var eg=parseInt(e.substr(2,2),16); var eb=parseInt(e.substr(4,2),16); for(var i = 0; i <= step; i++) { var r=hex((sr*(step-i)+er*i)/step); var g=hex((sg*(step-i)+eg*i)/step); var b=hex((sb*(step-i)+eb*i)/step); fading[i]=setTimeout("fading['now']='"+r+g+b+"';fading['el'].style.borderBottom = '1px solid #'+fading['now']",i*step); } } What I like about this one is that you can specify both the fade in and fade out speeds, allowing you a bunch of flexibility in how it looks also, I like how it allows you to set it to 'apply to all links in a given div... however that can have certain downfalls you can seethis script in action he www.enviromark.ca/head/YPP.htm the second script Code: <!-- // by Vic Phillips (04-September-2006) http://www.vicsjavascripts.org.uk function zxcMseOver(zxcobj,zxcd){ var zxcp=zxcobj; if (!zxcp.oop){ return; } clearTimeout(zxcp.oop.to); zxcp.oop.d=zxcd||0; zxcp.oop.cng(); } function zxcInit(zxccls,zxccol1,zxccol2,zxcstps){ var zxclks=document.getElementsByTagName('BODY')[0].getElementsByTagName('A'); for (var zxc0=0;zxc0<zxclks.length;zxc0++){ if (zxclks[zxc0].className==zxccls){ zxcStyle(zxclks[zxc0],{borderBottom:'solid '+zxccol1+' 0px;'}); zxclks[zxc0].oop=new zxcOOP(zxclks[zxc0],zxccol1,zxccol2,zxcstps); } } } var zxcCnt=0; function zxcOOP(zxcd,zxccol1,zxccol2,zxcstps){ this.obj=zxcd; this.ary=zxcSTxtColors([zxccol1,zxccol2],zxcstps||10); this.cnt=0; this.d=1 this.to=null; this.ref='zxcoop'+zxcCnt; window[this.ref]=this; zxcCnt++; } zxcOOP.prototype.cng=function(){ if ((this.d>0&&this.cnt<this.ary.length-1)||(this.d<0&&this.cnt>0)){ this.obj.style.borderBottom='solid #'+this.ary[this.cnt+=this.d]+' 1px'; this.setTimeOut("cng();",100); } else if (this.d<0) { this.obj.style.borderBottom='0px'; } } zxcOOP.prototype.setTimeOut=function(zxcf,zxcd){ this.obj.to=setTimeout("window."+this.ref+"."+zxcf,zxcd); } function zxcStyle(zxcele,zxcstyle){ if (typeof(zxcele)=='string'){ zxcele=document.createElement(zxcele); } for (key in zxcstyle){ zxcele.style[key]=zxcstyle[key]; } return zxcele; } function zxcSTxtColors(zxcc,zxcnu){ var zxcary=[]; zxcc1=zxcc[0].replace('#',''); zxcc2=zxcc[1].replace('#',''); var zxcr=zxcHexToInt(zxcc1.substring(0,2)); var zxcg=zxcHexToInt(zxcc1.substring(2,4)); var zxcb=zxcHexToInt(zxcc1.substring(4,6)); var zxcr2=zxcHexToInt(zxcc2.substring(0,2)); var zxcg2=zxcHexToInt(zxcc2.substring(2,4)); var zxcb2=zxcHexToInt(zxcc2.substring(4,6)); var zxcrstep=Math.round((zxcr2-zxcr)/zxcnu); var zxcgstep=Math.round((zxcg2-zxcg)/zxcnu); var zxcbstep=Math.round((zxcb2-zxcb)/zxcnu); for (zxc0=0;zxc0<zxcnu;zxc0++){ zxcary[zxc0]=zxcIntToHex(zxcr)+zxcIntToHex(zxcg)+zxcIntToHex(zxcb); zxcr+=zxcrstep; zxcg+=zxcgstep; zxcb+=zxcbstep; } zxcary[zxcnu-1]=zxcc[1].substring(1); return zxcary; } function zxcIntToHex(zxcn){ zxcn=(zxcn>255)?255:(zxcn<0)?0:zxcn; var zxcresult=zxcn.toString(16); if (zxcresult.length==1){ zxcresult="0"+zxcresult; } return zxcresult; } function zxcHexToInt(zxchex){ return parseInt(zxchex,16); } //--> activated by: <body onload="zxcInit('mainLinks','#FFFFFF','#000000',15);"> ... <a class="mainLinks" href="#advantagesRisks" onmouseover="zxcMseOver(this,1);" onmouseout="zxcMseOver(this,-1);"><img src="images/EN_advantages_risks.gif" name="imageLinkNoTouchy"></a> I like this script because it allows you to set the fade on a per-link basis, not on a per-div basis... more control alrighty, here are the minor modifications I am hoping to get help with The fade-out effects stop when a second link is onmouseover'd. I would like to be able to set both the fade-in and fade-out delays (like in the first script), but have the fade-out continue for "Link A" even if "Link B" is onmouse'd over. Basically getting the smooth-fade effect seen he www.enviromark.ca/head/ --> the gray icons. When a link is clicked, I would like the top border of the link to fade in and stay solid until another link is clicked. When another link is clicked, I would like it's top border to fade in (like the first link) a have the first link's top border fade out. Again you can see the effect I'm going for at the link above by clicking on a few of the vertical links and seeing it's effect on the horizontal images I know this might be a lot to ask, so I suppose I could live with the script I have... but I figured there was no harm in asking Hello all, Firstly apologies for my javascript ignorance - I'm not a programmer, just someone thrust into programming since there's no-one else at my company who can do it. I found a nice js script online for a drop-down menu where the drop downs both expand to their full size and fade-in (very quickly) from transparent. The script in action can be seen on the script writer's site he http://sandbox.leigeber.com/dropdown-menu/index.html and the script is: Code: var menu=function(){ var t=15,z=50,s=6,a; function dd(n){this.n=n; this.h=[]; this.c=[]} dd.prototype.init=function(p,c){ a=c; var w=document.getElementById(p), s=w.getElementsByTagName('ul'), l=s.length, i=0; for(i;i<l;i++){ var h=s[i].parentNode; this.h[i]=h; this.c[i]=s[i]; h.onmouseover=new Function(this.n+'.st('+i+',true)'); h.onmouseout=new Function(this.n+'.st('+i+')'); } } dd.prototype.st=function(x,f){ var c=this.c[x], h=this.h[x], p=h.getElementsByTagName('a')[0]; clearInterval(c.t); c.style.overflow='hidden'; if(f){ p.className+=' '+a; if(!c.mh){c.style.display='block'; c.style.height=''; c.mh=c.offsetHeight; c.style.height=0} if(c.mh==c.offsetHeight){c.style.overflow='visible'} else{c.style.zIndex=z; z++; c.t=setInterval(function(){sl(c,1)},t)} }else{p.className=p.className.replace(a,''); c.t=setInterval(function(){sl(c,-1)},t)} } function sl(c,f){ var h=c.offsetHeight; if((h<=0&&f!=1)||(h>=c.mh&&f==1)){ if(f==1){c.style.filter=''; c.style.opacity=1; c.style.overflow='visible'} clearInterval(c.t); return } var d=(f==1)?Math.ceil((c.mh-h)/s):Math.ceil(h/s), o=h/c.mh; c.style.opacity=o; c.style.filter='alpha(opacity='+(o*100)+')'; c.style.height=h+(d*f)+'px' } return{dd:dd} }(); with Code: var menu=new menu.dd("menu"); menu.init("menu","menuhover"); used on my html page to call the script. I'm using the script exactly as written and exactly as it is on the dude's demo page for it. However, some of my sub-menu items are wider than their parent items and in IE7 this means they are bound to the width of the parent until the animations have finished, and then pop-out to their full width (NB not an issue in FF3). I'm actually not too fussed about either the fade in or expand out effects (they'd be nice, but not at the expense of the IE7 bug) so I simply wanted to know what I should do to the script to turn off the effects, or make them instant - ie reduce the length of the effect to as short as possible. I understand I can get rid of the bug by specifying a width for the ul element in my css, but I'd rather not do that if I can help it. I'd appreciate anyone's insight on this. Thanks Tom I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani how to get first 4 digits of mobile number using substing method and then how to check that number in if condition using java script.that is i entered the mobile number 9688786064.i want to check first four digits 9688 .in that same check all the entered number only 9688 started nymber can allow to store data base..how can i develop the program..plz help me var ph1=document.getElementById('ph'); ph1=ph.substring(0,4) is it correct or not .if it is correct then tell further steps.if it wrong tell me the correct code hi i have this code i want to put a java script for this java scrip should be (amt1*amt2)+(amt3)*(amt4)=amt5 if (amt1*amt2)+(amt3)*(amt4) > amt5 should giver mesage on keyup of amount amt4 plzz help me how do i put javascript for this ...........plz help me Code: <table width="1113" height="99" border="0"> <tr bgcolor="#99FF66"> <td width="60"><div align="center"><strong>GROUP ID</strong></div></td> <td width="46"><div align="center"><strong>PART ID</strong></div></td> <td width="97"><div align="center"><strong>ITEM NAME</strong></div></td> <td width="144"><div align="center"><strong>UNIT</strong></div></td> <td width="144"><div align="center"><strong>a/b/c</strong></div></td> <td width="144"><div align="center"><strong>Qty/Crtn</strong></div></td> <td width="144"><div align="center"><strong>Nbr of Crtns</strong></div></td> <td width="144"><div align="center"><strong>Nett Wt/Crt</strong></div></td> <td width="152"><div align="center"><strong>Grs Wt/Crtn</strong></div></td> </tr> <?php $noofrow=0; $result10 = mysql_query("SELECT * FROM Ibws_Data WHERE Sc_No='$PcNo' AND Seq_No='$SeqNo' "); // $row1000 = mysql_fetch_array( $result1000 ); //$Sub_Total=""; while($row10 = mysql_fetch_array( $result10 )) { //$ttlamt=mysql_number_format(); $noofrow++; ?> <tr bgcolor="#99CC66"> <td><label> <?php echo '<input name="Group_ID'.$noofrow.'" value="'.$row10['Group_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Part_ID'.$noofrow.'" value="'.$row10['Part_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Name'.$noofrow.'" value="'.$row10['Name'].'" type="text" size="20" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Unit'.$noofrow.'" value="'.$row10['Unit'].'" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="cat'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt1'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt2'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt3'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt4'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt5'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> </tr> <tr> <td><label> <input type="submit" name="button" id="button" value="Submit" /> </label></td> <td><label></label></td> <td><label></label></td> <td> </td> <td><label></label></td> <td><label></label></td> </tr> </table> <p> </p> <p> </p> </form> plz help me with a sample java scrip code please hekp to sort this out.. .. The price of a ticket to a passenger on AOU-Airways is computed based on the following table: [9] Class Price First Class KD 300 Economy Class (with meal) KD 150 Economy Class (without meal) KD 130 Using nested if statements, write a JavaScript code which will work according to the following specifications: a. Read the class that the passenger wants to travel on. b. If the class is the first class, print the price of ticket. c. If the class is the economy class, ask the user if he/she wants a meal on the flight. Then print the price of the ticket according to the response of the passenger. The program should simply accept one possible strings the user enters; it is not required to work for all possible inputs such as First, first, FIRST or Yes , yes, YES. hi i want to implement this java script . This is the Original Java script page . Where you see if i click on the yahoo or | google buttons the new window is loading and the same page is displaying with a tab bar menu and close button. I want to implement the same on one of my documents where i created css and java script based drop down menus. But when i tried to implement the same java script on my own page its not working properly.Please help me fix it . I have changed the code only on Button -4 Link-1 only Hers the Live Demo of the page : Live Demo Of the page Heres the Java Script: Java Script Here's the CSS : Code: html,body { padding:0; margin: 0px; background: #306f80; } #wrapper{ width: 1024px; margin-right: auto; margin-left: auto; background: #FFFFFF; height: 1000px; } #header{ height: 100px; width: 1024px; background: url(../images/header.png) repeat-x; } .icons_hold{ float: right; height: 55px; width: 200px; position: relative; top: 10px; right: 10px; } .navestyle{ width: 1024px; font-weight: bold; margin-right: auto; margin-left: auto; } .navestyle:after{ /*Add margin between menu and rest of content in Firefox*/ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .navestyle ul{ border: 1px solid #BBB; width: 100%; background: url(../images/nav_bg.png) repeat-x center center; /*THEME CHANGE HERE*/ padding: 4px 0; margin: 0; text-align: center; font: 12px Verdana, Arial, Helvetica, sans-serif; } .navestyle ul li{ display: inline; margin-right: 2px; margin-left: 2px; } .navestyle ul li a{ color: #494949; padding: 4px 45px 4px 7px; margin: 0; text-decoration: none; border-right: 1px solid #DADADA; } .navestyle ul li a:hover, .navestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/ background: url(../images/hover.png) repeat-x center center; /*THEME CHANGE HERE*/ color: #FFFFFF; } /* ######### Style for Drop Down Menu ######### */ .dropmenudiv{ position:absolute; top: 0; border: 1px solid #BBB; /*THEME CHANGE HERE*/ border-bottom-width: 0; font:normal 12px/18px Verdana, Arial, Helvetica, sans-serif; z-index:100; background-color: white; visibility: hidden; width: 200px; } .dropmenudiv a{ width: auto; display: block; text-indent: 3px; border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/ padding: 2px 0; text-decoration: none; font-weight: bold; color: black; } * html .dropmenudiv a{ /*IE only hack*/ width: 100%; } .dropmenudiv a:hover{ /*THEME CHANGE HERE*/ background-color: #F0F0F0; } img { border: none; } .pagination{ padding: 0px 2px 2px; clear: both; } .pagination ul{ margin: 0; padding: 0; text-align: center; /*Set to "right" to right align pagination interface*/ font-size: 16px; } .pagination li{ list-style-type: none; display: inline; padding-bottom: 1px; } .pagination a, .pagination a:visited{ padding: 0 5px; border: 1px solid #9aafe5; text-decoration: none; color: #2e6ab1; } .pagination a:hover, .pagination a:active{ border: 1px solid #2b66a5; color: #000; background-color: #FFCC33; } .pagination a.currentpage{ background-color: #2e6ab1; color: #FFF !important; border-color: #2b66a5; font-weight: bold; cursor: default; } .pagination a.disablelink, .pagination a.disablelink:hover{ background-color: white; cursor: default; color: #929292; border-color: #929292; font-weight: normal !important; } .pagination a.prevnext{ font-weight: bold; } #demoArea { padding: 10px ; height: 580px ; background: #FFFFFF ; /*border: 1px solid black ;*/ /*display: table ;*/ } #demoLinks { width: 20% ; border-right: 1px dotted blue ; float: left ; } #demoBrowser { position: relative; width: 950px; margin-left: auto; margin-right: auto; } #tabBrowser { position: absolute ; width: 100% ; } /* --------------- TABS -------------------*/ #tabDemo { display: none } #tabContainer { display: block ; } #tabs { cursor: default ; list-style-type: none ; /*width: 560px ;*/ margin: 0 ; padding: 0 ; } #tabs li { background: #FFFBF0 ; border: 1px solid green ; border-bottom: 0 ; -moz-border-radius-topleft: 5px ; -moz-border-radius-topright: 5px ; float: left ; width: 100px ; min-width: 35px ; height: 20px ; margin: 0 2px 3px 0 ; padding-left: 3px ; } .tabTitle { float: left ; width: 80% ; height: 100% ; overflow: hidden ; } .closeTab { text-align: center ; text-transform: uppercase ; margin: 2px 3px 2px 80% ; border: outset 1px #D40000 ; } .closeTab:hover { background: #000000; } /* --------------- BROWSER -------------------*/ #tabContent { position: relative ; clear: both ; width: 100% ; } #tabContent div { position: absolute ; width: 100% ; } Here's the Mark Up : Code: <!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" lang="en" xml:lang="en"> <head> <title>Testing page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="css/css.css" /> <script type="text/javascript" src="js/tabbed_browser.js"></script> <script type="text/javascript" src="js/chrome.js"> </script> </head> <body> <div id="wrapper"> <div id="header"> <div class="icons_hold"><a href="#"><img src="images/home.png" title="home" /></a> <a href="#"><img src="images/help.png" title="help" /></a> <a href="#"><img src="images/sign_out.png" title="signe out" /></a></div> </div> <div class="navestyle" id="navemenu"> <ul> <li><a href="#" title="chaitnyas testing page">Button-1</a></li> <li><a href="#" title="chaitnyas testing page">Button-2</a></li> <li><a href="#" title="chaitnyas testing page">Button-3</a></li> <li><a href="#" rel="dropmenu1" title="chaitnyas testing page">Button-4</a></li> <li><a href="#" rel="dropmenu2" title="chaitnyas testing page">Button-5</a></li> <li><a href="#" rel="dropmenu3" title="chaitnyas testing page">Button-6</a></li> <li><a href="#" title="chaitnyas testing page">Button-7</a></li> <li><a href="#" title="chaitnyas testing page">Button-8</a></li> </ul> </div> <!--1st drop down menu --> <div id="dropmenu1" class="dropmenudiv"> <a id="link1" onclick="openTab('link1')" href="http://yahoo.com." title="chaitnyas testing page" ><img src = "images/1.gif" /> Link-1</a> <a href="link-2.htm" title="chaitnyas testing page"><img src = "images/2.gif" /> Link-2</a> <a href="link-3.htm" title="chaitnyas testing page"><img src = "images/3.gif" /> Link-3</a> <a href="link-4.htm" title="chaitnyas testing page"><img src = "images/4.gif" /> Link-4</a> <a href="link-5.htm" title="chaitnyas testing page"><img src = "images/5.gif" /> Link-5</a></div> <!--2nd drop down menu --> <div id="dropmenu2" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/6.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/7.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/8.gif" /> Link-3</a></div> <!--3rd drop down menu --> <div id="dropmenu3" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/9.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/10.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/11.gif" /> Link-3</a></div> <script type="text/javascript"> cssdropdown.startchrome("navemenu") </script> <p><br /> <div id="demoBrowser"> <div id="tabBrowser"> <div id="tabContainer"> <ul id="tabs"><li id="tabDemo"><div class="tabTitle">Google</div><div class="closeTab">x</div></li> </ul> </div> <div id="tabContent"> </div> </div> </div> </div><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> </p> <div class="pagination"> <ul> <li><a href="products.htm" class="currentpage" title="Products">1</a></li> <li><a href="products1.htm" title="Products">2</a></li> <li><a href="products2.htm" title="Products">3</a></li> </ul> </div><br /> </p> </div> </body> </html> I was hoping someone could help me fix this javascript code. I have been working for hours and it does not work. <html> <head> <title>Moondoe's Coffee House</title> </head> <script type="text/javascript"> var drink, ounces; prompt( "Enter the drink type:espresso, latte, cappuccino, americano" ); prompt( "Enter the ounce size: 8, 12, 16" ); var shots = prompt ( "Enter the number of shots" ); if ( drink == "espresso") price = 1.40; if ( drink == "latte") || drink == "cappuccino" ) { if ( ounce == 8 ) price = 1.95; else if ( ounce == 12 ) price = 2.35; else if ( ounce == 16 ) price = 2.75; } if ( drink == "americano" ) price = 1.20 + ( ( (ounce/8) -1 ) * .30 ); price = price + ( (shots-1) * .50 ); price = price * 1.055; price = Math.round ( price*100 ) /100; alert ( "Your " + ounce + "oz. " + drink + "with " + shots + "\nshots of espresso costs: $ " + price ); alert( "drink = " + drink + "ounce = "ounce + "shots = "shots ); </script> </html> hi, i have a html form and i have three text boxes named Max Accessories: Accessory SKU: Accessory CPC ID: and i want a javascript functionality like, if the user enters in the max accessories text box value as 1, then the below two text boxes should update like automatically like below, AcceSsory 1 SKU ACCESSORY 1 CPC ID SIMILARLY if user enters Max accessories value as 2 in the text box, then the below two text boxes should update like automatically like below AcceSsory 1 SKU ACCESSORY 1 CPC ID AcceSsory 2 SKU ACCESSORY 2 CPC ID onchange of the key, for accessory it should call some function in the same page and dynamically update. can any one please provide, a solution for this , thanks. Can someone help me with this javascript? It works fine with 10 images, but when I add the 11th it will not rotate the 11th image but still rotate the 1st 10. <br> <script type="text/javascript"> var imgs1 = new Array("/resource/resmgr/Ad_Banner/ad16.jpg","/resource/resmgr/Ad_Banner/ad13.jpg","/resource/resmgr/Ad_Banner/ad14.jpg","/resource/resmgr/Ad_Banner/ad8.jpg","/resource/resmgr/Ad_Banner/ad15.jpg","/resource/resmgr/Ad_Banner/ad18.jpg","/resource/resmgr/Ad_Banner/ad12.jpg","/resource/resmgr/Ad_Banner/ad19.jpg","/resource/resmgr/Ad_Banner/ad20.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/ad_Banner/ad3.jpg"); var lnks1 = new Array("http://www.adamscollision.com","http://www.huntleyrealty.com","http://www.trinitycpraed.com","http://www.sccah.com/?page=SCFestival","http://www.blazekshomefurnishings.hdspd.com","http://www.sccah.com/?page=JB_Const","http://tgconsultantsinc.com/","http://blueskiespilotshop.com/index.html ","http://www.aaaglass.com/ ","http://www.carytravelexpress.com/","http://www.sccah.com/?page=Ad_Inquiry "); var alt1 = new Array("Adams Collision","Huntley Realty","Trinity","Sun City Arizona","Hunter Douglas Window Coverings and Custom Draperies","J&B Construction","TGI Consulting","Blue Skies","AAA Glass","Cary Travel Express","THIS COULD BE YOUR AD!!!"); var currentAd1 = 0; var imgCt1 = 11; function cycle1() { if (currentAd1 == imgCt1) { currentAd1 = 0; } var banner1 = document.getElementById('adBanner1'); var link1 = document.getElementById('adLink1'); banner1.src=imgs1[currentAd1] banner1.alt=alt1[currentAd1] document.getElementById('adLink1').href=lnks1[currentAd1] currentAd1++; } window.setInterval("cycle1()",4000); </script> <a href=""http://www.adamscollision.com"" id="adLink1" rel="nofollow" target="_blank"> <img src="/resource/resmgr/Ad_Banner/ad16.jpg" id="adBanner1" border="0" width="170" height="200"></a> i have been experimenting on this...i don't know why this happens i am sure there is something wrong with my javascript code this is what happens... Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="Javascript" type="text/javascript"> function addRow() { // grab the element, i.e. the table your editing, in this we're calling it // 'mySampleTable' and it is reffered to in the table further down on the page // with a unique of id of you guessed it, 'mySampleTable' var tbl = document.getElementById('mySampleTable'); // grab how many rows are in the table var lastRow = tbl.rows.length; // if there's no header row in the table (there should be, code at least one //manually!), then iteration = lastRow + 1 var iteration = lastRow; // creates a new row var row = tbl.insertRow(lastRow); // left cell // insert a cell // var cellLeft = row.insertCell(0); // here we're just using numbering the cell, like anything else you don't // have to use this, but i've kinda noticed users tend to like them // var textNode = document.createTextNode(iteration); // takes what we did (create the plain text number) and appends it the cell // we created in the row we created. NEAT! //cellLeft.appendChild(textNode); // right cell // another cell! var cellRight = row.insertCell(1); // creating an element this time, specifically an input var el = document.createElement('input'); // a data type of text el.type = 'text'; // the name of the element txtRow, and because this is dynamic we also // append the row number to it, so for example if this is the eigth row // being created the text box will have the name of txtRow8. super fantastic. el.name = 'txtRow' + iteration; // the exact same thing with a unique id el.id = 'txtRow' + iteration; // set it to size of 40. setting sizes is good. el.size = 40; // same thing as earlier, append our element to our freshly and clean cell cellRight.appendChild(el); // select cell // our last cell! var cellRightSel = row.insertCell(0); // create another element, this time a select box var sel = document.createElement('select'); // name it, once again with an iteration (selRow8 using the example above) sel.name = 'selRow' + iteration; // crates options in an array // the Option() function takes the first parameter of what is being displayed // from within the drop down, and the second parameter of the value it is carrying over sel.options[0] = new Option('text zero', 'value0'); sel.options[1] = new Option('text one', 'value1'); sel.options[2] = new Option('text two', 'value2'); // append our new element containing new options to our new cell cellRightSel.appendChild(sel); el.size = 40; } function removeRow() { // grab the element again! var tbl = document.getElementById('mySampleTable'); // grab the length! var lastRow = tbl.rows.length; // delete the last row if there is more than one row! if (lastRow > 2) tbl.deleteRow(lastRow - 1); } </script> <html> <head> <title>Page Title</title> </head> <body leftmargin="0" topmargin="0"> <form action="addrow.html" name="eval_edit" method="post" format="html"> <table align="center" width = "75%"> <tr> <td align = "center"> click add to you know, add a row, and remove to remove a row, and submit to submit your page! whee! </td> </tr> <tr> <td align = "center"> <!--- very imporant to give the table an id ---> <!--- otherwise it won't know where to edit ---> <table border="1" id="mySampleTable"> <tr> <td> Type of Leave </td> <td> No. of Days allowed </td> </tr> <!--- i create the initial row by hand, there are a lot of ---> <!--- different ways to do this depending on what parsing ---> <!--- language you use, i found this was easiest for the ---> <!--- snippet, but experiment, do your thing mang. ---> <!--- this matches the same specs we laid out in the javascript ---> <tr> <td><select name="selRow0"> <option value="value0">text zero</option> <option value="value1">text one</option> <option value="value2">text two</option> </select> </td> <td> <input type="text" name="txtRow1" id="txtRow1" size="40" /> </td> </tr> </table> <!--- our buttons call our javascript functions when clicked ---> <input type="button" value="Add" onclick="addRow();" /> <input type="button" value="Remove" onclick="removeRow();" /> <input type="submit" value="Submit" /> </td> </tr> </table> </form> </body> </html> hi friends, i got a two textboxes,my requirement is when i enter two charectors in textbox1,automatically cursor must point to textbox2. but in my case it is not happening like above,when ever i enter charector3,curosr is entering textbox2 along with the entered charector, please find my code below and help me in modifying it. 1.abc.ascs.cs file code is: txtCategory.Attributes.Add("OnKeyPress", "Focus1(this.id);"); 2.abc.ascx file code is: <script type="text/javascript"> function Focus1(that) { if (document.getElementById(that).value.length>1) { //If Len(.Text) = 2 Or Len(TXTbox.Text) = 5 Then document.getElementById('ShippedQtyAdjEntry1_txtDetail').disabled=false; document.getElementById('ShippedQtyAdjEntry1_txtDetail').style.backgroundColor="White"; document.getElementById('ShippedQtyAdjEntry1_txtDetail').focus(); } i am newbie on javascript i want to get my domain to twitter but i spent 3 hour nothing find my code java script function Code: <script type="text/javascript"> function putmydomainhere() { var url; url = (document.domain) document.write(url); } </script> html code Code: <a href="http://twitter.com/share" class="twitter-share-button" data-counturl="http://+ putmydomainhere() +/get?123" data-url="http://+ putmydomainhere() +/get?123" data-via="myuserid" data-count="horizontal">Tweet</a> <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script> thank you <script type="text/JavaScript"> function refreshPage(s) { window.location.reload(); if((s.options[s.selectedIndex].value) = "zed=catcher") { alert (s.selectedIndex); //this is showing <?PHP //the next lines does not execute????? echo $form['service_code']->renderLabel(); echo $form['service_code']->renderError(); echo $form['service_code']; ?> } } </script> please help? thanks |