JavaScript - The Reverse Effect - Same Window
i just read the other thread and i want the reverse affect. the slideshow opens in a new window and thats not what we want because the link is to a persons profile page. we dont want two versions of the site open at once.
this is the slideshow that client did on his own then i got the project. http://www.dynamicdrive.com/dynamici...nslideshow.htm Code: imagearray: [ ["pool.jpg"], ["http://mysite.com/cave.jpg", "http://cnn.com"], ["fruits.jpg", "http://cnn.com", "_new"], ["dog.jpg", "", "", "This image has a description but no hyperlink"] //<--no trailing comma after very last image element! ], i see "_new"], in there but i dont know if there is a command for self is it _self .. im not sure.. i assume it is different than the html target code. so how do i make it open in the same window just like target = self sorry had to change the target to non coded format to show up right in this thread Similar TutorialsI need help with a javascript calculation. I am a noobie developer as you will probably see by my script but here are my goals: I already have a working bmi calculator for my website where visitor will enter height and current weight to calculate their current bmi. then I want to have a reverse bmi calculator to grab the same height and weight from said bmi calculator to give a calculation with a fillable goal bmi (example: 18-24 "healthy bmi") to read out a goal weight for them to achieve. I have already figured out the first part of the bmi calculation now i just need the second calculation to grab the height and weight from original bmi calculator without needing to be filled in again and compute result in a second table. I will post code that I have come up with so far for the whole page. Thank you in advance for your help! [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title> HCG Drops Fat Lose 1-2 pounds Per Day! </title> <style type="text/css"> #wrapall { width:1000px; align:center; margin-left: 7em; margin-right: 7em; } #navigationbar{ } #bmibar { width:973px; background-image:url(bmibar2.jpg); background-repeat:no-repeat; background-position:left bottom; padding-bottom:16em; margin:4px; } #Hcgborder { width:973px; background-image:url(index_15.jpg); background-repeat:no-repeat; background-position:left bottom; padding-bottom:17em; } #Hcgborder h3 { width:973px; background-image:url(index_12.jpg); background-repeat:no-repeat; background-position:left top; margin:0px; padding-left:4em; padding-top:8em; } p { background-image:url(index_13.jpg); background-repeat:repeat-y; background-position:left center; margin:0px; padding-left:4em; padding-right:4em; font:family"arial" } #bmiscale{ font-size:14px; padding-left:15px; } #Hcgborder2 { width:973px; background-image:url(index_19.jpg); background-repeat:no-repeat; background-position:left bottom; padding-bottom:0.5em; } #dhtmlgoodies_bmi_calculator{ width:180px; /* Width of entire calculator */ height:145px; /* Height of entire calculator */ font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif; /* Fonts to use */ } #dhtmlgoodies_bmi_calculator .calculator_form{ /* Form */ width:180px; /* Width of form div */ float:left; /* Position the form at the left of the graph */ padding-left:5px; padding-right:5px; } #dhtmlgoodies_bmi_calculator input{ width:130px; } #dhtmlgoodies_bmi_calculator .calculator_form .textInput{ width:40px; /* Width of small text inputs */ text-align:right; /* Right align input text */ } .barContainer{ /* DIV for both the multicolor bar and users weight bar */ position:absolute; bottom:0px; border:0px solid #4ff; border-bottom:0px; text-align:center; vertical-align:middle; } .barContainer div{ /* colored div inside "barContainer */ border-bottom:1px solid #000; } .barContainer .labelSpan{ /* Label indicating users BMI */ background-color:#FFF; /* White BG */ border:1px solid #000; /* Black border */ padding:1px; /* "Air" inside the box */ font-size:0.9em; /* Font size */ } .clear{ /* Clearing div - you shouldn't do anything with this one */ clear:both; } </style> <script type="text/javascript"> var useCm = false; // Using centimetre for height, false = inch var useKg = false // Using kilos for weight, false = pounds var graphColors = ['#00baff','#02eb07','#ffb400','#ff0000']; var graphLabels = ['']; var labelsPerRow = 1; /* Help labels above graph */ var barHeight = 50; // Total height of bar var barWidth = 50; // Width of bars */ // Don't change anything below this point */ var calculatorObj; var calculatorGraphObj; var bmiArray = [0,18.5,25,30,60]; /* BMI VALUES */ var weightDiv = false; function calculateBMI() { var height = document.bmi_calculator.bmi_height.value; var weight = document.bmi_calculator.bmi_weight.value; height = height.replace(',','.'); weight = weight.replace(',','.'); if(!useKg)weight = weight / 2.2; if(!useCm)height = height * 2.54; if(isNaN(height))return; if(isNaN(weight))return; height = height / 100; var bmi = weight / (height*height); createWeightBar(bmi); } function createWeightBar(inputValue){ if(!weightDiv){ self.status = Math.random(); weightDiv = document.createElement('DIV'); weightDiv.style.width = barWidth + 'px'; weightDiv.className='barContainer'; weightDiv.style.left = Math.round((calculatorGraphObj.offsetWidth/2) + ((calculatorGraphObj.offsetWidth/2) /2) - (barWidth/2)) + 'px'; calculatorGraphObj.appendChild(weightDiv); var span = document.createElement('SPAN'); weightDiv.appendChild(span); var innerSpan = document.createElement('SPAN'); innerSpan.className='labelSpan'; span.appendChild(innerSpan); }else{ span = weightDiv.getElementsByTagName('SPAN')[0]; innerSpan = weightDiv.getElementsByTagName('SPAN')[1]; } var color = graphColors[graphColors.length-1]; for(var no = bmiArray.length-1;no>0;no--){ if(bmiArray[no]>inputValue)weightDiv.style.backgroundColor = graphColors[no-1]; } if(inputValue/1>1){ innerSpan.innerHTML = inputValue.toFixed(2); span.style.display='inline'; }else span.style.display='none'; var height = Math.min(Math.round(barHeight * (inputValue / bmiArray[bmiArray.length-1])),barHeight-10); span.style.lineHeight = Math.round(height) + 'px'; weightDiv.style.height = height + 'px'; } function validateField() { this.value = this.value.replace(/[^0-9,\.]/g,''); } function initBmiCalculator() { calculatorObj = document.getElementById('dhtmlgoodies_bmi_calculator'); calculatorGraphObj = document.getElementById('bmi_calculator_graph'); if(!useCm)document.getElementById('bmi_label_height').innerHTML = 'inches'; if(!useKg)document.getElementById('bmi_label_weight').innerHTML = 'pounds'; var heightInput = document.getElementById('bmi_height'); heightInput.onblur = validateField; var widthInput = document.getElementById('bmi_height'); widthInput.onblur = validateField; var labelDiv = document.createElement('DIV'); labelDiv.className = 'graphLabels'; calculatorGraphObj.appendChild(labelDiv); for(var no=graphLabels.length-1;no>=0;no--){ var colorDiv = document.createElement('DIV'); colorDiv.className='square'; colorDiv.style.backgroundColor = graphColors[no]; colorDiv.innerHTML = '<span></span>'; labelDiv.appendChild(colorDiv); var labelDivTxt = document.createElement('DIV'); labelDivTxt.innerHTML = graphLabels[no]; labelDiv.appendChild(labelDivTxt); labelDivTxt.className='label'; if((no+1)%labelsPerRow==0){ var clearDiv = document.createElement('DIV'); clearDiv.className='clear'; labelDiv.appendChild(clearDiv); } } var clearDiv = document.createElement('DIV'); clearDiv.className='clear'; labelDiv.appendChild(clearDiv); var graphDiv = document.createElement('DIV'); graphDiv.className='barContainer'; graphDiv.style.width = barWidth + 'px'; graphDiv.style.left = Math.round(((calculatorGraphObj.offsetWidth/2) /2) - (barWidth/2)) + 'px'; graphDiv.style.height = barHeight; calculatorGraphObj.appendChild(graphDiv); var totalHeight = 0; for(var no=bmiArray.length-1;no>0;no--){ var aDiv = document.createElement('DIV'); aDiv.style.backgroundColor = graphColors[no-1]; aDiv.innerHTML = '<span></span>'; var height = Math.round(barHeight * (bmiArray[no] - bmiArray[no-1]) / bmiArray[bmiArray.length-1]) - 1; aDiv.style.height = height + 'px'; graphDiv.appendChild(aDiv); } createWeightBar(1); } </script> <!-- function cal_bmi(lbs, ins){ h2 = ins * ins; bmi = lbs * h2/703 wtl = h2/703 * 24.9 f_bmi = Math.floor(bmi); diff = bmi - f_bmi; diff = diff * 10; diff = Math.round(diff); if (diff == 10){ f_bmi += 1; diff = 0; } bmi = f_bmi + "." + diff; return bmi; } function compute(){ var f = self.document.forms[0]; w = f.wt.value; v = f.htf.value; u = f.hti.value; // Format values for the calculation if (!chkw(u)){ var ii = 0; f.hti.value = 0; } else { var ii = parseInt(f.hti.value); } var fi = parseInt(f.htf.value * 12); var i = fi + ii; // Do validation of remaining fields if (!chkw(v)){ alert("Please enter your height."); f.htf.focus(); return; } if (!chkw(w)){ alert("Please enter your weight."); f.wt.focus(); return; } // Perform calculation f.bmi.value = cal_bmi(w, i); f.bmi.focus(); } function chkw(w){ if (isNaN(parseInt(w))){ return false; } else if (w < 0){ return false; } else{ return true; } } // --> </style> </head> <body> <div id="wrapall" align="center"> <img src="index_01_01.jpg" alt="Hcg drops fat banner"> <br/> <div id="navigationbar"> <a href="http://www.hcgdropsfat.com"><img src=hcghomeog.jpg border=0></a> <img src="hcgblogo.jpg" alt="Hcg blog"/> <img src="hcgfaqo.jpg" alt="Hcg faq"> <img src="hcgresourceso.jpg" alt="Hcg resources"> <img src="hcgtestimonialso.jpg" alt="Hcg testimonials"> <img src="hcgsupporto.jpg" alt="Hcg support"> <img src="hcgordero.jpg" alt="Hcg order"> <div id="bmibar"> <div style="position: absolute; top: 515px; left: 170px"; style="font-family: arial"; align="left";> How much is your weight in <br/>relation to your height <br/> <!--BMI CALCULATOR SCRIPT--> <div id="dhtmlgoodies_bmi_calculator"> <div class="calculator_form"> <form name="bmi_calculator"> <table> <tr> <td><label for="bmi_height">Height</label>:</td><td><input class="textInput" type="text" id="bmi_height" name="bmi_height"> <span id="bmi_label_height">cm</span></td> </tr> <tr> <td><label for="bmi_weight">Weight</label>:</td><td><input class="textInput" type="text" id="bmi_weight" name="bmi_weight"> <span id="bmi_label_weight">kg</span></td> </tr> <tr> <td colspan="2"><input type="button" onclick="calculateBMI()" value="Find BMI"></td> </tr> </table> </form> </div> <div class="calculator_graph" id="bmi_calculator_graph"> </div> </div> <script type="text/javascript"> initBmiCalculator(); </script> </div> <div style="position: absolute; top: 515px; left: 405px"; style="font-family: arial"; align="left";> What is your BMI category? <br/>This will help determine <br/>how much you need to lose <br/><br/><div id="bmiscale">Underweight = Under 18.5 <br/>Normal weight = 18.5 – 24.9 <br/>Overweight = 25 – 29.9 <br/>Obesity = 30 or more <br/><br/> </div></div> <div style="position: absolute; top: 515px; left: 640px"; style="font-family: arial"; align="left";> Calculate approximately how <br/>much weight you should lose<br/> to be at a healthy BMI <!--REVERSE BMI CALCULATOR--> <td width="81%" valign="top"> <br/><div align="center" class="page_header">Reverse BMI Calculator</div><br/> <div align="center" class="main_text"></div> <form action="" method="post" name="BMI_input" class="main_text" id="BMI_input"> <div style="text-align: center;"><font face="Arial, Helvetica, sans-serif">Target BMI:<b> <input id="FormsEditField4" type="text" name="wt" value="24" size="3" maxlength="2" /> <br /> </b></font></div> <div style="text-align: center;"> <font face="Arial, Helvetica, sans-serif"> <input type="button" name="FormsButton1" value="Find Target Weight" id="FormsButton1" onclick="self.compute()" /> </font></div> <div style="text-align: center;"><font face="Arial, Helvetica, sans-serif">This is your Target Weight: <br /> <input id="FormsEditField5" type="text" name="bmi" value="" size="4" maxlength="5" /> </font></div> </div> </div> <div id="Hcgborder"> <h3></h3> <p align="left"><b> WHAT IS HCG? </b><BR/><BR/>In simple terms: its a hormone protein produced by pregnant women that when used as a homeopathic dietary supplement, will assist in a revolutionary cure to the traditional diet routine. <BR/><BR/><b>HCG is so unique from other diets in 3 major ways: </b> <br/><BR/><img src="muscletissue.jpg" alt="practice"style="float:right;" width="250px" height="250px"/> 1. USES HIGHEST FAT AS PRIMARY FUEL SOURCE FOR THE BODY - it begins to break down the abnormally high body fat as the primary fuel source (BURNS ALOT OF FAT!) <BR/>2. DOESNT EAT AT VITAL MUSCLE TISSUE - it will preserve and maintain lean body muscle (without HCG THE BODY WOULD DEPLETE VITAL MUSCLE TISSUE ON A LOW CALORIE DIET. Also if you burn muscle you also lose metabolism for each pound of muscle you lose you also lose 50 calories of metabolism) <BR/>3. WHILE MOST DIETS SLOW METABOLISM HCG ACTUALLY MAINTAINS IT EVEN AFTER THE DIET - because hcg maintains lean muscle and maintains metabolism, you keep your metabolism in check long after the diet program so you reset your bodys roaming weight. <BR/><BR/>THE HOMEOPATHIC DROPS YOU WILL FIND ON OUR SITE ARE ALL NATURAL <br/><BR/><b>HOW LONG HAS IT BEEN AROUND?</b> <BR/><BR/>HCG or (Human chorionic gonadotropin)<img src="nicefigure.jpg" alt="Hcg stored fat" style="float:right;" width="250px" height="250px"/> is a protein hormone </div><!--p1--> </div><!--Hcgborder--> <div id="Hcgborder2"> <p><b>hello</b></p> <p>Hello again</p> </div><!--Hcgborder2--> </div> </div><!--wrapall--> </body> </html> [CODE] Hi Fellows, Just a quick question, is there a fucntion or a way to get the current date and time of a unix datetime stamp in javascript? I use something like Code: var end_time = end_dateTime.getTime(); but now I need a way to find out what the current date and time is after modifying the end_time variable. Thanks a lot!!! I'm pretty beginner at javascript, and I have this script for letter to phonetic: Code: <script language="JavaScript"> function flip() { var result = flipString(document.f.original.value.toLowerCase()); document.f.flipped.value = result; } function flipString(aString) { var last = aString.length - 1; var result = new Array(aString.length) for (var i = last; i >= 0; --i) { var c = aString.charAt(i) var r = flipTable[c] result[i] = r != undefined ? r : c } return result.join('') } var flipTable = { a : 'aye ', b : 'bee ', c : 'sea ', d : 'dee ', e : 'eeh ', f : 'eff ', g : 'gee ', h : 'aych ', i : 'eye ', j : 'jay ', k : 'kay ', l : 'el ', m : 'em ', n : 'en ', o : 'oh ', p : 'pee ', q : 'cue ', r : 'are ', s : 'es ', t : 'tee ', u : 'you ', v : 'vee ', w : 'doubleyou ', x : 'ex ', y : 'why ', z : 'zee ', 1 : 'one ', 2 : 'two ', 3 : 'three ', 4 : 'four ', 5 : 'five ', 6 : 'six ', 7 : 'seven ', 8 : 'eight ', 9 : 'nine ', 0 : 'zero ', '<' : 'left-inequality ', '>' : 'right-inequality', ':' : 'colon ', ';' : 'semicolon ', '(' : 'left-parenthesis ', ')' : 'right-parenthesis ', ' ' : 'space ', '?' : '? ', '!' : '! ', '.' : '. ', ',' : ', ' } for (i in flipTable) { flipTable[flipTable[i]] = i } </script> It's code based on text flipper. Anyways, if you type in A, the output would be aye. How would I go about switching this script so when one puts in 'aye' the output is the letter A? Howdy Community, I have spent the past 4 hours strait looking for and trying to modify an accordion style vertical menu who's elements slide out of the top and up instead of the normal slide out of the bottom and down action. I would like it in jQuery, but at this point I will take any library. Thanks for your help. I know some have wondered "What have you tried making work".. jQuery Tools, Jquery UI and about 3 other scripts that looked updateable. All I couldn't get to work. I also made an attempt to fake an accordion using show/hide toggles and this sorta worked, but it didnt have the nice slide as well as my data didnt move on page in the right direction. Headache!!! Help!! Thanks, Cesar i have this code i need to close the parent.html window when the child window opened, i need the code for that working well in IE and Firefox Parent.html <HTML> <SCRIPT TYPE="text/javascript"> function sendTo() { window.open('child.html','_blank','resizable=yes,width='+(screen.width-500)+',height='+(screen.height-500)+''); } </SCRIPT> <BODY > <form name="form"> <input type="text" value="" name="text1" id="pdetails1"> <input type="text" value="" name="text1" id="pdetails2"> </br> <input type="submit" value="submit" onClick="sendTo()"> </BODY> </HTML> child.html <html> <body> <form> <input type=text name="text5" value=""> <input type=submit name="submit"value="submit"> </form> </body> </html> Hello all, and thank you for your coments, I want to preserve a 16/9 aspect ratio to the window after any resize, making the width a function of the height. As I have a window.resizeTo() inside the window.onresize event function, the infinite loop is served. How may I quit it? Code: <html><head><title>Title</title><script languaje="javascript"> const c_ra=16/9; window.onresize = function WindowReSize() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE // myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' // myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } myWidth = Math.floor(myHeight*c_ra); window.resizeTo(myWidth,myHeight); // ** CAUTION resize event in a onresize event handler ! }; </script></head><body><p>Hello World</p></body></html> hello everybody i need your help and experience for having code to show ( overlay / modal window ) to the user when closing or navigating away from the page ( i want put in this window facebook share to make the user to share the page in his facebook ) , bytheway i wanna use it in my wordpress in every post could it be happen ? Thanks for helping Here is the program: http://www.1728.com/newwindow.htm Basically, I want to input a number in the input box, which assigns a number to the variable numval located at document.box1.b1. When clicking on the "new window" button, an alert displays the input box value, then another window opens and displays the integers 1 through 12 and the amount squared. I would like the new window to obtain the number from the previous window so that the new window will display integers (and their squares) from 1 to the value of numval. I am looking to have a link open a closeable window that is contained within a browser window. If you click on the "sizing charts" link on this website, this is exactly what I am looking to do: http://www.bella.com/mapper.php?pageid=40 The window is contained within the current browser window, it can be dragged around, but not outside the parameters of the browser window. Is there a title for this technique that I can research? Not looking to waste anybodys time, but if I can get steered in the right direction it would be greatly appreciated. Thanks I have created and opened a child window called "checkwin" and have written some data to it. If the data is valid, I want the user to click on the 'CONFIRM' button on the child window, at which time I want the "submit()" function for the form on the parent window to be executed. If the data is invalid the user clicks on 'MODIFY' and I want focus to return to a field on the parent form. However, when I click on the "CONFIRM" or "MODIFY" buttons on the child window, nothing happens. Here is the code: Code: checkwin.document.write("</td></tr><tr><td align='right'><input type='button' value='CONFIRM' onclick='opener.document.personnel_form.submit()'></td><td></td><td><input type='button' value='MODIFY' onclick='opener.document.personnel_form.first_name.focus()'></td></tr></table>") After following the instructions from the answer below: http://bytes.com/topic/javascript/an...arent-document I was able to have the child window perform the function defined in the parent window. The function was to only have an alert window pop up as the child page was loading. I easily modified this to my intention which was to have a parent function performed when the child window was clicked. Using the body tag: Code: <body onclick="parent.FUNCTION NAME HERE()"> I first change the method in which the function would be triggered, all went well there. then I tried to change which function would be triggered. (Basically use the function I wanted to happen on click of the child window rather then the function from the test). Once I did this switch, nothing happens. The site this is being used on is: http://tylerpanesar.ca/ What I want is when the menu bar is open in the parent window, the user chooses a link and the menu closes and goes to that link in the child window. This already works. However if the user opens the menu bar and then changes there mind and continues with the page the are currently on (clicks any content in the child window), the menu stays open. Currently the menu "hides" only when you choose one of the menu items, but it does not "hide" when you CLICK on child document. If you could figure out how to get it to "hide" on a "mouse out" that would be the better option. I attempted this method however i could only get it to "toggle" the menu on "mouse out". This method does however create an annoying flicker when you hover over the menu items (as it is toggling the open menu command I guess). If I had it "hide" the menu on "mouse out" it would "hide" as soon as you moved off of the main button. The viewer doesn't even have a chance to click a link. or at least that is what happens when I did it. You may have a better method to achieve this. The script that tells it to hide on click is within a jQuery function: Code: menua .click( function(){ menu.hide(); the code I used for the mouseout toggle was: Code: menu .mouseout( function(){ menu.toggle(); Here is the script that I am currently using for the menu to open and the "click" hide feature. This menu feature comes from the following help: http://www.bennadel.com/blog/1740-Bu...-FaceBook-.htm Code: <script type="text/javascript"> jQuery(function( $ ){ var menuRoot = $( "#menu-root" ); var menu = $( "#menu" ); var menua = $( "#menu a" ); // Hook up menu root click event. menuRoot .attr( "href", "javascript:void( 0 )" ) .click( function(){ // Toggle the menu display. menu.toggle(); // Blur the link to remove focus. menuRoot.blur(); // Cancel event (and its bubbling). return( false ); } ) ; menua .click( function(){ // Toggle the menu display. menu.hide(); } ) ; // Hook up a click handler on the document so that // we can hide the menu if it is not the target of // the mouse click. $( document ).click( function( event ){ // Check to see if this came from the menu. if ( menu.is( ":visible" ) && !$( event.target ).closest( "#menu" ).size() ){ // The click came outside the menu, so // close the menu. menu.hide(); } } ); }); </script> I've tried adding the click to "hide" menu feature to the child document but there is now menu in that document for it to "hide". What I was trying to was have the child document execute a function from the parent document and have that function executed IN the parent document. I've tried the technique from the link in my very first post but I believe it only calls the function from the parent and executes it IN the child. Which does not work for me as the menu is not in the child. There should be a way to make the child execute a function FOR the parent. I apologize for this very wordy post, but I am extremely frustrated with this now as I have been trying to get this to work for a few weeks now. Any help would be greatly appreciated. Thanks in advance, Tyler Hi All, I need to show/focus the parent window which is in back when click a link from child window in Chrome.This problem is in Chrome browser only. We have used the below code self.blur(); Window.opener.focus(); But this is not working in Google Chrome. Please suggest me some workaround to achieve this. Thanks in Advance Reply With Quote 12-19-2014, 09:26 PM #2 Old Pedant View Profile View Forum Posts Supreme Master coder! Join Date Feb 2009 Posts 28,311 Thanks 82 Thanked 4,754 Times in 4,716 Posts Window is not defined. window is. JavaScript (and the DOM) is case sensitive. You must pay attention to upper/lower case spelling, carefully. By the way, you shouldn't need the blur() call. If you focus on some window (any window) then any other focus should be lost. I have the code below in my popup window which currently brings up a blank page in the background as the main window. Instead I want the popup to come up but the original page I left is in the background as the main window. Does anyone know how I can do that with the code I currently have. Code: <html> <head> <title>JavaScript Popup Example 3</title> </head> <script type="text/javascript"> function poponload() { testwindow = window.open("", "mywindow", "location=0,status=0,scrollbars=0,width=350,height=400"); testwindow.moveTo(0, 0); testwindow.document.write('<h1>Get outta here!</h1><a href="javascript:void(0);" onclick="window.opener.history.go(-1); self.close();">Parent back button</a>'); testwindow.focus(); } </script> <body onload="javascript: poponload()"> </body> </html> Hi Ive found out how to force another browser window to open at a certain size when a link is clicked. Here's the whole line of code including the layer, the javascript and the image, <div id="Layer6" style="position:absolute; width:10px; height:8px; z-index:6; left: 561px; top: 310px"><a href="javascript:;" onClick="MM_openBrWindow('navigation%20instructions.htm','','width=50,height=50')"><img src="images/info.gif" width="15" height="15" border="0"></a></div> How do I adapt this so I can also specify the x&y co-ordinates of the opened window relative to the window that launched it. thanks alot Masten I have been searching for a long time but have been unsuccessful on how to develop a drop down menu but have the menu items show in a list above the main nav. Not below. I really like the way this functions: http://www.sohtanaka.com/web-design/examples/toggle/ But I would like the item in the list to appear above the main nav so it animates up not down. Can anyone help me on how to alter this js code to perform this task? Here is the jQuery file link: http://code.jquery.com/jquery-latest.js I tried going through this js file but it very complex. Can anyone tell me what I need to change to have the animation roll up instead of down? Any help would be most appreciated. I am currently creating which will allow the user to upload their own pictures. For this I am opening a new pop up window where the user can select the file they wish and then upload it (similar to ebay's picture upload). The pop up works fine and so does the file upload however I am having trouble transferring any data from the pop up window back to the parent window. I have been investigating the opener method but cannot seem to get it to work. Below is some simple code that I've been trying to get to work... Thanks for any help! first page... Code: <form name="loadpic" id="loadpic" action="createPost.php" method="post"> <br /> <br /> Testing transfer between pages... <input type="button" value="open pop up" onclick="window.open('popup.php','pop up box','width=400,height=200')" /> <br /> <br /> <span name="myspan" id="myspan">text here</span> </form> pop up page... Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Pop Up</title> <script language=javascript> function transfer(){ opener.document.loadpic.myspan.innerHTML = "working"; window.close(); } </script> </head> <body> This is the pop-up page! <input type="button" onclick="return transfer()" value="press me" /> </body> In my main window, I create a popup window. Is there a way to bring the main window back to the foreground (make the main window the focus window again) from the popup window using JS? Like from a link or a button? Thanks I am trying to pop up a window and then do stuff(set flags) when the content of the new window is done loading. For this I am trying to detect the window.onload of the pop-up child window but so far I am unsuccessful. I believe my problem is that the URL of child window is on different domain, than the one of the opener(parent) so that the window.onload is not being called. Thought this may change, at the moment I do not have access to the code for the page I'm opening up in the pop-up. Im pretty new to web development. Any help is appreciated. Heres my js code Code: //globals var popupHandle = null; var openingWindow = false; function popWindow(URL){ var windowId="sameid"; if (openingWindow == true) { alert("Please wait, content is still loading") return; } if ((popupHandle == null || popupHandle.closed)){ //is first time run or window was closed openingWindow = true; popupHandle = window.open(URL, '" + windowId + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=900,height=500'); popupHandle.onload = function(){ //this is the code that never executes even if I all I put in here is simple alerting openingWindow = false; windowHandle.focus(); }; } else{// window still exists, reset attributes if (popupHandle != null) { popupHandle.location.href = URL; popupHandle.focus(); } } } Note: The whole reason why I am doing this is because if its the first time I am clicking on the button that will open this pop up window and I click it repeatedly very quickly, a new pop up is opened for each time I clicked eventhough the window.open is supposed to reuse the window if it has the same windowId. The first call to window.open takes long enough to not have a window handle ready and this allows other clicks to get through. Hi, I have parent page with 10 child window and i want to close all child window when click on close session button on parent but first i need to check whether any child window open or not after that action should be done for close the child window. |