JavaScript - Google Translate Help
Hello Everyone!
I'm new to the forums but have a question with Google Translate I'm trying to add to my site. I believe the code for Google Translate is a Java Script and I'd like to put this on my website in the side column. The only thing I would like to modify is a <br> (break) between the Powered by and Google Translate. So I would like it to be center aligned like: Powered by Google Translate Right now it is stretching out the column because of the added space and frustrating me! Any idea how to do this? Here is the code: Code: <div id="google_translate_element"></div><script> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'en' }, 'google_translate_element'); } </script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> My knowledge of javascript and coding in general is very very limited so any changes you make or where I should put the code, definitely let me know Thanks, Phil Similar TutorialsFirst of all, I read the rules regarding how to post a question on the forums, and I couldn't think of a much better description, so I hope thats okay. My problem is this, I am using a simple code (Posted Below) that creates a drop-down menu containing a list of languages, when any of these languages are clicked it sends the user to Google translate to automatically convert the text. The code works fine, but now Im realizing I have no way of knowing which languages are chosen and how often. I have tried linking it to my Google Analytics but to no avail. The only solution I can think of is to send the user to maybe a PHP file that then redirects them to the Google translate page, so I can monitor it by viewing how many times the redirect page was viewed. I already use this redirect technique to track how many users follow my links to external downloads, so I know its probable. But my real question is how would I go about sending the user to a redirect page? I'm a novice web developer by the way. I'm thinking I would have to send the variable containing language to the redirect, along with a variable containing the URL to be translated, and then have the redirect input the data same as the original form. But even if this is possible, I don't know how to go about it. Any help would be greatly appreciated. Quote: <select name="translate" style="height:18px; font-size:10px;" onchange="javascript:window.location = 'http://www.google.com/translate_c?hl=en&langpair=en%7C' + this.value + '&u=' + window.location.href;"> <option value="">Translate This Page</option> <option value="ar">Arabic</option> ...LIST OF OTHER LANGUAGES <option value="es">Spanish</option> </select> Hey I need some advice about Google translate, basically if you go to http://translate.google.com/#en|ja|Hello%20world and hover your mouse over the Japanese writing you will see it glow yellow ant allows you to click it to switch the text to something else to turn the string into the correct translation. What I want advice with is when I use the Google translate API am I able to obtain that list and output them onto my page. For example if a user writes in a textbox "Hello World" I want the API to return the list of possible translations for that string, something like this. Code: Language 1: en Language 2: ja String: Hello World ## Splits the string up by it's words -- Start Hello 1. こんにちは - Hi 2. ハロー - Halo 3. 挨拶 - Greeting 4. 投稿 - Posts World 1. 、世界 - World 2. 世界 - World 3. 世界の - World 4. 世界中 - Worldwide 5. の世界 - World ## Splits the string up by it's words -- End ## Uses each translated word to build a final list with all possible outcomes Hello World - (all possible outcomes) 1. こんにちは、世界 - Hello World 2. こんにちは世界 - Hello World 3. こんにちは世界の - Hello World 4. こんにちは世界中 - Hello world 5. こんにちはの世界 - Hello World 6. ハロー、世界 - Hello World 7. ハロー世界 - Hello World 8. ハロー世界の - Hello World 9. ハロー世界中 - Hello world 10. ハローの世界 - Hello World 11. 挨拶、世界 - Greetings, world 12. 挨拶世界 - Greetings the World 13. 挨拶世界の - Greetings World 14. 挨拶世界中 - Greetings Worldwide 15. 挨拶の世界 - Greetings World 16. 投稿、世界 - Post World 17. 投稿世界 - Post World 18. 投稿世界の - Post World 19. 投稿世界中 - Posts Worldwide 20. 投稿の世界 - Post World ## The final array that will be used for printing to the page. ## Only these have been chosen because the string equals the ## same but also the capital letters are the same as well. 1. こんにちは、世界 - Hello World 2. こんにちは世界 - Hello World 3. こんにちは世界の - Hello World 4. こんにちはの世界 - Hello World 5. ハロー、世界 - Hello World 6. ハロー世界 - Hello World 7. ハロー世界の - Hello World 8. ハローの世界 - Hello World How can I do this, with or without the use of Google's API???? Hello, I think I am posting this in the right spot! I'm trying to add google translate to my mobile website... Because, I want an easy way for koreans to read it. It's a mobile site by dudamobile so my editing ability is limited.. the issue I am having is it works but it is throwing off my scrolling ability and page size and the toolbar and banner was spanning my webite to a very large area which threw off the look of the site. I was able to remove the banner (which I didnt need) by inputing this code into the CSS body {top: 0px !important; position: static !important; } .goog-te-banner-frame {display:none !important} but the drop down bar still has a spand the size a full sized website for some reason I pasted in the following code provided by google translate for the site: <div id="google_translate_element"></div><script> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'en', includedLanguages: 'zh-CN,zh-TW,en,de,ja,ko,th', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element'); } </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> Is there any code that can be added to restrict the size of this bar? again the translate option works outside of this. Thanks Dave I have 2 functions in asp that I need translated to javascript the first checks that there is no email in the textbox. the second checks that there is no phone number can someone help me? here's the asp code Code: Function ExtractEmail(sText) Dim arrWords, x, curWord Dim sEmail, sName, sDomain Dim dotIndex, y 'remove any extra spaces sText = Trim(sText) Do Until InStr(sText, " ")<1 sText = Replace(sText, " ", " ") Loop 'split into words arrWords = Split(sText, " ") 'look for email, initialize return value sEmail = "" For x=0 To UBound(arrWords) curWord = arrWords(x) If LCase(curWord)="at" Then curWord = "@" End If If InStr(curWord, "@")>0 Then If (Left(curWord, 1)="@") And (x=0) Then 'ignore, start of sentence Else 'we got possible email! curWord = Replace(LCase(curWord), "dot", ".") If Left(curWord, 1)="@" Then sName = arrWords(x-1) Else sName = Left(curWord, InStr(curWord, "@") - 1) End If sDomain = "" If Not(Right(curWord, 1)="@") Then sDomain = Right(curWord, Len(curWord) - InStr(curWord, "@")) End If If (InStr(sDomain, ".")<1) Or (Right(sDomain, 1)=".") Then If x<UBound(arrWords) Then If Right(sDomain, 1)="." Then sDomain = sDomain & arrWords(x + 1) Else dotIndex = -1 For y=x+1 To UBound(arrWords) If (arrWords(y)=".") Or (LCase(arrWords(y))="dot") Then dotIndex = y Exit For End If Next If (dotIndex>x) And (dotIndex<UBound(arrWords)) Then For y=x+1 To dotIndex-1 sDomain = sDomain & arrWords(y) Next sDomain = sDomain & "." & arrWords(dotIndex + 1) End If End If End If End If If (InStr(sDomain, ".")<1) Or (Right(sDomain, 1)=".") Then sDomain = "" End If If (Len(sName)>0) And (Len(sDomain)>0) Then sEmail = sName & "@" & sDomain Exit For End If End If End If Next 'free allocated memory Erase arrWords ExtractEmail = sEmail End Function Function checkphone(sText) checkphone=false Dim arrWords, x, curWord Dim sEmail, sName, sDomain Dim dotIndex, y 'remove any extra spaces sText = Trim(sText) Do Until InStr(sText, " ")<1 sText = Replace(sText, " ", " ") Loop 'split into words arrWords = Split(sText, " ") 'look for email, initialize return value sEmail = "" For x=0 To UBound(arrWords) curWord = arrWords(x) curword=replace(curword,"(","") curword=replace(curword,")","") curword=replace(curword,"-","") ' response.Write curword & "<br>" if isnumeric(curword) then ' response.Write curwords & " is numeric<br>" if len(curword)>=9 then ' response.Write "<hr>" & curword & " is a problem<hr>" checkphone=true end if end if Next 'free allocated memory Erase arrWords End Function xcab any1 explain the following php code for me and tell me whats missing please: <form id="ContactForm" action="" enctype="multipart/form-data"> <div> <input type="text" onblur="if(this.value=='') this.value='Your Name::'" onfocus="if(this.value =='Your Name::' ) this.value=''" value="Your Name:"/> <input type="text" onblur="if(this.value=='') this.value='E-mail:'" onfocus="if(this.value =='E-mail:' ) this.value=''" value="E-mail:"/> <textarea onblur="if(this.value=='') this.value='Message:'" onfocus="if(this.value =='Message:' ) this.value=''" cols="25" rows="7">Message:</textarea> <p class="fright"> <a onclick="document.getElementById('ContactForm').reset()" href="#">Clear</a> <a onclick="document.getElementById('ContactForm').submit()" href="#">Send</a> </p> </div> </form> Hi, Is it possible that when a webpage loads I can have javascript change the class of a div from: .up { transform: translate(0px,-500px) transition: all 5s ease-in; } to .down { transform: translate(0px,0px) transition: all 5s ease-in; } Essentially I would like a div to move down into place from the top of screen to the middle of screen after the page has loaded. Some thing like this?: Code: <script type="text/javascript"> function transform() { document.getElementById("content").className = "down"; </script> <div id="content" class "up" onload="transform()"> </div> </html> would this work or is there a better way? Adrian. I have a page with a GoogleMap with a GoogleBar and I would like the GoogleBar to appear with something written in it already and to have that search executed. In other words, I would like to "write something to the GoogleBar and press Enter" automatically as soon as the map loads. How can I do this? btw: By GoogleBar, I mean the search bar that appears on the map after using the enableGoogleBar() function. Hi, I'm not sure where I have translated this incorrectly. I have one google map embedded on my page which works fine. But I wanted to add a second one. I thought the easiest way to do this would be to have a second page which is called later on with all the details on it for the second map. However although I think (this I presume is where I went wrong) I have replicated the instructions correctly the place holder for the second map just remains blank. This is the code for my called page with the instructions for the second map: PHP Code: <?php echo $_POST['Map'] . '<br />'; ?> <div id="placemap_canvas"></div> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html {height:250px} body {height:250px} #placemap_canvas {width:100%; height:150px;} </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" /> </script> <script type="text/javascript"> var latlng = new google.maps.LatLng ( <?php include("dbconnect.php"); $result = mysql_query("SELECT * FROM regions WHERE RegionPId='{$_POST['Map']}'"); while($row = mysql_fetch_array($result)){ echo $row['maplink']; } mysql_close($con); ?> ); var myOptions = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("placemap_canvas"), myOptions); } </script> And this is the script of the main page, just in case I would be better off keeping them both in one place. Code: <head> <script type="text/javascript"> function loadSubPlace(File,ID,Msg,Eile,EID,Esg){ loadXMLDoc1(File,ID,Msg); var mimer = setTimeout(function(){loadXMLDoc1(Eile,EID,Esg)},5000); } </script> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html {height:250px} body {height:250px} #map_canvas {width:30%; height:250px;} </style> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true" /> </script> <script type="text/javascript"> function initialize() { var latlng = new google.maps.LatLng ( <?php include("dbconnect.php"); $result = mysql_query("SELECT * FROM countries WHERE Country='{$_SESSION['Country']}'"); while($row = mysql_fetch_array($result)){ echo $row['Map']; } mysql_close($con); ?>); var myOptions = { zoom: 4, center: latlng, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } </script> </head> <body onload="initialize()"> <div class="countryright" id="map_canvas"> include("dbconnect.php"); $snowball=explode(';',$_POST['syringa']); $turnsol=$snowball[1]; $violet =$snowball[2]; $wakerobin=$snowball[3]; global $turnsol; global $violet; global $wakerobin; echo '<center><b><big>' . $wakerobin. '</big></b></center><br /><br />'; $result=mysql_query("SELECT * FROM regions WHERE country='{$turnsol}' AND region='{$violet}' AND place='{$wakerobin}' AND sub !='' ORDER BY sub ASC"); while($row = mysql_fetch_array($result)){ $wheat="{$row['RegionPId']};{$turnsol};{$violet};{$wakerobin};{$row['sub']}"; $tigerlilly=$row['RegionPId']; echo '<input type="button" class="button3" name="place" id="place" value="' . $row['sub'] . '" onclick="loadSubPlace(\'getPlace.php\',\'txtHintPlaceSub\',\'hepatica=' . urlencode($wheat) . '\',\'getPlaceMap.php\',\'placemapcanvas\',\'Map=' . urlencode($tigerlilly) . '\');" />'; } echo '<input type="button" class="button3" name="addplace" id="addplace" value="Add Place" onclick="loadXMLDoc1(\'getAddPlaceSub.php\',\'txtHintPlaceSub\', encodeURI(\'addsubplace=' . $_POST['syringa'] . '\'));" />'; echo '<br /><br /><div id="txtHintPlaceSub"></div><br /><br />'; mysql_close($con); ?> I've cut out the script that doesn't relate to this so I hope I haven't missed anything important. Can the Google API replace scraping? You can get blocked by Google if you scrape, but can you get the same info from the Google API at no risk?
Hi, Can anyone help define the difference between the 2 scripts below and help identify what is/should happen for each? Code: <script type="text/javascript"> var _gaq = _gaq || []; //NHG COMMENT: if there is an existing account, then it needs to be incorporated within this tag. //The xx-xxxx-x par represents the google account code that needs to be inserted // if there is no existing tag in place, then take out the 2 follwoing lines marked (1) and (2)and (3) (1) _gaq.push(['_setAccount', 'XX-XXXXXX-X']); (2) _gaq.push(['_setDomainName', 'MYSUBDOMAIN.domain.com']); (3) _gaq.push(['_trackPageview']); NHG COMMENT: This is the global tag and everything below this MUST NOT BE CHANGED _gaq.push(['_setAccount', UA-16522538-1']); _gaq.push(['_setDomainName', 'domain.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> Code: // copy and paste the tag below <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'XX-XXXXXX-X']); _gaq.push(['_setDomainName', 'MYSUBDOMAIN.domain.com']); _gaq.push(['_trackPageview']); _gaq.push(['_setAccount', UA-16522538-1']); _gaq.push(['_setDomainName', 'domain.com']); _gaq.push(['_setAllowLinker', true]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> I started using Google API Visualizations to create a bar chart which was very easy because of the code examples google gives but then I realised instead of setting the values I want within the html I wanted a form which would let you input the values you want for the bar chart. I made it look like this: Using this code: 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"/> <title> Google Visualization API Sample </title> <SCRIPT LANGUAGE="JavaScript"> function UpdateChart (form) { var TeamA = form.TeamA.value; var TeamB = form.TeamB.value; var TeamC = form.TeamC.value; var TeamD = form.TeamD.value; } </SCRIPT> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1', {packages: ['barchart']}); </script> <script type="text/javascript"> function drawVisualization() { // Create and populate the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Year'); data.addColumn('number', 'Score'); data.addRows(4); data.setValue(0, 0, 'Team A'); data.setValue(0, 1, 500); data.setValue(1, 0, 'Team B'); data.setValue(1, 1, 300); data.setValue(2, 0, 'Team C'); data.setValue(2, 1, 70); data.setValue(3, 0, 'Team D'); data.setValue(3, 1, 150); // Create and draw the visualization. new google.visualization.BarChart(document.getElementById('visualization')). draw(data, {title: 'Scores', legend: 'none'}); } google.setOnLoadCallback(drawVisualization); </script> </head> <body style="font-family: Arial;border: 0 none;"> <div id="visualization" style="width: 300px; height: 300px;"></div> <form name="input" method="get"> Team A: <input type="text" name="TeamA" value="0" size="1"> <br>Team B: <input type="text" name="TeamB" value="0" size="1"> <br>Team C: <input type="text" name="TeamC" value="0" size="1"> <br>Team D: <input type="text" name="TeamD" value="0" size="1"> <br> <INPUT TYPE="button" NAME="btnUpdate" Value="Update" onClick="UpdateChart(this.form)"> </form> </body> </html> However, instead of the values I've bolded I want the values from the form to be used. I've never really used Javascript before so I'm not sure what to do. Any help would be appreciated. Hi, I have a table with FROM and TO columns and a column with MAP/DIRECTIONS link. When a user clicks on the link, it should display Map and Directions on the iframe on the same page. How can I achieve this using Google map and directions API? Thanks Hello guyz! I need to fetch some images whit custom sizes in Google Images, this is the API from Google that let me search end fetch images: Code: /* * How to search for images and restrict them by size. * This demo will also show how to use Raw Searchers, aka a searcher that is * not attached to a SearchControl. Thus, we will handle and draw the results * manually. */ google.load('search', '1'); function searchComplete(searcher) { // Check that we got results if (searcher.results && searcher.results.length > 0) { // Grab our content div, clear it. var contentDiv = document.getElementById('content'); contentDiv.innerHTML = ''; // Loop through our results, printing them to the page. var results = searcher.results; for (var i = 0; i < results.length; i++) { // For each result write it's title and image to the screen var result = results[i]; var imgContainer = document.createElement('div'); var title = document.createElement('h2'); // We use titleNoFormatting so that no HTML tags are left in the title title.innerHTML = result.titleNoFormatting; var newImg = document.createElement('img'); // There is also a result.url property which has the escaped version newImg.src = result.tbUrl; imgContainer.appendChild(title); imgContainer.appendChild(newImg); // Put our title + image in the content contentDiv.appendChild(imgContainer); } } } function onload() { // Our ImageSearch instance. var imageSearch = new google.search.ImageSearch(); // Restrict to extra large images only imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE, google.search.ImageSearch.IMAGESIZE_MEDIUM); // Here we set a callback so that anytime a search is executed, it will call // the searchComplete function and pass it our ImageSearch searcher. // When a search completes, our ImageSearch object is automatically // populated with the results. imageSearch.setSearchCompleteCallback(this, searchComplete, [imageSearch]); // Find me a beautiful car. imageSearch.execute("Subaru STI"); } google.setonloadCallback(onload); But all I could find about restricted images sizes is this: Code: imageSearch.setRestriction(google.search.ImageSearch.RESTRICT_IMAGESIZE, google.search.ImageSearch.IMAGESIZE_MEDIUM); My problem is that I need custom fixes images sizes, not between a range of values like the above script was giving me... Google API reference says that: Code: google.search.ImageSearch.RESTRICT_IMAGESIZE - When this is specified as the value of type, the image search results will be restricted to images with certain pixel dimensions. Valid optional values for this type are as follows: * google.search.ImageSearch.IMAGESIZE_SMALL - restrict to small images, icons * google.search.ImageSearch.IMAGESIZE_MEDIUM - restrict to medium images * google.search.ImageSearch.IMAGESIZE_LARGE - restrict to large images * google.search.ImageSearch.IMAGESIZE_EXTRA_LARGE - restrict to extra large images Those who wants to play whit Google Playground, this is the link: Code: http://goo.gl/sPs2 Could some one help me get that images whit fixed sizes? Hi, I have just set up google analytics on my website but it is showing tracking unknown symbol in the status. Is it just the case of it taking time to set up or should it work straight away. Thanks Tyler I am making a dynamic google map and need to pass in a JS Object that has latitude, longitude, address, name, and a link. The JS Object will be getting those values from a DB and may have up to 15 recordsets. I need to know how to separate that out into it's entities to include in the Map API regardless of how many recordsets there are.
I am using jMapping(http://vigetlabs.github.com/jmapping/) for using jQuery with google maps. What I'm trying to do is add an event listener so that when you click on a marker it will call a function I made within the jMapping function. Does anyone have any clues? everything I've tried doesn't work.
Hi guys, I really need a custom google map, something like http://www.zeemaps.com/ offers, Where you can: Add placemarkers to a map by clicking an add button A sidebar with all locations listed Info windows when you click on markers giving you information And a couple of other features! I would really appreciate some help, spent 3 days on this now and i have: Code: <!DOCTYPE html "-//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"/> <title>Google Maps JavaScript API Example</title> <script src="http://maps.google.com/maps? file=api&v=2.x&key=ABQIAAAAWRAYgBXwUGsMlXv1A5Q4bBRI_5kORY0Qfu7GdhaM1xc6on2HoBT-8FUS12kkCbVXsWHjVsqeAyFq5Q&sensor=false" type="text/javascript"></script> <script type="text/javascript"> function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(54.77534585936447, -2.5927734375), 6); map.setUIToDefault(); } var publisher_id = 'ca-pub-4595198420871047'; var adsManagerOptions = { maxAdsOnMap : 4, style: G_ADSMANAGER_STYLE_ADUNIT, // The channel field is optional - replace this field with a channel number // for Google AdSense tracking //channel: 'your_channel_id' }; adsManager = new GAdsManager(map, publisher_id, adsManagerOptions); adsManager.enable(); } </script> </head> <body onload="initialize()" onunload="GUnload()"> <div id="map_canvas" style="width: 100%; height: 100%"></div> </body> </html> I have some problems with intergrating google maps into my page I cant seem to get a marker to appear on my map. I have tried numerous methods but non seem to work. I have integrated the google maps on my main site, repositioned and re-sized. The code below is a test page i work on to get code to work. It's just a map on a page entire code: <!DOCTYPE HTML> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <style type="text/css"> html { height: 100% } body { height: 100%; margin: 25px; padding: 25px } #map_canvas { height: 100% } </style> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDrxZnpYBNIwzBFVYaDY__BMONEjNEGZaI&sensor=false"> </script> <script type="text/javascript"> function initialize() { var myLatlng = new google.maps.LatLng(-25.363882,131.044922); var myOptions = { zoom: 4, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);} var marker = new google.maps.Marker({ position: myLatlng, map: map, title:"Hello World!" }); </script> </head> <body onload="initialize()"> <div id="map_canvas" style="width:100%; height:100%"></div> </body> </html> can anybody tell my where i am going wrong and just the map appears with no marker? thanks Hello everyone! I've searched a lot of places for a script like this and found nothing. Here's my situation. My site uses a main iframe that changes as you click links. However, Google links to all my pages, I only want it to access a few (because some pages are only meant to be viewed via iframe). I'm looking for a JavaScript that will detect if the page is being viewed in an iframe, if it is, it should take no action, but if it's no, it should redirect to a different page. Is this possible??? Hi guys, I'm trying to run this sample file that i got from the google docs. I want to write a stock ticker from google finances xml feed and this is a sample they had. Code: <?xml version="1.0" encoding="utf-8"?> <Module> <ModulePrefs title="hellofinance"> <Require feature="finance"/> </ModulePrefs> <Content type="html"> <![CDATA[ Hello world! Here is your portfolio:<br/> GOOG: <span id=_IG_SYM1_l></span> (<span id=_IG_SYM1_c></span>)<br/> AAPL: <span id=_IG_SYM2_l></span> (<span id=_IG_SYM2_c></span>)<br/> INTC: <span id=_IG_SYM3_l></span> (<span id=_IG_SYM3_c></span>)<br/> <script> var quote = new google.finance.Quote(); quote.enableDomUpdates( { 'GOOG' : '_IG_SYM1', 'AAPL' : '_IG_SYM2', 'INTC' : '_IG_SYM3' } ); quote.getQuotes(["GOOG", "AAPL", "INTC"]); </script> ]]> </Content> </Module> my problem is i don't know how to execute it so i can see how it works. I tried sticking this code within a php file and it returns an error on the first line for unexpected t-string. So i tried changing the extension to xml and it just displays the code but does not execute. I'm stumped. Any help is appreciated. Thanks P.S. - Yes i do have the zend gdata framework installed and running on my server and is working correctly according to their test. |