JavaScript - Simulate Mouse Click Event
Hey guys!
How can i simulate a click event? Like a real mouse click. and a keyboard click event? Similar TutorialsHi, Hi, I want to simulate user KEY PRESS (not mouse clicking) automatically on a screen every time that a pop up window (script error message) is opened on the screen OR detecting when an an iframe gets focus. My goal: Automatically closes the pop up window. If anybody know the exact code please post it. FG Hi. 1) I would like to click the Download button on this site, then wait lets say 60 sec & click free download button. http://uploading.com/files/S4WYPP73/...r_ENG.rar.html I remember that somehow it is possible to create the Request URL & then input it into IE & the server will think I hit the button. But how can I make the URL? And how is it called? posting URL request? I will be using firefox or I can make HTML file & execute it in IE for every file. PHP Code: <form action="http://uploading.com/files/get/S4WYPP73/" method="post" id="downloadform"> <input type="hidden" name="action" value="second_page" /> <input type="hidden" name="file_id" value="4663720" /> PHP Code: function do_step_1() { do_request('files', 'get', {file_id: 4663720, action: 'step_1'}, function(wait_time){ if(wait_time > 0) start_timer(wait_time); else if(wait_time <= 0) download(); }); } function do_step_2() { do_request('files', 'get', {file_id: 4663720, action: 'step_2'}); } PHP Code: function download() { $('#waitblock').html('Free Download'); $('#waitblock').click(function(){ do_step_2(); }); } Hi guys I'm trying to simulate links clicking on web pages, don't know how to deal with javascript links. The link I'm trying to click contains a tag like this: <a href="javascript:function(1243423)">text</a> Would somebody help me out please? Thanks a lot I've spent days searching without luck. I need help with the following: I have a program that have some hotkeys set to trigger some events. I would like to activate those hotkeys from inside firefox by clicking on a button. I'm not looking for keypress events, it has to be a button click. So, let's say I click on the button that executes a javascript code that emulates F7 or CTRL+A or whatever key or key combination. Can you guys please help with to find a solution? Oh, and I need it to work with Firefox only. Thanks! I am working on implementing a gallery into my website with categories that collapse/expand the set of images within those categories. i figured out mostly everything i need except i can't get the BUTTONS to behave the way that I want. I'm working with the following images: arrow1: arrow2: arrow3: in general, I want "arrow1" to change to "arrow2" whenever you hover a mouse over it, and back to "arrow1" when the mouse is moves away. (which is simple by itself) the complicated part that I can't figure out, is what happens when you CLICK the button. I want the image to change to "arrow3" when it is clicked (because the content expands), and to STAY at that image until it's clicked again, at which point it should behave as what I started with. The problem is, I can get the arrow to change on click no problem, but once the mouse is moved away, the "onMouseOut" effect changes it back to "arrow1". this is the code I'm working with, hope someone can help Code: <SCRIPT LANGUAGE = "JavaScript"> <!-- first=new Image first.src="http://www.clearnonsense.com/images/arrow1.png" second=new Image second.src="http://www.clearnonsense.com/images/arrow2.png" // --></SCRIPT> </HEAD> <table border="0"> <tr> <td> <a href="javascript:void(0)" OnMouseOut="monitor.src=first.src" OnMouseOver="monitor.src=second.src" onMouseUp="clickdown('pic1')"><img src="http://www.clearnonsense.com/images/arrow1.png" border="0" name="monitor" onclick="showhide('div1',this,'http://www.clearnonsense.com/images/arrow1.png','http://www.clearnonsense.com/images/arrow3.png');"/></a> </td> </tr> <tr> <td valign="top" width="15"> <div id="div1" style="display: none;">imgset1</div> </td> </tr> </table> In a <textarea ..., the user can do this: 1) copy some text from somewhere; 2) right-mouse click on the textarea, from the floating menu, select the Paste, the text is pasted in the textarea. How can I detect the action of the Paste menuitem being clicked (on IE and Firefox, respectively)? Thanks Scott want to get selected text and image values .Since there is an randomly changed text and image on my page.I used window.getSelection() but this will return only selected text values not images ..so please guide me to solve this problem.
1. I have code to show tip like: <a class="notvisible" onclick="mytip.disable();" href="javascript:void(0);">Close</a> How is correct Javascript code to Close this tip when clicked? 2. How to move next news feed with click on arror icon and back icon? <a onclick="mynews.previous();" href="javascript:void(0);">Previous</a> <a onclick="mynews.next();" href="javascript:void(0);">Next</a> How is correct Javascript code to move news item next and prevoius news? when clicked? <script type="text/javascript"> mynews.init(); mytip.init(); </script> I have small webBrowser1 and I have the 3 Buttons(Back, Forward,Go) also I have the ComboBox1 with the Items Collection of different website url using MSVB 2008 in C++ My question: 1) How could I make my mouse click on each url with timer between the first url and the second and so on and let's say time between the 1st url and scroll down to the second with timer of 3 second . 2) How to make also the mouse click on certain button on that website what is the command code for that. I Thank you for any help. I am having problem with editing string on mouse click. I have a string of text like this: Code: id1=&id2=&id3=&id4=& And now I need to show/hide part of string by clicking on a links. I would like to hide/show each id's (i.e. id1=& It is simple to hide whole text but how about part of it ? Hai all, iam trying to use java script code in my jsp page. i used a onclick event.while clicking on the button that wil goes to the javascript function(deleteRecord(name,subject)). this deleterecord() wil post the url request. my code is like this ----------------- function deleteRecord(name,subject){ document.write("name received is:"+name); f.method="post"; var url="http://localhost/myproject/DeleteRecord?"; var url1= "name="+name; var url2="subject="+subject; var URL=url+url1+url2; f.action(URL); f.submit(); } my onclickevent code is' <td width="20%" height="25" align="left" valign="middle"><input type="submit" name="delete" value="Delete" style="background-color:#ff0000;font-weight:bold;color:#ffffff;" onclick="deleteRecord(<%=rs.getString("name")%>,<%=rs.getString("subject")%>);" /></td> --------------------------------------------- wil iam running my jsp page internet explorer is giving in variable subject (error:'divi' is invalid).divi is the value of the parameter name which iam passing to the function . and mozilla firefox my script is not working there is some syntax issues as wel as browser issues...and with url syntax can any one help me... Regards, Divya Hi All, I have a page which i am setting up for my local football team, and the javascript part of the page which is a 'news' rotator which i need to ammend. at the moment the tabs on the right of the 'news' rotator are linked to a certain page but nothing happens when you click on them? and i dont know enough javascript to ammend my code to make it so that it send the user to the linked page here is my js file Code: /* * faded 0.3.1 - jQuery plugin * written by Nathan Searles * http://nathansearles.com/faded/ * * Copyright (c) 2009 Nathan Searles (http://nathansearles.com/) * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. * * Built for jQuery library * http://jquery.com * Compatible with jQuery 1.3.2+ * */ if(typeof jQuery != "undefined") { jQuery(function($) { $.fn.extend({ faded: function(options) { var settings = $.extend({}, $.fn.faded.defaults, options); return this.each( function() { if($.fn.jquery < "1.3.1") {return;} var $t = $(this); var $c = $t.children(":nth-child(1)"); var o = $.metadata ? $.extend({}, settings, $t.metadata()) : settings; var total = $c.children().size(); var next = 0, prev = 0, number = 0, currentitem = 0, restart = 0, restartinterval = 0; var loaded,active,imgSrc,clicked,current; if (o.random) { $.fn.reorder = function(callback) { function randOrd() { return(Math.round(Math.random())-0.5); } return($(this).each(function() { var $this = $(this); var $children = $this.children(); var childCount = $children.length; if (childCount > 1) { $children.hide(); var indices = new Array(); for (i=0;i<childCount;i++) { indices[indices.length] = i; } indices = indices.sort(randOrd); $.each(indices,function(j,k) { var $child = $children.eq(k); var $clone = $child.clone(true); $clone.show().appendTo($this); if (callback !== undefined) { callback($child, $clone); } $child.remove(); }); } })); }; $c.reorder(); } function pause() { clearInterval(autoplay); clearTimeout(restart); restart = setTimeout(function() { autoplay = setInterval(function(){ animate("next"); },o.autoplay); },o.autorestart); } $c.css({position:"relative"}); $c.children().css({ position:"absolute", top: 0, left: 0, zIndex: 0, display:"none" }); if (o.autoheight) { $c.animate({height: $c.children(":eq(0)").outerHeight()},o.autoheight); } if (o.pagination) { if (o.autopagination) { $t.append("<ul class="+o.pagination+"></ul>"); $c.children().each(function(){ $("."+o.pagination+"",$t).append("<li><a rel="+number+" href=\"#\" >"+(number+1)+"</a></li>"); number++; }); } $("."+o.pagination+" li a:eq(0)",$t).parent().addClass("current"); $("."+o.pagination+" li a",$t).click(function(){ current = $("."+o.pagination+" li.current a",$t).attr("rel"); clicked = $(this).attr("rel"); if (current != clicked) {animate("pagination",clicked,current);} if(o.autoplay){pause();} return false; }); } if (o.sequentialloading&&$c.children()[0].tagName=="IMG") { $c.css({background:"url("+o.loadingimg+") no-repeat 50% 50%"}); imgSrc = $("img:eq(0)",$c).attr("src"); $("img:eq(0)",$c).attr("src", imgSrc).load(function() { $(this).fadeIn(o.speed,function(){ loaded = true; }); }); } else { $c.find(":eq(0)").fadeIn(o.speed,function(){ loaded = true; }); } if (o.bigtarget) { $c.css({"cursor":"pointer"}); $c.click(function(){ animate("next"); if(o.autoplay){ if (o.autorestart) { pause(); } else { clearInterval(autoplay); } } return false; }); } if (o.autoplay) { autoplay = setInterval(function(){ animate("next"); },o.autoplay); pause(); } $("."+o.nextbtn,$t).click(function(){ animate("next"); if(o.autoplay){ if (o.autorestart) { pause(); } else { clearInterval(autoplay); } } return false; }); $("."+o.prevbtn,$t).click(function(){ animate("prev"); if(o.autoplay){ if (o.autorestart) { pause(); } else { clearInterval(autoplay); } } return false; }); function animate(dir,clicked,current){ if (!active&&loaded) { active=true; switch(dir) { case "next": prev = next; next = currentitem*1+1; if (total === next) { next = 0; } break; case "prev": prev = next; next = currentitem*1-1; if (next === -1) { next = total-1; } break; case "pagination": next = clicked; prev = current; break; } if (o.pagination) { $(".pagination li.current",$t).removeClass("current"); $(".pagination li a:eq("+next+")",$t).parent().addClass("current"); } if (o.crossfade) { $c.children(":eq("+next+")").css({zIndex:10}).fadeIn(o.speed,function(){ $c.children(":eq("+prev+")").css({display:"none",zIndex:0}); $(this).css({zIndex:0}); currentitem = next; active = false; }); } else { $c.children(":eq("+prev+")").fadeOut(o.speed,function(){ if (o.autoheight) { $c.animate({height: $c.children(":eq("+next+")").outerHeight()},o.autoheight,function(){ $c.children(":eq("+next+")").fadeIn(o.speed); }); } else { $c.children(":eq("+next+")").fadeIn(o.speed); } currentitem = next; active = false; }); } } } } ); } }); $.fn.faded.defaults = { speed: 300, crossfade: false, bigtarget: false, sequentialloading: false, autoheight: false, pagination: "pagination", autopagination: true, nextbtn: "next", prevbtn: "prev", loadingimg: false, autoplay: false, autorestart: false, random: false }; }); } not sure why it wont load the url when clicked apon? can anyone please help? many thanks Luke Dear Friends, I am breaking my head over this since yesterday. Can anyone help me with a javascript which can be used to replace the inner text (count of downloads) with new text based on how many people save my image using Right-Click Save Image As option. Thank you PS: Without database support. Code: <table border="0" cellspacing="1" cellpadding="1" width="200"> <tbody> <tr> <td><img border="0" id="s1" alt="" src="s1.gif" /></td> <td><img border="0" id="s2" alt="" src="s2.gif" /></td> </tr> <tr> <td style="text-align: center">7 Download(s)</td> <td style="text-align: center">1 Download(s)</td> </tr> <tr> <td><img border="0" id="s3" alt="" src="s3.gif" /></td> <td><img border="0" id="s4" alt="" src="s4.gif" /></td> </tr> <tr> <td style="text-align: center">0 Download(s)</td> <td style="text-align: center">10 Download(s)</td> </tr> </tbody> </table> Hi all ... Any help's appreciated ... The challenge is that I have three - three page sliders ... each one is actually being called on a list item external to the easySlider function ...(#sliderNav ul li a#s1, #s2, #s3) When I navigate from one slide show to the next ... I need to send a callback to rewind each slideshow to the first page and reflect the current change to the numeric 'a' attr ... I don't quite know how to properly structure a callback function to update the current list item index from within the click event ... Any suggestions would KINDLY be appreciated cause I think I'm a bit over my JavaScript - JQuery skills threshold with this ... Thanks in advance and if you are way too busy to assist I completely understand ... Here's the code I have for my slideshow controller .. Code: $(function() { // Slider Init Functions .... $("#slideShow").easySlider({ controlsShow:true, speed:100, numeric:true, numericId:'controls', className:"sone", firstId:'p1' }); $('.stwo, .sthree').hide(); $('.sone').show(); $('#slideShowTwo').easySlider({ controlsShow:true, speed:100, numeric:true, numericId:'controlsTwo', className:'stwo', firstId:'p4' }); $('#slideShowThree').easySlider({ controlsShow:true, speed:100, numeric:true, numericId:'controlsThree', className:'sthree', firstId:'p7' }); // Slider Nav Calls ... $('#s1').click(function() { $('.sone').show(); $('.stwo, .sthree').hide(); }); $('#s2').click(function() { $('.stwo').show(); $('.sone, .sthree').hide(); }); $('#s3').click(function() { $('.sthree').show(); $('.sone, .stwo').hide(); }); }); And the code for the easySlider .... Code: (function($) { $.fn.easySlider = function(options){ // default configuration properties var defaults = { prevId: 'prevBtn', prevText: 'Previous', nextId: 'nextBtn', nextText: 'Next', controlsShow: true, controlsBefo '', controlsAfter: '', controlsFade: true, firstId: 'firstBtn', firstText: 'First', firstShow: false, lastId: 'lastBtn', lastText: 'Last', lastShow: false, vertical: false, speed: 800, auto: false, pause: 2000, continuous: false, numeric: false, numericId: 'controls', className:'' }; var options = $.extend(defaults, options); this.each(function() { var obj = $(this); var s = $("li", obj).length; var w = $("li", obj).width(); var h = $("li", obj).height(); var clickable = true; obj.width(w); obj.height(h); obj.css("overflow","hidden"); var ts = s-1; var t = 0; $("ul", obj).css('width',s*w); if(options.continuous){ $("ul", obj).prepend($("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px")); $("ul", obj).append($("ul li:nth-child(2)", obj).clone()); $("ul", obj).css('width',(s+1)*w); }; if(!options.vertical) $("li", obj).css('float','left'); if(options.controlsShow){ var html = options.controlsBefore; if(options.numeric){ html += '<ol id="'+ options.numericId +'" class="' + options.className + '"></ol>'; } else { if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>'; html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>'; html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>'; if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>'; }; html += options.controlsAfter; $(obj).after(html); }; if(options.numeric){ for(var i=0;i<s;i++){ $(document.createElement("li")) .attr('id',options.numericId + (i+1)) .attr('class',options.className) .html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>') .appendTo($("#" + options.numericId)) .click(function(){ animate($("a",$(this)).attr('rel'),true); }); }; } else { $("a","#"+options.nextId).click(function(){ animate("next",true); }); $("a","#"+options.prevId).click(function(){ animate("prev",true); }); $("a","#"+options.firstId).click(function(){ animate("first",true); }); $("a","#"+options.lastId).click(function(){ animate("last",true); }); }; function setCurrent(i){ i = parseInt(i)+1; $("li", "#" + options.numericId).removeClass("current"); $("li#" + options.numericId + i).addClass("current"); }; function adjust(){ if(t>ts) t=0; if(t<0) t=ts; if(!options.vertical) { $("ul",obj).css("margin-left",(t*w*-1)); } else { $("ul",obj).css("margin-left",(t*h*-1)); } clickable = true; if(options.numeric) setCurrent (t); }; function animate(dir,clicked){ if (clickable){ clickable = false; var ot = t; t = parseInt(t); switch(dir){ case "next": t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1; break; case "prev": t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1; break; case "first": t = 0; break; case "last": t = ts; break; default: t = dir; break; }; var diff = Math.abs(ot-t); var speed = diff*options.speed; if(!options.vertical) { p = (t*w*-1); $("ul",obj).animate( { marginLeft: p }, { queue:false, duration:speed, complete:adjust } ); } else { p = (t*h*-1); $("ul",obj).animate( { marginTop: p }, { queue:false, duration:speed, complete:adjust } ); }; if(!options.continuous && options.controlsFade){ if(t==ts){ $("a","#"+options.nextId).hide(); $("a","#"+options.lastId).hide(); } else { $("a","#"+options.nextId).show(); $("a","#"+options.lastId).show(); }; if(t==0){ $("a","#"+options.prevId).hide(); $("a","#"+options.firstId).hide(); } else { $("a","#"+options.prevId).show(); $("a","#"+options.firstId).show(); }; }; if(clicked) clearTimeout(timeout); if(options.auto && dir=="next" && !clicked){; timeout = setTimeout(function(){ animate("next",false); },diff*options.speed+options.pause); }; }; }; // init var timeout; if(options.auto){; timeout = setTimeout(function(){ animate("next",false); },options.pause); }; if(options.numeric) setCurrent(0); if(!options.continuous && options.controlsFade){ $("a","#"+options.prevId).hide(); $("a","#"+options.firstId).hide(); }; }); }; })(jQuery); The HTML Code: <div id="sliderNav"> <ul> <li><a href="#p1" id="s1">One</a></li> <li><a href="#p4" id="s2">Two</a></li> <li><a href="#p7" id="s3">Three</a></li> </ul> </div> <div id="slideShow" class="sone"> <ul> <li id="p1"><!--<li>Slide One</li>--> <div class="h2">This is The Main Page</div> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p2"> <div class="h2">This is Page Two</div> Here's the second portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p3"> <div class="h2">This is Page Three</div> Here's the third portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> </ul> </div><!-- </div id="slideShow">--> <div id="slideShowTwo" class="stwo"> <ul> <li id="p4"><!--<li>Slide Two</li>--> <div class="h2">This is Slideshow 2 Page One</div> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p5"> <div class="h2">This is Slideshow 2 Page Two</div> Here's the second portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p6"> <div class="h2">This is Slideshow 2 Page Three</div> Here's the third portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin.</li> </ul> </div><!-- </div id="slideShowTwo">--> <div id="slideShowThree" class="sthree"> <ul> <li id="p7"><!--<li>Slide Three</li>--> <div class="h2">This is Slideshow 3 Page One</div> Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p8"> <div class="h2">This is Slideshow 3 Page Two</div> Here's the second portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> <li id="p9"> <div class="h2">This is Slideshow 3 Page Three</div> Here's the third portion of the content. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Sed volutpat ante id mauris laoreet vestibulum. Nam blandit felis non neque cursus aliquet. Morbi vel enim dignissim massa dignissim commodo vitae quis tellus. Nunc non mollis nulla. Sed consectetur elit id mi consectetur bibendum. Ut enim massa, sodales tempor convallis et, iaculis ac massa. Etiam suscipit nisl eget lorem pellentesque quis iaculis mi mattis. Aliquam sit amet purus lectus. Maecenas tempor ornare sollicitudin. </li> </ul> </div><!-- </div id="slideShowThree">--> </body> Hi, I am still designing the website and want some flexibility. I am capturing the mouse clicks fine on top of an image, but the coordinates are absolute and not relative to the image. How can I capture mouse clicks relative to the image so that I can move the image anywhere in my website? Thanks! I've got to have a typo somewhere, but i can't seem to find it. I need a new pair of eyes to point it out for me. background: trying to code a mouseover link for a nav bar. everything is working( hyperlink, normal image shows up) but when i mouse over the image swap doesn't happen. I have 2 parts of code. 1st preloads images and does the swap function. loads in <head> See below: Code: <SCRIPT language="javascript" type="text/javascript"> if (document.images) { /* preload images */ var subcontractorsOn = new Image (); subcontractorsOn.scr = "subcontractorsOn.gif"; var subcontractorsOff = new Image (); subcontractorsOff.scr = "subcontractorsOff.gif"; } function mouseOn (imgName) { if (document.images) document [imgName].scr = eval (imgName + "On.scr"); } function mouseOff (imgName) { if (document.images) document [imgName].scr = eval (imgName + "Off.scr"); } </SCRIPT> 2nd just calls the functions to preform the swap. this is in the <body> see code below Code: <a href="subcontractors.htm" onMouseOut="mouseOn('subcontractors')" onMouseOver="mouseOff('subcontractors')"> <img src="subcontractorsOff.gif" height="40" width="133" name="subcontractors" id="subcontractors" border="0" alt="subcontractors"></a> any insight would be great. regards, Fatmann66 Hi to everyone! I need javascript to trigger automatically on load "w" keyboard stroke but to react on browser not on any input or other elements! Here's some code I wrote. It's just a red ball traveling around the screen. The point is to simulate some rudimentary physics. This means I have to make the ball bounce around the screen, but also get pulled down by gravity a bit. I did the bouncing part. However, I'm not sure how to simulate gravity. Any tips? Basically I just have to reduce the vertical velocity of the ball by a certain amount at every interval, but I'm not sure how to do that. I've tried different for loops in which vy will decrease by one, but to no avail! Code: <html> <head> <style> table {border-collapse:collapse} </style> <script> nx=128; ny=32; wx=600; wy=400; dx=Math.floor(wx/nx); ny=Math.round(nx*600/1000); x1=1;y1=1; vx=1;vy=1; function dart() {id1=x1+","+y1; b1=document.getElementById(id1); b1.style.backgroundColor="yellow"; if(x1==0 || x1==nx-1)vx= -vx; if(y1==0 || y1==ny-1)vy= -vy; x1 = x1+vx; y1 = y1+vy; id1=x1+","+y1; b1=document.getElementById(id1); b1.style.backgroundColor="red" } </script> </head> <body> <table> <script> dy=dx; for(i=0;i<ny;i++) {document.write("<tr>"); for(j=0;j<nx;j++) {color="yellow"; id1=j+","+i; document.write( "<td id="+id1+" style='background-color:"+color+ ";width:"+dx+";height:"+dy+"'></td>"); } document.write("</tr>"); } </script> </table> <form> Number of milliseconds <input type ="text" value="10" id="ms"/input> <br> <input type="button" value="dart" onclick="setInterval('dart()',document.getElementById('ms').value)"/input> </form> </body> </html> CLIFFS: - code shows red dot bouncing around - how do i decrease vertical velocity by N amount at every interval? Hi How I can simulate keypress in google chrome. I want to press a button to fire keypress event to print "X" in input box. |