JavaScript - Javascript Redirection Code Not Working
Similar Tutorialshello, I am trying to figure out how to hide the direction page in this code: I want to hide: www.ipage.com/mail/index.bml <INPUT TYPE="submit" NAME="Log In" VALUE="Check Mail" onclick="javascript:login.action='http://www.ipage.com/mail/index.bml?s=1';javascript:login.destination.value = '/mailadmin/index.bml?check=1';" > </TD> <TD> <INPUT TYPE="submit" NAME="Log In" VALUE="Manage Mail" onclick="javascript:login.action='https://secure.ipage.com/mailLogin';javascript:login.destination.value = '/mailadmin/index.bml?manage=1';"> any help is appreciated.... here is the link that i want to redirect http://www.xyz.com/tracks?hop=martit...e=1&varname2=2 when it will redirect the URL will be http://www.xyz.com/special?varname1=1&varname2=2 it's mean the hop and redirection variable will be remove from querystring, special is a page, it will take value from redirection variable, nothing will be hardcode. Morning Guys, i have a little issue i need to tackle and i belive Javascript is the way forward on this, so looking for some pointers/help on the idea i have in mind. so basically i have a website and its going to be selling severall products. now i have a "Global" navigation which stays the same on every page throughout the website. now obviously if this is set into the master template all the links will be the same. 1 of my links will be a "buy now" button, i want this to never need changing but i want the link to direct to the correct purchasing page depending on which product is being described in the content area... so im guessing its going to need to fetch some sort of Value/Variable out the content and then use that to redirect to the correct page via that single "buy now" button.. any ideas or input cheers, ant. Can't get this to work...could someone read thru this and see if anything is missing? Thanks Code: <html> <head> Supporting files: lhouse.css, list.js, logo.jpg <title>The Lighthouse</title> <link href="lhouse.css" rel="stylesheet" type="text/css" /> <script src="list.js" type="text/javascript"></script> <script type="text/javascript"> function amountTotal() { total(0); for (var i=0; i<=amount.length; i++) { total+=amount[i]; } return total; } </script> </head> <body> <div id=title> <img src=logo.jpg alt=The Lighthouse /> The Lighthouse<br /> 543 Oak Street<br /> Delphi, KY 89011<br/> (542) 555-7511 </div> <div id=data_list> <script type="text/javascript"> document.write("<table border=1' rules=rows cellspacing=0'>"); document.write("<tr><th>Date</th><th>Amount</th><th>First Name</th><th>Last Name</th><th>Address</th></tr>"); for (i=0; i< amount.length; i++) { if (i%2==0) document.write("<tr>"); else document.write("<tr class='yellowrow'>"); document.write("<td>"+date[i]+"</td>"); document.write("<td class=amt>"+amount[i]+"</td>"); document.write("<td>"+firstName[i]+"</td>"); document.write("<td>"+lastName[i]+"</td>"); document.write("<td>"); document.write("<td>"+street[i]+"<br/>"); document.write("city[i],+" +state[i]+ "+zip[i]"); document.write("</td>"); document.write("</tr>"); } document.write("</table>"); </script> </div> <div id=totals> <script type="text/javascript"> document.write("<table border=1' cellspacing=1'>"); document.write("<tr><th id=sumTitle colspan=2'>Summary</th></tr>"); document.write("<tr><th>Contributors</th>"); document.write("<td>+amount.length+</td></tr>"); document.write("<tr><th>Amount</th>"); document.write("<td>$+amountTotal()+</td></tr>"); document.write("</table>");</script> </div> </body> </html> </html> This is suppose to execute "avalon" and it should move down the page once and "Books" should move with it, hidden behind it. I have read the code over and over and over and do not see any mistakes. HELP! Code: <title>Avalon Books</title> <link href="styles.css" rel="stylesheet" type="text/css" /> <script src="scripts.js" type="text/javascript"></script> <script type="text/javascript"> function placeObjects() { placeIt("avalon",175,10); placeIt("books", 175,10); placeIt("ab",230,40); placeIt("fiction",5,5); placeIt("nfiction",475,5); hideIt("ab"); hideIt("fiction"); hideIt("nfiction"); moveAvalon(); } function moveAvalon() { var y=yCoord("avalon"); if (y <= 260) { shiftIt("avalon",0,10); shiftIt("books",0,10); setTimeout("moveAvalon()",30); } else { moveBooks(); } } function moveBooks() { var x=xCoord("books"); if (x <= 320) { shiftIt("books",10,0); setTimeout("moveBooks()",50); } else { //display the hidden images; } } </script> </head> <body onload="placeObjects()"> <div id="avalon"> AVALON </div> <div id="books"> BOOKS </div> <div id="ab"> <a href="#"> <img src="ab.jpg" alt="Click to enter store" /> </a> </div> <div id="fiction"> <img src="fiction.jpg" alt="" /><br /> <b>AB Sales Rank: #1<br /> Fiction</b><br /> <i>Before the Fall</i><br />Jeffrey Unwin </div> <div id="nfiction"> <img src="nfiction.jpg" alt="" /><br /> <b>AB Sales Rank: #1<br /> Nonfiction</b><br /> <i>Vietnam Memoirs</i><br />Gen. John Hartford </div> </body> </html> I havent even declared x,y and z as variables! Code: x=10; y=20; z = x+y; document.getElementById('good').innerHTML=z; I am getting so confused... since the time i started learning JS i thought declaring variables (var x,y,z was real important! I have a webpage where I have declared a variable as Code: <input type="hidden" id="Edits_OK" /> I set the value of this variable within a Javascript function to either "T" or "F". In my code-behind, I have a btnSubmit_Click() event that calls this Javascript function. In this code-behind event, I also check the value of the "Edits_OK" variable, however, the value is always "". The Javascript function will always put a value in this variable whether it's "T" or "F". I also declare the "Edits_OK" variable within the code-behind as this: Code: Private Edits_OK As New HiddenField Here is the Javascript Function. Code: function CheckEdits() { var msg; document.getElementById("Edits_OK").value = 'T'; if (document.getElementById("txtName").value == '') { msg = msg + '\nName'; document.getElementById("Edits_OK").value = 'F'; } if (document.getElementById("txtOrganization").value == '') { msg = msg + '\nOrganization'; document.getElementById("Edits_OK").value = 'F'; } if (document.getElementById("txtSubject").value == '') { msg = msg + '\nSubject'; document.getElementById("Edits_OK").value = 'F'; } if (document.getElementById("txtNote").value == '') { msg = msg + '\nNote'; document.getElementById("Edits_OK").value = 'F'; } if (document.getElementById("Edits_OK").value == "F") { var msg2; msg2 = "Please provide the following information:\n"; error_occurred = true; alert(msg2 + msg); } } Here is the code-behind Procedu Code: Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click Try If Edits_OK.Value = "T" Then FormatEmail() End If Catch ex As Exception lblErrMsg.Text = "btnSubmit_Click() Event - " & ex.Message End Try End Sub Not sure why the value is always "". Please help! Thanks! So I have a file that factors quadratics. It works just fine when I open the file from my desktop, but when I upload it and try to use it, the javascript stops working. Any ideas? This is the file: http://wdroom.com/factor.html You can try it out there, or you can download it. I can't get it to work at all for some reason... Thanks! Hey guys-I realize that this is a javascript/php hybrid, but I am having a strange problem here. Basically, this script uploads an image (from another page), then allows you to crop it and save it. I want to have it redirect back to the original page in the form of a php header (see if $_GET['action']==done). However, it doesn't seem to want to send the header! This is strange because my first header, right above the second, that redirects to an error page, works just as planned. Here is the code. The headers I've added are very close to the top. Code: <?php /* * Copyright (c) 2008 http://www.webmotionuk.com * "PHP & Jquery image upload & crop" * Date: 2008-05-15 * Ver 1.0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://www.opensource.org/licenses/bsd-license.php */ if ($_GET['action']=="done") { if ($_POST['x1']=="" || $_POST['y1']=="" || $_POST['x2']=="" || $_POST['y2']=="" || $_POST['w']=="" || $_POST['h']=="") { header("Location: profile.php?action=cropError"); } } if ($_GET['action']=="done") { header("Location: profile.php"); } session_start(); $userid = $_SESSION['userid']; //Constants //You can alter these options $upload_dir = "uploadPic"; // The directory for the images to be saved in $upload_path = $upload_dir."/"; // The path to where the image will be saved $large_image_name = $userid."full.jpg"; // New name of the large image $thumb_image_name = $userid."thumb.jpg"; // New name of the thumbnail image $max_file = "100000"; // 100KB $max_width = "500"; // Max width allowed for the large image $thumb_width = "175"; // Width of thumbnail image $thumb_height = "234"; // Height of thumbnail image //Image functions //You do not need to alter these functions function resizeImage($image,$width,$height,$scale) { $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $source = imagecreatefromjpeg($image); imagecopyresampled($newImage,$source,0,0,0,0,$newImageWidth,$newImageHeight,$width,$height); imagejpeg($newImage,$image,90); chmod($image, 0777); return $image; } //You do not need to alter these functions function resizeThumbnailImage($thumb_image_name, $image, $width, $height, $start_width, $start_height, $scale){ $newImageWidth = ceil($width * $scale); $newImageHeight = ceil($height * $scale); $newImage = imagecreatetruecolor($newImageWidth,$newImageHeight); $source = imagecreatefromjpeg($image); imagecopyresampled($newImage,$source,0,0,$start_width,$start_height,$newImageWidth,$newImageHeight,$width,$height); imagejpeg($newImage,$thumb_image_name,90); chmod($thumb_image_name, 0777); return $thumb_image_name; } //You do not need to alter these functions function getHeight($image) { $sizes = getimagesize($image); $height = $sizes[1]; return $height; } //You do not need to alter these functions function getWidth($image) { $sizes = getimagesize($image); $width = $sizes[0]; return $width; } //Image Locations $large_image_location = $upload_path.$time.$large_image_name; $thumb_image_location = $upload_path.$time.$thumb_image_name; //Create the upload directory with the right permissions if it doesn't exist if(!is_dir($upload_dir)){ mkdir($upload_dir, 0777); chmod($upload_dir, 0777); } //Check to see if any images with the same names already exist if (file_exists($large_image_location)){ if(file_exists($thumb_image_location)){ $thumb_photo_exists = "<img src=\"".$upload_path.$thumb_image_name."\" alt=\"Thumbnail Image\"/>"; }else{ $thumb_photo_exists = ""; } $large_photo_exists = "<img src=\"".$upload_path.$large_image_name."\" alt=\"Large Image\"/>"; } else { $large_photo_exists = ""; $thumb_photo_exists = ""; } if (isset($_POST["upload"])) { //Get the file information $userfile_name = $_FILES['image']['name']; $userfile_tmp = $_FILES['image']['tmp_name']; $userfile_size = $_FILES['image']['size']; $filename = basename($_FILES['image']['name']); $file_ext = substr($filename, strrpos($filename, '.') + 1); //Only process if the file is a JPG and below the allowed limit if((!empty($_FILES["image"])) && ($_FILES['image']['error'] == 0)) { if (($file_ext!="jpg") && ($userfile_size > $max_file)) { $error= "ONLY jpeg images under 100KB are accepted for upload"; } }else{ $error= "Select a jpeg image for upload"; } //Everything is ok, so we can upload the image. if (strlen($error)==0){ if (isset($_FILES['image']['name'])){ move_uploaded_file($userfile_tmp, $large_image_location); chmod($large_image_location, 0777); $width = getWidth($large_image_location); $height = getHeight($large_image_location); //Scale the image if it is greater than the width set above if ($width > $max_width){ $scale = $max_width/$width; $uploaded = resizeImage($large_image_location,$width,$height,$scale); }else{ $scale = 1; $uploaded = resizeImage($large_image_location,$width,$height,$scale); } } //Refresh the page to show the new uploaded image header("location:".$_SERVER["PHP_SELF"]); exit(); } } if (isset($_POST["upload_thumbnail"]) && strlen($large_photo_exists)>0) { //Get the new coordinates to crop the image. $x1 = $_POST["x1"]; $y1 = $_POST["y1"]; $x2 = $_POST["x2"]; $y2 = $_POST["y2"]; $w = $_POST["w"]; $h = $_POST["h"]; //Scale the image to the thumb_width set above $scale = $thumb_width/$w; $cropped = resizeThumbnailImage($thumb_image_location, $large_image_location,$w,$h,$x1,$y1,$scale); //Reload the page again to view the thumbnail header("location:".$_SERVER["PHP_SELF"]); exit(); } if ($_GET['a']=="delete"){ if (file_exists($large_image_location)) { unlink($large_image_location); } if (file_exists($thumb_image_location)) { unlink($thumb_image_location); } header("location:".$_SERVER["PHP_SELF"]); exit(); } if($_GET['action']=="done"){ include('functions.php'); dbconnect(); $query = "UPDATE user SET picture='$thumb_image_name' WHERE userid='$userid'"; $result = mysqli_query($cxn,$query) or die ("Couldn't execute query"); $_SESSION['picture'] = $thumb_image_name; header( "refresh:0;url=profile.php" ); } include('top.php'); ?> <!-- * Copyright (c) 2008 http://www.webmotionuk.com / http://www.webmotionuk.co.uk * Date: 2008-05-15 * Ver 1.0 * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * http://www.opensource.org/licenses/bsd-license.php --> <?php //Only display the javacript if an image has been uploaded if(strlen($large_photo_exists)>0){ $current_large_image_width = getWidth($large_image_location); $current_large_image_height = getHeight($large_image_location);?> <script type="text/javascript"> function preview(img, selection) { var scaleX = <?php echo $thumb_width;?> / selection.width; var scaleY = <?php echo $thumb_height;?> / selection.height; $('#thumbnail + div > img').css({ width: Math.round(scaleX * <?php echo $current_large_image_width;?>) + 'px', height: Math.round(scaleY * <?php echo $current_large_image_height;?>) + 'px', marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' }); $('#x1').val(selection.x1); $('#y1').val(selection.y1); $('#x2').val(selection.x2); $('#y2').val(selection.y2); $('#w').val(selection.width); $('#h').val(selection.height); } $(document).ready(function () { $('#save_thumb').click(function() { var x1 = $('#x1').val(); var y1 = $('#y1').val(); var x2 = $('#x2').val(); var y2 = $('#y2').val(); var w = $('#w').val(); var h = $('#h').val(); if(x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h==""){ alert("You must make a selection first"); return false; }else{ return true; } }); }); $(window).load(function () { $('#thumbnail').imgAreaSelect({ aspectRatio: '175:234', onSelectChange: preview }); }); </script> <?php } ?> <?php //Display error message if there are any if(strlen($error)>0){ echo "<ul><li><strong>Error!</strong></li><li>".$error."</li></ul>"; } if(strlen($large_photo_exists)>0){?> <img src="<?php echo $upload_path.$large_image_name;?>" style="float: left; margin-right: 10px;" id="thumbnail" alt="Create Thumbnail" /> <div class="cropInstructions"> <?php if ($_GET['action']=="done") { echo "<h3>Picture Updated!</h3>"; } ?> <h3>Crop Profile Picture</h3><p>To crop the photo, simply click your mouse on the picture to the left and drag it to the desired size.</p> <br style="clear:both;"/> <form name="thumbnail" action="cropImage.php?action=done" method="post"> <input type="hidden" name="x1" value="" id="x1" /> <input type="hidden" name="y1" value="" id="y1" /> <input type="hidden" name="x2" value="" id="x2" /> <input type="hidden" name="y2" value="" id="y2" /> <input type="hidden" name="w" value="" id="w" /> <input type="hidden" name="h" value="" id="h" /> <input type="hidden" name="done" value="yes" id="done" /> <input type="submit" name="upload_thumbnail" value="Save Thumbnail" class="cropButton" /> </form><br> <a href="profile.php">Back To Edit Profile</a> </div> <?php } include('bottom.php'); ?> <!-- Copyright (c) 2008 http://www.webmotionuk.com --> </body> </html> hi there, i have a problem which is there is some javascript codes keeping the #usemap tag from working here is my webpage Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta content='text/html; charset=windows-1256' http-equiv='Content-Type' /> <title>Assiut map</title> <script src="shiftzoom.js" language="javascript" type="text/javascript"></script> <script type="text/javascript"> <!-- if(document.images&&document.createElement&&document.getElementById){ document.writeln('<style type="text/css">'); document.writeln('img.shiftzoom { visibility: hidden; }'); document.writeln('<\/style>'); } shiftzoom.defaultCurpath = 'images/cursors/'; //--> </script> </head> <body> <div id="content"> <div style="float: left; width:700px; height:300px; border:1px solid gray; margin-right: 1em; margin-bottom: 0.25em;"> <div style="width:700px; height:300px; background: url(images/indicator.gif) 50% 50% no-repeat;"> <img id="map" usemap="#map" class="shiftzoom" onLoad="shiftzoom.add(this,{showcoords:false,zoom:100});" src="assiut.jpg" width="700" height="300" alt="large image" border="0" /> </div></div></div> <map name="map" id="map"> <area shape="circle" coords="250,160,15" href="#nowhere" title="Ahmed house<br>name:ahmed<BR>Class:1-1" alt="" /> <area shape="circle" coords="110,164,15" href="#nowhere" title="Mohamed house<br>name:Mohamed<BR>Class:2-1" alt="" /> <area shape="circle" coords="190,362,15" href="#nowhere" title="Mostafa house<br>name:Mostafa<BR>Class:3-1" alt="" /> </map> </body> </html> the .js file in attachments which have somthing that keeps the #usemap from working, would be so thankful if anyone could help thanks I hope I have this post in the right place! Any help would be very much appreciated... I have a feature on my website that allows users to choose the website background (using alternate css sheets) and then uses an externally linked javascript file to store the background choice as a cookie so it is consistent throughout the website. This works perfectly locally (i.e. when previewing my website on my computer) but now it is uploaded to my host it doesn't appear to be working. (with the same browser) My javascript is he http://www. b r p - e n v .com/javascript/backgroundchange.js (with no spaces) The website that the javascript file is linked to is http://www. b r p - e n v .com (with no spaces) In the head I have: <script type="text/javascript" src="../javascript/backgroundchange.js"></script> ...then I have: <body onload="set_style_from_cookie()"> ...and for users to choose which background: <form> <input type="image" src="../images/white-background-thumb.jpg" onclick="switch_style('bg1');return false;" name="theme" value="White" id="bg1"> etc... </form> My problem is: The background reverts back to the default when moving to a different page. This would indicate that the background choice is not being saved in cookies. But this works locally! I have tried putting the javascript directly onto each page but I still had the same problem. I hope someone can help, I will be so grateful if I can get this to work. Many thanks indeed! Hey everyone here is my code for looking up a city, and state by zip code. I am getting no errors and i believe it should work, but the code does not seem to want to function. Any ideas? Here is my 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>City and State Lookup</title> <style type="text/css"> h1 { font-family:Arial; color:navy; } p, td { font-family:arial; font-size:11px; } </style> <script type="text/javascript"> /* <![CDATA[ */ var httpRequest = false; function getRequestObject() { try { httpRequest = new XMLHttpRequest(); } catch (requestError) { try { httpRequest = new ActiveXObject ("Msxm12.XMLHTTP"); } catch (requestError) { try { httpRequest = new ActiveXObject ("Microsoft.XMLHTTP"); } catch (requestError) { window.alert("Your browser does not support AJAX!"); return false; } } } return httpRequest; } function updateCityState() { if (!httpRequest) httpRequest = getRequestObject(); httpRequest.abort(); httpRequest.open("get","zip.xml"); httpRequest.send(null); httpRequest.onreadystatechange=getZipInfo; } function getZipInfo() { if (httpRequest.readyState==4 && httpRequest.status == 200) { var zips = httpRequest.responseXML; var locations = zips.getElementsByTagName("Row"); var notFound = true; for (var i=0; i<locations.length; ++i) { if (document.forms[0].zip.value == zips.getElementsByTagName( "ZIP_Code")[i].childNodes[o].nodeValue) { document.forms[0].city.value = zips.getElementsByTagname( "City") [i].childNodes[0].nodeValue; document.forms[0].state.value = zips.getElementByTagName( "State_Abbreviation")[i].childNodes[0].nodeValue; notFound = flase; break; } } if (notFound) { window.alert("Invalid ZIP code!"); document.forms[0].city.value = ""; document.forms[0].state.value = ""; } } } /* ]]> */ </script> </head> <body> <h1>City and State Lookup </h1> <form action=""> <p>Zip code <input type="text" size="5" name="zip" id="zip" onblur="updateCityState()" /></p> <p>City <input type="text" name="city" /> State <input type="text" size="2" name="state" /></p> </form> </body> </html> hereis the html file and javascripton click of this button a html ***************************** <table class=matcolor id=topnav cellspacing=0 cellpadding=0 width=550 border=0 bgcolor="#FFCCCC"> <tbody> <tr align=middle> <td id=menu1 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Desk Top Publishing </font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu2 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Transcription</font></div> </td> <td width=1 bgcolor=#ff9900 class="mat"></td> <td id=menu3 onMouseOver="this.className='mPrimaryOn';showmenu(this);" onClick="this.document.location.href=''" onMouseOut="this.className='mPrimaryOff';hidemenu(this);" class="mat" height="20"> <div align="center"><font color="#FF0000">Accounts Processing </font></div> </td> </tr> </tbody> </table> ***************************************** <script language=JavaScript> ix = document.getElementById('tblmenu1').getBoundingClientRect(); new ypSlideOutMenu("menu1", "right",ix.left + ix.right ,ix.bottom + 10); </script> **any thing i have to alter to work in firefox please help Ok so problem is that I'm using an XML generated intro for my website. My intro(index.html) is in the root directory with website home(index2.html). Issue is that I want the website to be loaded directly after intro in the same browser tab/window/page instead of a new one. Intro is using XML formatting and the Javascript being used is Asual SwfAddress 2.4 deeplinking for Flash and XML. Let me post some codes here from my website and intro; Intro.xml Code: <link url="index2.html" target="_self" /> Swfaddress.js 2.4 Where targets are set Code: {target=typeof target!=UNDEFINED?target:"_self";if(target=="_self"){self.location.href=url}else{if(target=="_top"){_l.href=url}else{if(target=="_blank"){window.open(url)}else{_t.frames[target].location.href=url}}}};this.popup=function(url,name,options,handler){try{var popup=window.open(url,name,eval(options));if(typeof handler!=UNDEFINED){eval(handler)}}catch(ex){}_popup=arguments} The intro is a template I'm using and I'm not familiar to its coding. I just want the intro to end and the website to load in the same browser window but its not happening. I've used other target options like 'parent' and 'top' but its not working. Also, on intro page there is a 'skip intro' button but when you click it intro keeps on playing and new window pop opens with the website. You can preview the website at; www.caterpowertrading.com and SWFaddress 2.4 at www.caterpowertrading.com/js/swfaddress.js No, its not using AS1-3. ~ Desperate Soul. PS: Sorry for multiple postings but its actually not! Hi all Sorry my first post is a question...but I hope you can help me out all the same. My name's Steve, and I have struggled (like all heck!) to figure this scenario out. I owe you a beer if you can help! OK, here's the scenario: I'm using a very basic redirect script, such as: Code: <html> <body> <script language="javascript" type="text/javascript"> function redirect(URL) { document.location=URL; return false; } </script> <a href="http://www.mywebsite.com" onclick="return redirect('http://www.mywebsite/contactme.html');">This Works</a> </body> </html> ...nothing you haven't seen a million times, right? BUT! I'd like the page I'm redirecting to (http://www.mywebsite/contactme.html) to open up an invisible iFrame, and then redirect the "parent" URL ("http://www.mywebsite.com") to an external site... So, 1) The visitor clicks on a link on my site (say, contactme.html) 2) The visitor is redirected to another page on my site (in an invisible iFrame)...e.g. mywebsite.com/processing.html 3) The iFrame loads in another invisible iFrame (for example, http://3rdpartysite.com/updatecontact.html) 4) The visitor on the contactme.html page is then redirected to a different domain (e.g. http://3rdpartysite.com/done.html) I've spent literally WEEKS trying to get this code going, and I'm now admitting defeat! I'm sure it's possible, but JS is not my specialist subject... ...at all I'd really appreciate ANY pointers, because I have a deadline to meet! Kind regards, Steve Hey guys, I am not sure why this JavaScript is not working. Can you check it out please? Thanks. --Start-- <html> <head> <title>Guess it up! </title> </head> <body> <center> <b><font size="5" ><u><b>Guess it up!<br></b></u> <br > <font size="3" > This is out of five! <br > Type in your guess: <p> </p> </font> <input name="HisGuess" type="text" size=1 value=1> <p> <input name="StartButton" type="button" value="Guess" onclick="StartGame()"> </p> <p> <script> var TheRightNumber = Math.round(Math.random * 5); function StartGame() { if (TheRightGuess == HisGuess){ alert("You got it! Nice!") else{ alert("Guess again!") } } </script> --END-- Can anyone tell my why this is not working? All answers are appreciated. I wrote a script that should loop through the list of countries, and if the entry's width exceeds 70px, it should cut the extra letters and insert "..." at the end of the entry; My codes produces unexpected results. The script only modifies the entry"United States", by replacing it with "Cook Isla...". I suspect I don't use the while loop properly. Plus the script does not work at all in IE. Could someone have a look and give me a hint what went wrong. Thank you very much!!! Code: <html> <head> <title> Ellipse Practice </title> <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> <style type="text/css"> ul { width: 200px; margin-left: 100px; } span { white-space: nowrap; } </style> <script type="text/javascript"> function trancateAll() { var list=document.getElementsByTagName("li"); count=0; while (count<list.length) { var text=String(list[count].innerHTML); list[count].innerHTML='<span id="mySpan">'+text+'</span>'; mySpan=document.getElementById("mySpan"); mySpan.innerHTML=''; var charac=1; while( (mySpan.offsetWidth<70) && (charac<text.length)) { mySpan.innerHTML=text.substr(0,charac)+"..."; charac++; } count++; } } </script> </head> <body > <ul> <li> United States</li> <li> Australia</li> <li> New Zealand</li> <li> Democratic Republic of Congo</li> <li> Russian Federation</li> <li> Cook Islands</li> </ul> <input type="button" value="Truncate" onclick="trancateAll()"/> </body> </html> Hey all, I have a javascript object which I have created and it works fine until I remove the second message box from the program steps. The alert box was only ever meant to be there for error debugging to steop me through the code. Any ideas? Code: function hyper() { this.test = ""; this.load = function(lib, ver) { alert("Starting API Library Load"); var oHead = document.getElementsByTagName('HEAD').item(0); var oScript= document.createElement("script"); oScript.type = "text/javascript"; oScript.src=lib + "/" + ver + "/api.js"; oHead.appendChild( oScript); alert("Finished Loading Library"); switch(lib) { case "test": this.test = new test(); break; case "ads": this.ads = new HAds(); break; case "chat": this.chat = new HChat(); break; case "survey": this.survey = new HSurvey(); break; default: alert("No Library"); }; } } Hi, I am wanting to install an automatic re-direction script. I have seen some pretty complicated ones and then I came across this: Code: <script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "mobile.html"; } //--> </script> Is that going to work ? Thanks . I'm a non-web programmer being forced to do some web programming. My immediate problem is that, on submission of a form, I need to be able to open a url (that I control) with the filled-in form values appended to the new url. In other words, I need to be able to do the equivalent of : Code: <form> <input name="key1" type="text"/> <input name="key2" type="text"/> <input type="button" value="Submit" onclick="window.open('http://new.domain.com/newpage.html?key1=val1&key2=val2')"/> </form> I would really like to do this without server-side code. Pointers? TIA |