JavaScript - [question] Zooming In On Map
Hi all,
I have a map of a topographical area divided into districts. On mouseover i'd like the district to light up en when pressing a mousebutton I would like to zoom in, showing only that district... which is divided into teams. Is that possible with JavaScript? Are there example-script for this purpose? Hope someone can help. Nop01 Similar TutorialsHello everybody, I need to write a javascript program that shows a map (.png image) on the web, and when the mouse moves over the map, it zooms the area around the pointer. (the zoomed part comes from a high resolution large image which actually should be cropped in order not to be larger than certain size.) I am a newbie in javascipt, and I have learned some, but still I have no idea how to create a such script. Do I need something extra like CSS, JQuery? I have no experience in web programming, so any help would be much appreciated. I want to create something similar to what they achieve with this script: http://www.magictoolbox.com/magiczoom/ I know I could just download their script, but it's for a website that will be commercial in nature, and my cousin doesn't want to pay 29 pounds (which is a lot in AUD!) for it. I can use a rollover to display a larger image next to it, but I'm not sure on how to make the image move like that one does. Any help or suggetions would be greatly appreciated! Originally she just wanted something like the Lightbox script, so it's annoying her changing her mind now! Hello, I'm working on a small project and I'm new to javascript, basically on my canvas I have drawn a fault tree diagram that look like this View image: zoomzoom, what I want is too zoom in/out using the mouse wheel, and use mouse button to pan it to left/right. Don't really know where to stand so any advice would be helpful.
Hello, I've been working on creating a script that zooms the entire webpage. Other than using "CTRL" + "+" keys (generally compatible with all browsers) to zoom in inside a web browser, I want to put it in a different format, as a button; it would be even easier to use. The problem is that I can't figure out how to make it work/ why it does not work. The following is my code: Code: <html> <head> <script type = "text/javascript"> document.onkeydown = function(zoomin) { var key; zoomin = zoomin || event; key = zoomin.keyCode; key == 43; return false; if (key == 17) { return true; function(zoomin){; return false; } } }</script> </head> <body> <h1>Is this appearing to get bigger?</h1> <button onclick="javascript: function('zoomin');">Zoom in</button> </body> </html> Basically I was trying to use a DEC code as the code for the "CTRL" and "+" keys; then put them into a function. The "return true" under the IF statement means that I want it to hold so that the "+" key can be read as part of the script, and therefore make the page zoom in. Once that happens, it returns false. I would appreciate any help/ suggestions. I will also try to look for a way to reset the page (100%) or zoom out as well. hello all ive been asked to create a javascript slideshow.... and i don't really understand it that much i know a little javscript but not much........ is thier any helpful sites that i can use to teach you step by step to make a javascript slide show???? also if don't want loads of code to be used, i want the code to be clean insted of loads and loads of code what is just unessary. i will be linking the javascript file to the html file so i need to keep the code to a min LOL CHEERS Ok i have been working on this for a while now. I have to have 3 fish swim across the screen in both direction. I have tried a few things but nothing is working. Can someone please explain to me what I am doing wrong. here is my code for you guys to look at it. Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Fish tank</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script type="text/javascript"> // <![CDATA[ var fishPos = new Array(3); fishPos[0] = "fish1.gif"; fishPos[1] = "fish2.gif"; fishPos[2] = "fish3.gif"; var fillPosition = 10; for(var i = 0; i < 50; ++i) { horizontal[i] = fillPosition; fillPosition += 10; } function fishSwim(fishNumber) { document.getElementById("fishPos").style.left = horizontal + "px"; ++fishPos[fishNumber]; if (fishPos[fishNumber] == 49) fishPos[fishNumber] = 0; } function startSwimming() { setInterval(fish1Swim, 100); } // ]]> </script> </head> <body onload="startSwimming();"> <p><span id="fish1" style= "position:absolute; left:10px; top:10px"><img src="fish1.gif" alt="Image of a fish" /></span></p> <p><span id="fish2" style= "position:absolute; left:10px; top:120px"><img src="fish3.gif" alt="Image of a fish" /></span></p> <p><span id="fish3" style= "position:absolute; left:10px; top:250px"><img src="fish2.gif" alt="Image of a fish" /></span></p> </body> </html> I am really not understanding and in my book it only give me a page to read about the animation. I am still new to it. Thanks for looking I'm not sure if this is the correct forum or not, but here goes. I want to make a very simple XUL document. Just a simple basic window to be opened up, but, i want the XUL to Load and Render an HTML File. I'm not sure about what function(s) to call to achieve this, can anyone give me any ideas to go on? here's what i have so far use my JavaScript Function called LoadFromDisk(FileName), if the file is there or the load is sucessfull, it can be stored as a variable. And then i have a single Division in the XUL document called RenderWindow. From there i set the innerHTML of the RenderWindow to the data that was loaded from the disk. Is this the right way? thanks I was asked to redo a menu for this site: http://www.listlabs.com/index.php It was originally an imaged based menu, but they wanted it all changed to css/html. I used quickmenu and it used JS to produce the arrows at the top of each menu item. Now to my question... I'm trying to program the menu items to stay active when on the current page. At first, it looks correct, but if you hover back over the menu, it changes back to the inactive state. Any help would be great! Thanks. Could someone please take a look at my code? It's a simple quiz with one multiple choice question and one fill in the blank. When the user clicks on 'submit' I tried to show some kind of response with correct/incorrect images next to the question. It works with the multiple choice question, but not with the fill in the blank. How can I get the fill in the blank question to work. It always shows the answer as being wrong. Thank you. Quote: answer_list = [ ['False'], ['body','hips','knees'] // Note: No comma after final entry ]; response = []; function setAnswer(question, answer) { response[question] = answer; } function CheckAnswers() { var correct = 0; var flag, resp, answ; for (var i = 0; i < answer_list.length; i++) { flag = false; for(var j=0; j<answer_list[i].length; j++){ resp = response[i].toLowerCase(); answ = answer_list[i][j].toLowerCase(); ################################################################################################# if (response[0] == answer_list[0]) { flag = true; document.myquiz.a1c.style.backgroundImage="url('correct.gif')"; } else{ document.myquiz.a1c.style.backgroundImage = "url('incorrect.gif')"; document.myquiz.a1c.value = " ANS: False. Position the head snugly against the top bar of the frame and then bring the foot board to the infant's feet."; } if (response[1] == answer_list[1]) { flag = true; document.myquiz.a1d.style.backgroundImage="url('correct.gif')"; } else{ document.myquiz.a1d.style.backgroundImage = "url('incorrect.gif')"; } ################################################################################################### } if (flag) { correct++; } } document.writeln("You got " + correct + " of " + answer_list.length + " questions correct!"); } </SCRIPT> </HEAD> <FORM name="myquiz"> <B>1. When measuring height/length of a child who cannot securely stand, place the infant such that his or her feet are flat against the foot board.</B> <label><INPUT TYPE=radio NAME=question0 VALUE="True" onClick="setAnswer(0,this.value)">True</label> <label><INPUT TYPE=radio NAME=question0 VALUE="False" onClick="setAnswer(0,this.value)">False</label> <textarea rows="2" cols="85" name="a1c" style="background-repeat:no-repeat"></textarea> <B>2. When taking a supine length measurement, straighten the infant's <INPUT id="test" TYPE=text NAME=question1 size=10 onChange="setAnswer(1, this.value)">, <INPUT id="test" TYPE=text NAME=question1 size=10 onChange="setAnswer(1, this.value)">, and <INPUT id="test" TYPE=text NAME=question1 size=10 onChange="setAnswer(1, this.value)">.</B> <textarea rows="2" cols="85" name="a1d" style="background-repeat:no-repeat"></textarea> <INPUT TYPE="button" NAME="check" VALUE="Check Answers" onClick=CheckAnswers()> </FORM> </div> </FONT> </BODY> </HTML> Hi all I am doing an assigment and have gotten to the end and cannot get the unordered list to work. If I try having my </script> tag below the </ul> it does not display anything If i have it above it will only display the varible names or what ever I type between the <li> </li> tag and not the varible assigment. num1,2,3,4 being the varible name. ie. </script> <ul> <li>num1</li> I have tryed <li>+num2+</li> also tryed <li>(num3)</li> also tryed <li>'num4'</li> also tryed and does not display </ul> </head> </html> The following does not display any thing <ul> <li>num1</li> I have tryed <li>+num2+</li> also tryed <li>(num3)</li> also tryed <li>'num4'</li> also tryed </ul> </script> </head> </html> I need to get the <li></li> to display not what I type in there but the assigment of the varible name I put in there.,or the output the varible calculation produces. Hope that was easy to understand lol Any advise would be awesome, cheers Shayne Darcy. Hello, i haven't understood how to find the id from buttons, links, button images to auto click yet for example, i want to CLICK HERE how can i do that? how i find the id (I Own firefox with firebug and know basic html) it will be something like javascript:document.GetElementById('id').click(); right? but just want to know how to find or create ids on sites for auto click thanks You are given a mathematical expression containing integers and the basic operations: *,+,-, /. Find the number of unique results that can be obtained by parenthesizing the expression differently. i.e., by changing the order of evaluation of the operations. Note that all operations are integer operations. For example, if the input is 2 ∗ 3 + 6/2, your output should be 4. Plzz help me with this qs......... Hi all, I am trying to do a simple "animation" of the background color of a button. I want it to do 10 different colors in the course of 1 second. I have a loop like this (pseudo code): Code: var e = "the button element"; var c = 10; while (c--) { setTimeout(function(){ e.style.backgroundColor=(random color); }, (c * 100)); } I expect that 10 instances of "setTimeout" would be created, each one timing out 0.1 seconds later than the previous one, giving me an "animation" of 10 different colors over the course of 1 second. Strangely, it doesn't work. All it does is WAIT one second, then set the background to the LAST color. What am I doing wrong? I can't see it. Thanks! -- Roger Edit: I also tried to do the loop forward instead... no difference. Hi Chaps, I have a PHP form with one input and a button. A jQuery script ('loading' animated gif) is triggered on the click of the submit button. I also have a Spry Validation field linked to the input. At the moment, if the validation is triggered, the animated gif continues and won't stop. The furthest I've managed to get with it, is to click the validation message to stop the animation, but what I'm really after is to stop the animation when the validation is visible/triggered, but I can't find a suitable Event. Code: <script type="text/javascript"> $(function() { $("#button_download") .click(function() { }) .throbber(); $("#sprytextfield1") .click(function(sprytextfield1) { $.throbberHide(); }) }); </script> If someone can point me in the right direction, that would be sweet. Is there a way to have functions execute sequentially, rather than additively, using setTimeout? The problem here is varying browser speeds. Say we have some functions and they're set to fire after certain intervals, to create a rhythm. If you set them this way: Code: fn1(); setTimeout('fn2()',3000); setTimeout('fn3()',5000); and fn2() takes approx 1600ms to complete, there should be a 400ms pause before fn3(). But no two browsers are the same: the rhythm is at the mercy of browser speed. In some browsers, fn3() will fire before fn2 is finished. It sounds finicky, but it's like looking at a cut in a film: it's either smooth and not noticed, or it jars. Is there a way to execute which says: "do fn1(); when it's finished, wait 3 seconds and do fn2(); when it's finished, wait 400ms and do fn3()" ? cheers. I have been searching through the forums and have not been able to find exactly what I am looking for. I built my web site a while back using Flash. Right now I am trying to convert it to a non-Flash site. I am trying to duplicate my slideshow, with a caption, and forward/back button in javascript. If anyone can offer advice on how to do this I would greatly appreciate it. my current flash site: http://moparch.com/moparch/architecture/msbe/msbe.html Thanks in advance. P.S. I am brand new to javascript. My experience is limited to the few online tutorials that I have worked through. I was planning on using Dreamweaver (which I am already familiar with) to assemble the final site once I get the necessary javascript figured out. Is there a way to store user input or a way to send user input to an email or log file, so that it is stored.. Or would I have to use something else to do this, like php..?? Dont really know much about php, so was wanting to know if i could use javascript doing this??? Here is my code... Code: <LINK href="color.css" rel="stylesheet" type="text/css"> <script type= "text/javascript"> <-- <-![CDATA[ function validatForm() { if (document.forms[0].userName.value == "" ) { alert("Name field cannot be empty."); return false; } //end if if (document.forms[0].userAge.value < 18) alert("You must be 18 or older to join."); return false; } //end if if (document.forms[0].userEmail.value == "" ) { alert("Email field cannot be empty."); return false; } //end if if (document.forms[0].userPassword.value == "" ) { alert("Password field cannot be empty."); return false; } //end if alert("Thank you for filing out the register"); return true; }// end function validatForm // ]]> --> </script> Code: <form method="post" action="http://webdevfoundations.net/scripts/formdemo.asp" onsubmit="return validateForm();"> <table> <tr> <td> <label for="userName">Name:</label> </td> <td> <input type="text" name="userName" id="userName"/> </td> </tr> <tr> <td> <label for="userAge">Age:</label> </td> <td> <input type="text" name="userAge" id="userAge"/> </td> </tr> <tr> <td> <label for="userEmail">Email:</label> </td> <td> <input type="text" name="userEmail" id="userEmail"/> </td> </tr> <tr> <td> <label for="userPassword">Password:</label> </td> <td> <input type="text" name="userPassword" id="userPassword"/> </td> </tr> <tr> <td colspan="2"> <input type="submit" value="Send information" /> </td> </tr> </table> </form> Ok, i am new to JavaScript and i am self teaching myself as i type this. Now here is my question: Is there a way using JavaScript or another web programming language to see where users came from before visiting your site. If it was a specific page I created could you have JavaScript functions that would change components on the website. (see example for better detail) Here is an example: My website home page, lets call it "HomePage" has an image called "LogoA" on the top of the page. Now if a user visited a specific page I created with in my website, we can call it "LandingPageA", and on LandingPageA they clicked a link that sent the user to my HomePage, could there be a command in JavaScript or another programming language that would say, Ok if user came from LandingPageA then load LogoA on HomePage. If user came from LandingPageB then load LogoB on HomePage if user came from LandingPageC then load LogoC on HomePage? If it is a confusing question i apologize. I can clarify if you needed it. I appreciate any help or info to lead me to a solution. Thanks -B I would like to type something into my textbox and then press ENTER, it will execute a function. I tried onFocus, onChange and onBlur but it doesn't do what I want it to. Here's an example I use for onChange. Code: Application: <input type="text" onchange="execProg(0);"> Any comments or suggestions is greatly So, I've built this navigation bar so far and I'm curious if it's even possible to achieve what I'm thinking. Currently, when you hover over each of the links they drop down (padding is increased). Now, what I'm curious in doing is if you hover over say "test1", test2-4 also drop with it but in the padding that has been created from the drop down, "test1" information shows up. Allowing the user to click or read whatever information is in there. Also, if the user would like to, they can move their mouse to test2 and everything would animate (opacity, this I can do I think) to whatever is in the test2 field, test3 doing the same and so on. I haven't had much success with this, I've created a completely separate panel before, but that didn't exactly work or I wasn't doing it correctly. Here is what I've been working on, ANY help would be appreciated! Thanks! Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(function() { $("#nav li > a").hover(function() { $(this).stop().animate({paddingTop: "100px"}, 100); }, function() { $(this).stop().animate({paddingTop: "10px"}, 200); }); }); </script> <style type="text/css"> #nav { position: absolute; top: 0; left: 60px; padding: 0; margin: 0; list-style: none; } #nav li { display: inline; } #nav li a { float: left; display: block; color: #555; text-decoration: none; padding: 10px 30px; background-color: #d1d1d1; border-top: none; } </style> </head> <body> <div id="wrap"> <ul id="nav"> <li><a href="">test1</a></li> <li><a href="">test2</a></li> <li><a href="">test3</a></li> <li><a href="">test4</a></li> </ul> </div> </body> </html> |