JavaScript - Adding Php To Geolocation Script
Similar TutorialsHi, I am creating a mobile web application for a zoo which involves a map and user being able to find your location within the zoo. I have a working prototype which works my finding your Longitude and Latitude and based on where your standing the map will move to your location. Here is the code: Code: function getLocation() { // Get location no more than 10 minutes old. 600000 ms = 10 minutes. navigator.geolocation.getCurrentPosition(showLocation, showError, {enableHighAccuracy:true,maximumAge:600000}); if (position.coords.latitude == 37.331689 && position.coords.longitude == -122.030731) camera.className = 'part-penguin', document.getElementById("penguinholder") .src="graphics/penguin-here.png", document.getElementById("link") .href="penguins.html", alert('You are standing nearby the penguins!'); } else alert('You appear to be out of the Zoo grounds! Please return to the area and try again.'); } Currently the user has to be standing at a specific point in order for it to work as it only takes 1 Latitude coordinate and 1 Longitudinal reference point. What I would like it to do would be to check between 2 Latitude points and 2 longitude points (i.e. a square area) and as long as the user is standing between these points it will do what i want. Please help.. Thanks.. Hi. i,m trying to make a map who show me as position A and a target adress as point B.I have made it so i can choose adress a and adress b from a dropdown but i want to automaticly load my position as possition A then choose position B from a dropdownlist. How can i do this ? Thanks Natrox <!DOCTYPE html> <html> <head> <title>Google Maps JavaScript API v3 Example: Map Geolocation</title> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <meta charset="UTF-8"> <link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" /> <!-- Include the maps javascript with sensor=true because this code is using a sensor (a GPS locator) to determine the user's location. See: http://code.google.com/apis/maps/doc...ecifyingSensor --> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&language=nb_NO"></script> <!--<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=true&language=nb_NO"> --> <script type="text/javascript"> var map; var directionDisplay; var directionsService; var stepDisplay; var markerArray = []; var initialLocation; //var oslo = new google.maps.LatLng(59.947639, 10.884469); var browserSupportFlag = new Boolean(); function initialize() { directionsService = new google.maps.DirectionsService(); // Create a map and center it on Manhattan. var oslo = new google.maps.LatLng(59.947639, 10.884469); var myOptions = { zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP, center: oslo } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); // Create a renderer for directions and bind it to the map. var rendererOptions = { map: map } directionsDisplay = new google.maps.DirectionsRenderer(rendererOptions) // Instantiate an info window to hold step text. stepDisplay = new google.maps.InfoWindow(); } function calcRoute() { // First, remove any existing markers from the map. for (i = 0; i < markerArray.length; i++) { markerArray[i].setMap(null); } // Now, clear the array itself. markerArray = []; // Retrieve the start and end locations and create // a DirectionsRequest using DRIVING directions. var start = document.getElementById("sart").value; var end = document.getElementById("end").value; var request = { origin: start, destination: end, travelMode: google.maps.DirectionsTravelMode.DRIVING }; // Route the directions and pass the response to a // function to create markers for each step. directionsService.route(request, function(response, status) { if (status == google.maps.DirectionsStatus.OK) { var warnings = document.getElementById("warnings_panel"); warnings.innerHTML = "<b>" + response.routes[0].warnings + "</b>"; directionsDisplay.setDirections(response); showSteps(response); } }); } function showSteps(directionResult) { // For each step, place a marker, and add the text to the marker's // info window. Also attach the marker to an array so we // can keep track of it and remove it when calculating new // routes. var myRoute = directionResult.routes[0].legs[0]; for (var i = 0; i < myRoute.steps.length; i++) { var marker = new google.maps.Marker({ position: myRoute.steps[i].start_point, map: map }); attachInstructionText(marker, myRoute.steps[i].instructions); markerArray[i] = marker; } } function attachInstructionText(marker, text) { google.maps.event.addListener(marker, 'click', function() { // Open an info window when the marker is clicked on, // containing the text of the step. stepDisplay.setContent(text); stepDisplay.open(map, marker); }); } // Try HTML5 geolocation if(navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { var pos = new google.maps.LatLng(position.coords.latitude, position.coords.longitude); var infowindow = new google.maps.InfoWindow({ map: map, position: pos, content: 'Du er her.' }); map.setCenter(pos); }, function() { handleNoGeolocation(true); }); } else { // Browser doesn't support Geolocation handleNoGeolocation(false); } function handleNoGeolocation(errorFlag) { if (errorFlag) { var content = 'Error: The Geolocation service failed.'; } else { var content = 'Error: Your browser doesn\'t support geolocation.'; } var options = { map: map, position: new google.maps.LatLng(60, 105), content: content }; var infowindow = new google.maps.InfoWindow(options); map.setCenter(options.position); } function detectBrowser() { var useragent = navigator.userAgent; var mapdiv = document.getElementById("map_canvas"); if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1 ) { mapdiv.style.width = '100%'; mapdiv.style.height = '100%'; } else { mapdiv.style.width = '600px'; mapdiv.style.height = '800px'; } } google.maps.event.addDomListener(window, 'load', initialize); </script> </head> <body onload="initialize()"> <div style="text-align:center"> <select id="start"> <option value="625 8th Avenue, New York, NY, 10018">Port Authority Bus Terminal</option> <option value="staten island ferry terminal, new york, ny">Staten Island Ferry Terminal</option> <option value="101 E 125th Street, New York, NY">Harlem - 125th St Station</option> </select> <select id="end" onchange="calcRoute();"> <option value="Brubakkveien 14 1083 Oslo">Sigvartsen proffavdeling</option> <option value="Sonja Henies plass 3, 0185 Oslo">Oslo plaza</option> <option value="moma, New York, NY">MOMA</option> <option value="350 5th Ave, New York, NY, 10118">Empire State Building</option> <option value="253 West 125th Street, New York, NY">Apollo Theater</option> <option value="1 Wall St, New York, NY">Wall St</option> </select> </div> <div id="map_canvas"></div> <div id="pos"></div> <div id="warnings_panel"></div> </body> </html> Hi There, I'm working on an application that potentially gets 1000s of geolocation queries per day and if I don this (as I've done it till now) in php, it works fine but I quickly run into OVER_QUERY_LIMIT error from the google map apis. Thus I think I'd better do it in javascript and just send the coordinates to the server for caching rather than querying from the server's IP. Now the url that sends back the location information looks like this: http://www.google.com/url?sa=D&q=htt...s3czv6-nMr_nbw and I was wondering how I can send a request to this url and parse the xml string that's returned with JavaScript to pass it on to a php (probably by get variables). Is there a handy method that's compatible accross a bunch of browsers incl. mobile ones? Thanks very much for some input! Ron Hey all, I'm playing with a greasemonkey script and would like to provide geo-locating. The geolocation services I've found all require dev/api-key. A dev-key means I reveal my well-earned key, or an api-key usually means a server address... there would be none via a greasemonkey script. Any ideas for gathering geolocation services? Any links, tips, ideas welcome! 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> I have no idea what to change in order to do this so I'm hoping someone can help Basically this is a menu I have which I'm using in wordpress. Wordpress puts 'current' on the current page, so the menu knows which list item to keep highlighted. On one of my pages however, it is hidden from the menu, therefor NONE of the list items contain 'current'. It makes the menu look bad when you are on this page. What I'd like to do to this code, is add a very small feature that checks if none of the list items have 'current'. If none of the li's contain current, then just apply it to li:first-child (which is my home button). I'm not familiar with javascript, but I feel that would be doable from just the script that I'm pasting below. Code: /** * LavaLamp - A menu plugin for jQuery with cool hover effects. * @requires jQuery v1.1.3.1 or above * * http://gmarwaha.com/blog/?p=7 * * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * * Version: 0.2.0 * Requires Jquery 1.2.1 from version 0.2.0 onwards. * For jquery 1.1.x, use version 0.1.0 of lavalamp */ (function(jQuery) { jQuery.fn.lavaLamp = function(o) { o = jQuery.extend({ fx: "linear", speed: 500, click: function(){} }, o || {}); return this.each(function() { var me = jQuery(this), noop = function(){}, jQueryback = jQuery('<li class="back"><div class="left"></div></li>').appendTo(me), jQueryli = jQuery("li", this), curr = jQuery("li.current", this)[0] || false; if (curr == false){jQuery(".back").remove();return false;} jQueryli.not(".back").not("#nav ul li").hover(function() { move(this); }, noop); jQuery(this).hover(noop, function() { move(curr); }); jQueryli.click(function(e) { setCurr(this); return o.click.apply(this, [e, this]); }); setCurr(curr); function setCurr(el) { jQueryback.css({ "left": el.offsetLeft+"px", "width": el.offsetWidth+"px" }); curr = el; }; function move(el) { jQueryback.each(function() { jQuery(this).dequeue(); } ).animate({ width: el.offsetWidth, left: el.offsetLeft }, o.speed, o.fx); }; }); }; })(jQuery); Hi, I want to add a cookie in this script to show the popunder once a day. Can someone help me to change the following code to make it work ? Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Popunder</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> </head> <body> <form id="popSubmit" action="http://www.google.com"> <input type="submit" /> </form> <script type="text/javascript"> (function($) { $.popunder = function(sUrl) { var _parent = self; var bPopunder = ($.browser.msie && parseInt($.browser.version, 10) < 9); if (top != self) { try { if (top.document.location.toString()) { _parent = top; } } catch(err) { } } var sOptions = 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,width=' + (screen.availWidth).toString(); sOptions += ',height=' + (screen.availHeight).toString() + ',screenX=0,screenY=0,left=0,top=0'; var popunder = _parent.window.open(sUrl, 'pu_' + Math.floor(89999999*Math.random()+10000000), sOptions); if (popunder) { popunder.blur(); if (bPopunder) { window.focus(); try { opener.window.focus(); } catch (err) { } } else { popunder.init = function(e) { with (e) { (function() { if (typeof window.mozPaintCount != 'undefined') { var x = window.open('about:blank'); x.close(); } try { opener.window.focus(); } catch (err) { } })(); } }; popunder.params = { url: sUrl }; popunder.init(popunder); } } return this; } })(jQuery); $('#popSubmit').submit(function() { jQuery.popunder('http://www.facebook.com'); }); </script> </body> </html> Hi, I am using this script which is nearly working correctly, but not quite! When a user selects some text from the web-page and copies it, the script is supposed to pick up the current web-page url and create a resource box or credit line that is added to the selected text when the data is pasted. You will see that the meta keywords are used (randomly) as the anchor text and this should be wrapped with the href= tags in order to create a link. Thats the bit that is not workink, but I can not see why. Here is the complete script. Code: function init(){ // Options: var useMetaKeyword = true; // Otherwise, page title var minLength = 40; // Min selection chars var useMetaAuthor = true; // Otherwise use domain var addLinks = true; // Otherwise, just cite at end var skip = new Array("home","link","click here"); // Don't link these (lowercase!) function D(b,a,c){ if(b.addEventListener)b.addEventListener(a,c,false); else b.attachEvent&&b.attachEvent("on"+a,c)} function o(b,a){ if(typeof b=="undefined"||b==null||!RegExp)return false; a=new RegExp("(^|\\s)"+a+"(\\s|$)"); if(typeof b=="string")return a.test(b); else if(typeof b=="object"&&b.className)return a.test(b.className);return false} function E(b,a){ var c=false,j; for(j=b.parentNode;j!=undefined;){ if(b.parentNode==e.body)break; else if(b.parentNode==a){c=true;break}j=j.parentNode}return c} function F(b){ return b.replace(/^\s*/,"") } function G(b){ return b.replace(/\s*$/,"") } function H(b){ return G(F(b)) } var I=new Array("home","link","click here"), e=document, x=window, t=e.getElementsByTagName("body")[0], p=e.getElementsByName("author"), i=e.getElementsByName("keywords"), q=x.location.toString(), u=e.title.toString(), d;if(!Array.indexOf)Array.prototype.indexOf=function(b,a){ var c=-1; for(a=a|0;a<this.length||a==-1;a++) if(this[a]==b)c=a;return c}; if(i.length>0&&useMetaKeyword){ i=e.getElementsByName("keywords")[0].getAttribute("content").split(","); u=Math.floor(Math.random()*i.length); i=i[u].replace(/^\s*|\s*$/,"")} else i=u; p=(p.length>0&&useMetaAuthor)?p[0].getAttribute("content"):e.domain; var y="<p id='credit'><br/>Read more about <a href='"+q+"'>"+i+"</a> by <a href='http://"+e.domain+"' />"+p+"</a></p>"; if(/MSIE/g.test(navigator.userAgent))var v="msie"; else if(/Safari/g.test(navigator.userAgent))v="safChrome"; q=e.createElement("span");q.setAttribute("id","sasText"); t.appendChild(q); d=e.getElementById("sasText"); posType=document.all&&!window.opera&&!window.XMLHttpRequest?"absolute":"fixed"; d.style.position=posType; d.style.top="0px"; d.style.left="-9999px"; D(t,"copy",function(){d.innerHTML=y; if(v=="msie"){ for(var b=e.selection.createRange(), a=b.parentElement(); a.nodeName!="BODY"&&!o(a,"lbExclude");)a=a.parentNode; if(o(a,"lbExclude"))return true; a=e.body.createTextRange(); a.moveToElementText(d); var c=b.duplicate(); c=c.htmlText; if(c.length>minLength){ d.id="tempSasText"; d.innerHTML=c+y; (c=e.getElementById("sasText"))&&c.parentNode.removeChild(c); d.id="sasText";a.select()}} else{b=x.getSelection(); for(a=b.anchorNode;a.nodeName!="BODY"&&!o(a,"lbExclude");)a=a.parentNode; if(o(a,"lbExclude"))return false; if(b==""&&v=="safChrome"){ d.innerHTML=t.innerHTML; a=document.createRange(); b.removeAllRanges(); a.selectNodeContents(d);b.addRange(a)} else if(b.toString().length>minLength){ var j=e.getElementById("credit"); a=b.getRangeAt(0); c=a.cloneContents(); d.id="tempSasText"; d.insertBefore(c,j); (c=e.getElementById("sasText"))&&c.parentNode.removeChild(c); d.id="sasText"; b.removeAllRanges(); a.selectNode(d); b.addRange(a)}} var w=[];a=d.getElementsByTagName("a");for(b=0;b<a.length;b++)w.push(a[b].href); if(addLinks){a=e.getElementsByTagName("a"); for(b=0;b<a.length;b++){var r=a[b].href; if(w.indexOf(r)==-1)if(E(a[b],d)==false){ var f=H(a[b].innerHTML).toLowerCase(); if(skip.indexOf(f)==-1) if((new RegExp(e.domain,"g")).test(r)){ var z=[]; function n(g,k,l){ for(var A=g.childNodes.length;A-- >0;){ var h=g.childNodes[A]; if(h.nodeType===1)h.tagName.toLowerCase()!=="a"&&n(h,k,l); else if(h.nodeType===3) for(var m=h.data.length;1;){ m=h.data.lastIndexOf(k,m); if(m===-1||z.indexOf(k.toLowerCase())!==-1)break; var B=/\w/; if(h.nodeValue.charAt(m-1).match(B)||h.nodeValue.charAt(m+f.length).match(B))break; l.call(window,h,m)}}} function s(g,k){g.splitText(k+f.length); var l=e.createElement("a"); l.href=r;l.appendChild(g.splitText(k)); g.parentNode.insertBefore(l,g.nextSibling); z.push(f.toLowerCase()); w.push(r)}n(d,f,s);f=f.charAt(0).toUpperCase()+f.slice(1);n(d,f,s); f=f.toUpperCase(); n(d,f,s);f=f.replace(/\w\S*/g,function(g){ return g.charAt(0).toUpperCase()+g.substr(1).toLowerCase()});n(d,f,s)}}}}})} window.onload=init; I have put the script on this page: test page To test it, just go to that page, highlight some text (at least 40 characters) copy it, and then paste it into your editor or notepad. You can see that it is picking up some info and writing the attribute line but it doesn't create the link If it helps get it working, I am happy to slim the code down by excluding some features. Any ideas ? Hello - I'm trying to add a fade effect between slideshow transitions. The script I'm building from is the Rich HTML Slideshow script which appears below. The slides that rotate are wrapped in <div> tags with a class of "dyncontent" and I've managed to make the slideshow transition just fine, but not with any kind of fade effect. It just "snaps" from one slide to the next. Is this a fairly simple addition? Thanks! <script type="text/javascript"> if (document.all || document.getElementById){ //if IE4 or NS6+ document.write('<style type="text/css">\n') document.write('.dyncontent{display: none; width: 250px; height: 60px;}\n') document.write('</style>') } var curcontentindex=0 var messages=new Array() function getElementByClass(classname){ var inc=0 var alltags=document.all? document.all : document.getElementsByTagName("*") for (i=0; i<alltags.length; i++){ if (alltags[i].className==classname) messages[inc++]=alltags[i] } } function rotatecontent(){ //get current message index (to show it): curcontentindex=(curcontentindex<messages.length-1)? curcontentindex+1 : 0 //get previous message index (to hide it): prevcontentindex=(curcontentindex==0)? messages.length-1 : curcontentindex-1 messages[prevcontentindex].style.display="none" //hide previous message messages[curcontentindex].style.display="block" //show current message } window.onload=function(){ if (document.all || document.getElementById){ getElementByClass("dyncontent") setInterval("rotatecontent()", 2000) } } </script> Hello Everyone, I am in the process of creating a billboard script for our company front page which will switch between two images. I am using the following script as a base: http://tympanus.net/codrops/2009/12/...query-and-css/ I am eager to learn coding, but am still a novice at it so I was wondering if anyone could assist me with adding the following functionality: 1. Rather than (or perhaps in addition to) having the two images change based on a timer, I'd like to be able to insert a "next" arrow. Therefore I will need assistance in coding a button to change the images from "ad_1" to "ad_2" which is currently done automatically by the interval timer 2. I'd like to make the images clickable with unique destinations (so when you click on "ad_1" it will take you to "link 1", "ad_2" will take you to "link 2" Below is my current code: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <title>Rotating Billboard with jQuery</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8"/> </head> <body> <div class="palmtrees"></div> <div class="powerline"></div> <div class="city"></div> <div class="container"> <div class="ad"> <div id="ad_1" class="ad_1"> <img class="slice_1" src="ads/ad1_slice01.jpg"/> <img class="slice_2" src="ads/ad1_slice02.jpg"/> <img class="slice_3" src="ads/ad1_slice03.jpg"/> </div> <div id="ad_2" class="ad_2"> <img class="slice_1" src="ads/ad2_slice01.jpg"/> <img class="slice_2" src="ads/ad2_slice02.jpg"/> <img class="slice_3" src="ads/ad2_slice03.jpg"/> </div> </div> </div> <div class="billboard"></div> <a class="back" href="http://tympanus.net/codrops/2009/12/16/creating-a-rotating-billboard-system-with-jquery-and-css/"><a> <script src="jquery-1.3.2.js" type="text/javascript"></script> <script> $(function() { $('#ad_1 > img').each(function(i,e){ rotate($(this),500,10000,i); }); function rotate(elem1,speed,timeout,i){ elem1.animate({'marginLeft':'18px','width':'0px'},speed,function(){ var other; if(elem1.parent().attr('id') == 'ad_1') other = $('#ad_2').children('img').eq(i); else other = $('#ad_1').children('img').eq(i); other.animate({'marginLeft':'0px','width':'266px'},speed,function(){ var f = function() { rotate(other,speed,timeout,i) }; setTimeout(f,timeout); }); }); } }); </script> </body> </html> And here is a working example: http://www.santamarinas.com/RS/Tests/Billboard/ Thank you in advance for your help!! I want to insert this star trail effect script to page below but star trail doesn't appear on most areas and script corrupts several objects' position. How can I insert it successfully? http://www.orkinosfilm.com/melissa/index.html Code: <head> <style type="text/css"> body {overflow: scroll; overflow-x: hidden;} .anyClass { position: relative; visibility: hidden; left: -5000px; } </style> </head> <body bgcolor="#000000"> <p><!--webbot bot="HTMLMarkup" startspan --><script language="JavaScript1.2"> <!-- /* Submitted by Marcin Wojtowicz [one_spook@hotmail.com] Featured on JavaScript Kit (http://javascriptkit.com) Modified by JK to be IE7+/ Firefox compatible For this and over 400+ free scripts, visit http://javascriptkit.com */ var trailLength = 10 // The length of trail (8 by default; put more for longer "tail") var path = "cursor_star.png" // URL of your image var standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes var i,d = 0 function initTrail() { // prepares the script images = new Array() // prepare the image array for (i = 0; i < parseInt(trailLength); i++) { images[i] = new Image() images[i].src = path } storage = new Array() // prepare the storage for the coordinates for (i = 0; i < images.length*3; i++) { storage[i] = 0 } for (i = 0; i < images.length; i++) { // make divs for IE and layers for Navigator document.write('<div id="obj' + i + '" style="position: absolute; z-Index: 100; height: 0; width: 0"><img src="' + images[i].src + '" width='+(16-i)+' height='+(16-i)+'></div>') } trail() } function trail() { // trailing function for (i = 0; i < images.length; i++) { // for every div/layer document.getElementById("obj" + i).style.top = storage[d]+'px' // the Y-coordinate document.getElementById("obj" + i).style.left = + storage[d+1]+'px' // the X-coordinate d = d+2 } for (i = storage.length; i >= 2; i--) { // save the coordinate for the div/layer that's behind storage[i] = storage[i-2] } d = 0 // reset for future use var timer = setTimeout("trail()",10) // call recursively } function processEvent(e) { // catches and processes the mousemove event if (window.event) { // for IE storage[0] = window.event.y+standardbody.scrollTop+10 storage[1] = window.event.x+standardbody.scrollLeft+10 } else { storage[0] = e.pageY+12 storage[1] = e.pageX+12 } } initTrail() document.onmousemove = processEvent // start capturing //--> </script><!--webbot bot="HTMLMarkup" endspan --></p> </body> Hi All, I have two scripts which I want to try and integrate. I am using a nice gallery script to show thumbnails which are appended to a an image wrapper which on click of the thumbnail shows the larger image in the image wrapper, I am trying to implement cloud zoom which is a plugin which uses image srcs to then point to an anchor href to show another larger zoom image either in the same place.. which is what I am trying to do or in another div beside. I have had to set me img srcs up in a certain way to easily enter some product details. and I need to try an manipulate the code to make it work to suit my file layout. I am using a var= images [ with a series of file locations and info such as below { src: 'romanticabride/thumbs/tn_Shauna.jpg', srcBig: 'romanticabride/images/Shauna.jpg', title: 'Shauna', longDescription: '<b><H1>Shauna</H1></b><br><b>Romantica Of Devon <br><br><h2>Sizes Available:</h2><br> 6 - 32.<b><br><b><br><b><b><b><H2>Colours Available:</h2><b><br>Various<br>Please Enquire Below<br><br><br><br><a href="mailto:tracy@cherishbridal.co.uk?subject=Web Enquiry Regarding Romantica Shauna Bridal Gown"class="enquiry rose glow" >Click To Enquire About This Item </a>' }, what I need is for cloud zoom to work when the main image wrapper is hovered over which means it will need to add a class or when the whichever srcBig: is hovered over it gets wrapped by href to make the script work . one of my pages is http://www.cherishbridal.co.uk/romaticabride.html the cloud zoom script is at http://www.professorcloud.com/mainsite/cloud-zoom.htm.. I am happy to share a jsfiddle with someone or explain further or post some code. Thank you in advance does any expert know how to pass parameters in the <script ..> tag? for instance; Code: <script type="text/javascript" src="script.js ?param1=val1¶m2=val2&etc "> in the javascript script.js, how would we read the params after the question mark? for example, google this; google shopping cart /v2_2/cart.js I have a script that works in seamonkey(my html editor) but when I use it in IE8 it says errors happen. Here's the code (the first line is on line 7 of the html file): Code: <script type="text/javascript"> function enlarge(imageNum) { var numToString = ""; if(parseInt(imageNum) < 10){ numToString = "0" + imageNum; } else { numToString = imageNum + ""; } window.open("images/LgScreenshot"+numToString+".jpg","Screenshot "+imageNum,"status=0,height=675,width=900,resizable=0"); } </script> And the errors: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB0.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.30729; InfoPath.3; .NET CLR 3.0.30729) Timestamp: Wed, 10 Feb 2010 14:58:16 UTC Message: Object expected Line: 150 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html Message: Invalid argument. Line: 18 Char: 1 Code: 0 URI: http://samssc2site.co.cc/Features.html 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 On this website: http://evancoleman.net/index.php I really like on the top how the menu has like 5 or 6 icons, and when you hover over them it shows a bubble with the name in them. Does anybody know where I can find this script? Thanks. Ok lol don't mock me, I'm only new to javascript. I'm trying to get the text that contains "The Moderating Team" "Today's Active Topics" etc. an id to the div they are contained in. Here's my code so far: Code: <script type="text/javascript"> var c = getElementByClass("div"); if ( c.innerHTML.contains(" The Moderating Team ") ) { } </script> Any help? Oh and my site: http://stereo.b1.jcink.com I'm using a PHP script which has a pop-up box that, when the thumbnail is selected, the video player dynamically appears in the pop-up box. It is outdated, and not working correctly(see attached image), so I'm trying to replace it with venobox: VenoBox - responsive jQuery modal window plugin So far, I've uploaded the venobox folder, and added this: Code: <head> <!-- Add jQuery library --> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script> <!-- Add venobox --> <link rel="stylesheet" href="venobox/venobox.css" type="text/css" media="screen" /> <script type="text/javascript" src="venobox/venobox.min.js"></script> </head> Now it says to: "Insert one or more links with its custom class": Code: <a class="venobox" href="image01-big.jpg"><img src="image01-small.jpg" alt="image alt"/></a> <a class="venobox_custom" data-type="iframe" href="http://www.veno.it">open iFrame</a> For Google Maps use the iFrame href attribute of map's embed code and set data-type="iframe" "For videos use the simple url of the video, such as: http://www.vimeo.com/your_video_id, or http://www.youtu.be/your_video_id" The GreyBox that I'm currently using, I believe the code is this: Code: <tr> <td width="10px"><a href="/videos/[blk1.vid_id;block=div]/" rel="gb_page_center[470,370]" style="float:right"><br /> <img src="/uploads/thumbs/[blk1.video_id;block=div].jpg" alt="video pic" width="120" height="90" border="0" /></a></td> <td width="400px"><!--[var.lang_title]--><a href="/videos/[blk1.vid_id;block=div]/" rel="gb_page_center[520,600] "> <div class="container88888"><!--[blk1.Title;htmlconv=no;block=div;ope=max:70;comm]--></a><br /> <!--[var.lang_description]:-->[blk1.vid_desc;htmlconv=no;block=div;ope=max:268;comm]</div></td> </tr> So, I don't know what, in VenoBox, is meant by "Insert one or more links with its custom class" and please help me, what I should do with these further set up instructions?: Initialize plugin Code: $(document).ready(function(){ /* default settings */ $('.venobox').venobox(); /* custom settings */ $('.venobox_custom').venobox({ framewidth: '400px', // default: '' frameheight: '300px', // default: '' border: '10px', // default: '0' bgcolor: '#5dff5e', // default: '#fff' titleattr: 'data-title', // default: 'title' numeratio: true, // default: false infinigall: true // default: false }); /* auto-open #firstlink on page load */ $("#firstlink").venobox().trigger('click'); }); Additionally, since I'm trying to get a video to dynamically play in the box, it states: "Data Attributes If the content is not an image you have to specify its type via data attribute data-type" [CODE] <a class="venobox" data-type="iframe" href="http://www.veno.it">Open Iframe</a> <a class="venobox" data-type="inline" title="My Description" href="#inline">Open inline content</a> <a class="venobox" data-type="ajax" href="ajax-call.php">Retrieve data via Ajax</a> <a class="venobox" data-type="youtube" href="http://youtu.be/d85gkOXeXG4">Open YouYbe video</a> <a class="venobox" data-type="vimeo" href="http://vimeo.com/75976293">Open Vimeo video</a> [/CODE} Any help/clarification will be appreciated. Attached Thumbnails to be honest I have no idea where to start, i have a table, with 2 numeric values at the minute, if the checkbox is selected I want the total price to be shown? Any help to get me started would be great! this is the form I have with the numeric values Code: <form id="calculation" action="#" method="post"> 100 <input type="checkbox" name="check1" value="100" onClick='total_cost()'/> 120 <input type="checkbox" name="check2" value="200" onClick='total_cost()'/> Total cost<input type="text" name="total" id="total" readonly="readonly" /> onClick='total_cost()' is referring to the javascript function where I just don't know where to start? Hi, I was trying to add some simple javascript (toggle visibility function of a div) to the FB 'like' button and 'Google +1' button. This to simply create some more visitor interactivity by showing a thank you message for doing so. I've tried by just adding 'onclick=' to the element that actually shows the button, with a <a href="#" onlcick="..."> --element--</a> manner, and with a <span> and a <div> element around it. Neither of them work. The toggle script is 100% correct (using it actively with <a href="javascript:void(0);" onclick="javascript:toggleVisibility('feedbackform')">feedback</a> ) Of course I made sure the div id had correct name and it is unique for the toggle function. Anybody got any ideas on how to go with this? JS: Code: function toggleVisibility(controlId) { if (document.getElementById) { // DOM3 = IE5, NS6 var control = document.getElementById(controlId); if(control.style.display == "") control.style.display = "none"; else control.style.display = ""; } else { if (document.layers) { // Netscape 4 if(document.controlId.display == "") document.controlId.display = "none"; else document.controlId.display = ""; } else { // IE 4 if(document.all.controlId.style.display == "") document.all.controlId.style.display = "none"; else document.all.controlId.style.display = ""; } } } |