JavaScript - Google Index My Js?
Here is some code i use in one of my functions. I was wondering if the text would be found by google and indexed? (It replaces text with another piece of text and a link)
Code: $("#replace").html('<a href="javascript:location.reload(true)">Back Home</a>Apparently, Voynich wanted to have the mysterious manuscript deciphered and provided photographic copies to a number of experts.'); Similar TutorialsI 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 all.. I have a modal window I'm working on, but the flash below it comes over the top of the modal window. I'm assuming it's a z-index issue. I'm using Tinybox2 for the modal window, and it's CSS styles use 800 and 900 for z-index. Code: .tbox {position:absolute; display:none; padding:14px 17px; z-index:900} .tinner {padding:15px; -moz-border-radius:5px; border-radius:5px; background:#fff url(images/preload.gif) no-repeat 50% 50%; border-right:1px solid #333; border-bottom:1px solid #333} .tmask {position:absolute; display:none; top:0px; left:0px; height:100%; width:100%; background:#000; z-index:800} .tclose {position:absolute; top:0px; right:0px; width:30px; height:30px; cursor:pointer; background:url(images/close.png) no-repeat} .tclose:hover {background-position:0 -30px} The flash itself isn't in a div but in a table. Is there a way to give it a lower z-index? Thanks in advance! carrie Hi i can't seem to get a drop downs selected index. This is my drop down box: Code: <select name="queba" id="queeba"> <option value="ban1">Bank1 <option value="ban2">Bank2 <option value="ban3">Bank3 <option value="ban4">Bank4 </select> thanks i want to find the index of array through user defined function . my function is. Code: var Month_Label = new Array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); function index() { var p=-1; for(i=0;i<Month_Label.length;i++) { if(Month_Label[i]=="February") { p=i; break; } } alert(p); } but it is not working. any body can help me. what is wrong with my code Hi All, I have this table with a repeat region (this pulls a series of records from my database and displays them in the table). I have a button in one of the table cells that calls a function to delete the current row where the button is pressed (I am trying to pass the row index to the function). Here is what I have which is clearly wrong but I am hoping someone can offer an option that will work. Code: <script type="text/javascript> function deleteRow(tableID,tr) { //alert('tableID is '+tableID+' and rowCount is '+tr); if (document.getElementById(tableID)) { try { var table = document.getElementById(tableID); var rowCount = table.rows.length; for(var i=0; i<rowCount; i++) { var row = table.rows[i]; //alert ("row is "+i); if(i == tr) { table.deleteRow(i); i++; if(rowCount==0){ table.parentNode.removeChild(table); } } } }catch(e) { alert(e); } } } </script> <table id="dataTable" width="100%" border="0"> <?php do { ?> <tr> <td width="33%"><?php echo $row_rstRequestedEquip['EquipNeeded']; ?></td> <td width="33%"><?php echo $row_rstRequestedEquip['Quantity']; ?></td> <td width="33%"><input type="button" name="remove" value="Remove" class="button" onclick = "deleteRow(dataTable,this.rowIndex)" /></td> </tr> <?php } while ($row_rstRequestedEquip = mysql_fetch_assoc($rstRequestedEquip)); ?> </table> Thanks in advance for any help. Kind regards, Ken Just to let you know if you don't know how to do this is the code I use: It will solve the problem of the clip scrolling over text etc. <embed wmode="transparent" src="youtube URL" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="280" height="240"></embed> (mods, do with this as you please). Javascript I have 3 combolist fields ( A, B and C ) each of which has just "No" and "Confirmed" as their only options. I have one final combolist ( D ) which has just "Yes" and "No" as options. "No" is the default selected item and Index0 in the list. The user must select "Confirm" all three ( A, B and C ) lists before they should be allowed to select "Yes" in the final list ( D ). I want to be able to have the system to automatically select and display "No" in list ( D ) if any of the first 3 selections ( A, B or C ) are "No". I don't have a problem validating if any of the 3 lists ( A, B or C ) are "No" but I cannot get the final combolist to change from "Yes" ( if previously selected ) to "No". I have tried setting the selected index of (D) to 0 and tried setting the selected value of (D) to "No" but if (D) currently displays "Yes" when any of the ( A, B or C ) are changed to "No" nothing happens to (D). Am I trying to do something that cannot be done ? Any help will be gratefully received. Tony I am trying to "swap" the contents of a div(#right_top) depending on which line item you hover over. Awkward, but does work, but.... the problem is that although I can get the code to work, the "right_top" div gets longer (physically on the page) even though each div is supposed to be a different "z-index". I don't know how to correct this, or is there better code? I would appreciate any help! Thank you. Complete code below..... ------------------------------------------------------------------- Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <script language="javascript" type="text/javascript"> <!-- Hide script from older browsers function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && document.getElementById) x=document.getElementById(n); return x; } function MM_showHideLayers() { //v3.0 var i,p,v,obj,args=MM_showHideLayers.arguments; for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; } obj.visibility=v; } } //--> </script> <!-------------------------------------------------------------> <style type="text/css"> #wrapper{ width:800px; } #left_top{ background-color:#66FFFF; width:270px; padding-top:60px; padding-left:30px; float:left; } #right_top{ background-color:#66FF33; padding-top:60px; width:480px; padding-left:20px; float:left; } #first_div{ position:relative; width:450px; height:300px; z-index:1; visibility: hidden; left:0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; color:#FFFFFF; } #second_div{ position:relative; font-size:16px; width:450px; height:300px; z-index:2; top: -320px; visibility: hidden; left:0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; color:#FFFFFF; } #third_div{ position:relative; font-size:16px; width:450px; height:300px; z-index:3; top: -640px; visibility: hidden; left:0px; font-family:Verdana, Arial, Helvetica, sans-serif; font-style:italic; color:#FFFFFF; } </style> </head> <body> <div id="wrapper"> <div id="left_top"> <table width="210" height="483"> <tr><td width="210" height="477" valign="top"> <div><a title="first div" href="#" class="style1" onClick="return false" onMouseOver="MM_showHideLayers('Initial','','hide','first_div','','show')" onMouseOut="MM_showHideLayers('Initial','','show','first_div','','hide')">show first div</a></div> <div><a title="second div" href="#" class="style1" onClick="return false" onMouseOver="MM_showHideLayers('Initial','','hide','second_div','','show')" onMouseOut="MM_showHideLayers('Initial','','show','second_div','','hide')">show second div</a></div> <div><a title="third div" href="#" class="style1" onClick="return false" onMouseOver="MM_showHideLayers('Initial','','hide','third_div','','show')" onMouseOut="MM_showHideLayers('Initial','','show','third_div','','hide')">show third div</a></div> </td></tr> </table> </div><!-- end of left_top --> <div id="right_top"> <div id="first_div"> <p align="justify"><b>first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first first </b></p></div> <div id="second_div"> <p align="justify"><b>second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second second </b></p></div> <div id="third_div"> <p align="justify"><b>third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third third </b></p></div> </div><!-- end of right_top div --> </div><!-- end of wrapper --> </body> </html> I have three images nested in three divs that I want to change size on mouseover, but since they're each in their own div, I can't effect their z-indexes relative to one another without targeting their parent divs. I thought I'd be able to contain the images in an <a> tag with z-index style in a mouseover, but I can get it to work. What am I doing wrong here? CSS: Code: .thumb img{ height: 75px; } .thumb img:hover{ height: 150px; } JS: Code: function thmbOver(){ this.style.zIndex = "1000"; } HTML: Code: <div id="div1"><a onmouseover='thmbOver();'><span class='thumb'><img src='thmbs/image1.jpg'></span></a></div> <div id="div2"><a onmouseover='thmbOver();'><span class='thumb'><img src='thmbs/image2.jpg'></span></a></div> <div id="div3"><a onmouseover='thmbOver();'><span class='thumb'><img src='thmbs/image3.jpg'></span></a></div> I've tried a few approaches to the function's targeting, like document.getElementById(this.parent.id).style.zIndex, etc, but still nothing. Any ideas? Thanks, ~gyz OK so say I have something like this: <TD> <p>Item A</p> <p>Item B</p> <p>Item C</p> <p>Item D</p> </TD> So TD would be the parent and all of the <P>'s would be childNodes. I want to be able to click on each child and have it alert me its index # relative to the parent node. So 'Item A' should alert "0", 'Item B' - "1", 'Item C' - "2", etc. Thanks in advance. I'm not completely sure this is javascript, but is there a way of changing the z-index of my flash object when hovering over it? Here is a link to my page: http://aspspider.org/Samii/HireCar.aspx As you can see, you cannot click on the link in the main content area because the menu is on a higher z-index than the content. I need a way for the content to be on a higher z-index than the menu until the menu is hovered over, in which case the z-index of the menu will be higher. I hope this makes sense. Please help, this is driving me insane! Samii x Hi.. i have a login page and it is separately in my index.php now i need my login page become a pop up form when I open my index.php here is my login.php Code: <?php include 'config.php'; session_start(); //if (isset($_SESSION['logged_in'])) { // header('Location:index.php'); // die(); // } if (isset($_POST['submit'])) { $username=$_POST['username']; $password=($_POST['password']); $sql = "SELECT username, password FROM pay_login WHERE username='$username' AND password='$password'"; $rs = $conn2->Execute($sql); if($rs==1){ $_SESSION['logged_in'] = true; header("location:index.php"); } else { echo "<center>"; echo "Wrong Username or Password"; echo "</center>"; } } $smarty->display('login.tpl'); ?> and here is my index.php Code: <?php session_regenerate_id(true); /*include 'config.php'; if (!isset($_SESSION['empID'])) { $sql = "SELECT EMP_ID FROM PERSONAL"; $recPersonal = $conn->Execute($sql); if (!$recPersonal->BOF) { $recPersonal->MoveFirst(); } session_register('empID'); $_SESSION['empID'] = $recPersonal->fields['EMP_ID']; } */ include 'config.php'; $currentEmpID = $_SESSION['empID']; if (!isset($_SESSION['empID'])) { $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonal = $conn->Execute($sql); session_register('empID'); $_SESSION['empID'] = $recPersonal->fields['EMP_ID']; } $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME FROM PERSONAL ORDER BY LNAME ASC"; $recPersonalNav = $conn->GetAll($sql); $smarty->assign('personalAll', $recPersonalNav); // ======================================================================================================================== $sql = "SELECT EMP_ID, CONCAT(LNAME, ', ', FNAME, ' ', MI, '.') AS FULLNAME FROM PERSONAL WHERE EMP_ID='$currentEmpID'"; $recPersonalHead = $conn->Execute($sql); $fullName = $recPersonalHead->fields["FULLNAME"]; $smarty->assign('empid', $currentEmpID); $smarty->assign('fullname', $fullName); session_write_close(); $smarty->display('header.tpl'); $smarty->display('left.tpl'); $smarty->display('empPayroll.tpl'); $smarty->display('footer.tpl'); exit(); ?> and I found a sample pop up code in internet but this pop needs a button befre it was displayed..I want is it will display when i run my index.php here is the link of sample pop up form http://www.nigraphic.com/blog/java-s...-center-screen Thank you Hello I have the code below and I am trying to add another index id to be checked to the two that I already have. I have tried changing the line: var anotherTab = (indx.indexOf('a') >= 0) ? id + 'b' : id + 'a'; to var anotherTab = (indx.indexOf('a') >= 0) ? id + 'b' : id + 'a' : id + 'c'; but I just get a javascript error what would be the correct syntax for a third index id? Code: var groupId=obj.id.substring(0, 1); var indx=obj.id.substring(obj.id.indexOf('_')+1); var id=indx.substring(0, indx.length-1); var anotherTab = (indx.indexOf('a') >= 0) ? id + 'b' : id + 'a'; document.getElementById(groupId+'tab_' + indx).className = 'selected'; document.getElementById(groupId+'tab_' + anotherTab).className = ''; if (indx==id+'a') { show (groupId+'baseballInfo_'+id); hide (groupId+'footballInfo_'+id); hide (groupId+'soccerInfo_'+id); } else if (if (indx==id+'a') { hide (groupId+'baseballInfo_'+id); show (groupId+'footballInfo_'+id); hide (groupId+'soccerInfo_'+id); } else { hide(groupId+'baseballInfo_'+id); hide (groupId+'footballInfo_'+id); show(groupId+'soccerInfo_'+id); } Hi, I am very new to Javascript but have found a great tutorial to create a dynamic dropdown menu. I got it to work, but have problems redirecting it to the correct page after the necessary page refresh to load the items in the 2nd dropdown menu. The Javascript in the header is the following: Code: <SCRIPT language=JavaScript> function reload(form){ var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='index.php?cat=' + val ;} </script> My PHP controller (index.php) code to load the correct frames is as follows: Code: <ul id="navbar"> <li><a href="index.php?id=home">Home</a></li> <li><a href="index.php?id=overview">Overview</a></li> <li><a href="index.php?id=add">Add new product</a></li> </ul> Code: if(isset($_GET['cat'])){ include ('add.html.php');} else { switch($_GET['id']) { default: include('home.html.php'); break; case "home": include('home.html.php'); break; case "overview": include('add.html.php'); break; case "add": include('add.html.php'); } } So I have made a workaround to load the "add.html.php" frame with the if(isset)$_GET['cat']. But what I really would like to do is to change the Javascript self.location to Code: self.location='index.php?id=add?cat=' + val ;} so that the PHP index script loads the add.html.php automatically. However, when changing the self.location as described above the page is redirected to home.html.php. It is really annoying, I have googled for a full day but haven't found a solution yet. Maybe someone can tell me how I can easily load the correct frame by using Javascript? Many thanks in advance!! I am now working on a utility function that will gather the indexes for substring matches found in a string. There is an academic mystery I am puzzling over Code: function getMatchIndex(a, b) // a: sting to search b: what to search for { var out = new Array(); if(a.lastIndexOf(b) > -1) // at least two matches, ****! there could be more { if( (a.substr(a.indexOf(b) + b.length, a.lastIndexOf(b))).length > b.length ) { var stp = parseInt(a.lastIndexOf(b)) - (parseInt(a.indexOf(b)) + parseInt(b.length)); alert(stp) alert( (a.substr(a.indexOf(b) + b.length, stp)).length+' : '+a.substr(a.indexOf(b) + b.length, stp)); } else { out[out.length] = a.indexOf(b); out[out.length] = a.lastIndexOf(b); return out; } } else if(a.indexOf(b) > - 1 && a.lastIndexOf(b) == -1) { out[out.length] = a.indexOf(b); return out; } else if(a.indexOf(b) == -1) { out = 'no matches'; return out; } else { var splitStr = new Array(); splitStr = a.split(b); /* possibilities: 1: one match at the begining or end -- leaves one significant item 2: one match somewhere after the beginning and before the end. -- gives two matches. */ for(var i = 0; i < splitStr.length - 1; i++) // don't want the last segment length { out[out.length] = splitStr[i].length } } } getMatchIndex('xxxi5ixxxxxxxi5ixx', 'i5i'); in the following code snippet: Code: if( (a.substr(a.indexOf(b) + b.length, a.lastIndexOf(b))).length > b.length ) { var stp = parseInt(a.lastIndexOf(b)) - (parseInt(a.indexOf(b)) + parseInt(b.length)); alert(stp) alert( (a.substr(a.indexOf(b) + b.length, stp)).length+' : '+a.substr(a.indexOf(b) + b.length, stp)); I am trying to get the sub string between the end of the first match to the beginning of the last match. The 'if' test passes, but I have to parseInt the values to get the proper value for stp. SO, the question is, what is the actual data type of an index value obtained from a string. (It would appear to be a string; having to use it an a math expression doesn't work without parseInt). (I hope I haven't posted too much code) Thank you in advance. How do I use array.push to add an object with a custom index in an array? I have this script but it doesnt work. Chrome's Javascript console is not outputting errors Code: var tempList = new Array(); $('#add').click(function(){ var split = $('#itemid').val().split('_'); var itemid = split['0']; var lbs = $('#lbs').val(); tempList.push(tempList['itemid'] = lbs); for (var i=0; i<=(tempList.length - 1); i++){ if (i==0){ var list = tempList[i]+ '<br />'; } else{ var list = list + tempList[i]+ '<br />'; } } alert(list); }); So I am working on a function that counts the number of lines a user input takes up. I'm accounting for a line being 114 characters long, and I am trying to account for returns which in some cases are used for a blank line, and in others simply to proceed to a new line for new text. But thats not important really. I am having problems identifying the returns from my form submit. The code below isnt identifying them, I get that. But when I google this issue, it tells me to do something like hard = biotext.indexOf("\r"); Instead of the <br /> which I also understand. Unfortunately, as soon as I do that, my javascript completely breaks and stops working, as though I had a major syntax error. I dont understand as this syntax is suggested in many sites on the net. Code: function count_bio(ctl, ev) { var biotext = ctl.value; var counter = 0; hard = biotext.indexOf("<br />"); hardx = hard; while(hard > 0) { hard=hardx-y; if(hard > 114){counter+=Math.ceil(hard/114);} else{counter+=1;} y=hardx; hardx=biotext.indexOf("<br />", hardx+1); } if(counter==0) { counter=Math.ceil(biotext.length / 114); } else { if(hardx > 114){counter+=Math.ceil(hardx/114);} else{counter+=1;} } alert(counter); return true; } |