JavaScript - Blind Opening In The Center Of The Page
Hi
I have a requirement. I have a page that has a number of blinds. When the user clicks on any one of the blinds, it should align itself to the center of the page. I tried this approach var sHeight = screen.height/2; document.body.scrollTop = sHeight - (sHeight - clientYvalue); blindPosition = clientYvalue; but it is not working. Any help would be appreciated. Thanks Vamsi Similar TutorialsGreetings too all, here is my personal website. Situation I have a relatively simple few lines of javascript that allow me to slideToggle a div (#main-content-info) into (and back out of) display. The div begins with its display set to none and when the header buttons at the top of the page are clicked, (#main-content-info) slides into display. Problem The function stops working when you navigate to other pages in the site (by using the "Browse Portfolio" drop down). Question How do I allow this function to perform on all pages of the site? Please see code below. Code: $(document).ready(function(){ $(".slide-button-one").click(function(){ $("#main-content-info").slideToggle(600,function(){ $("#main-content-portfolio").toggle(); }); return false; }); }); Thank you for your time and I would appreciate any responses, long or short – including "don't do it like that, do it like this." Rob I have auto cursor focus event to be triggered when data is entered in a field.The issue is in the table when the cursor focuses to next field, that field doesnt come into view. the user can not see what he is entering in the field. This problem is for IE7, this wrks fine on mozilla. the horizontal bar scrolls automatically in mozilla but not in IE7, hence causing the problem. Please help me resolving this. hello everybody, I need help about, I need to change the result to opening a url page. This script results in a value and I need the result to be open a url page. Can anyone help me?? <SCRIPT language="Javascript"> nome = new Array(4); nome[0] = new Array(4); nome[1] = new Array(4); nome[2] = new Array(4); nome[3] = new Array(4); nome[0][0]="1500"; nome[0][1]="1250"; nome[0][2]="1300"; nome[1][0]="800"; nome[1][1]="850"; nome[1][2]="900"; nome[2][0]="500"; nome[2][1]="520"; nome[2][2]="540"; nome[3][0]="400"; nome[3][1]="356"; nome[3][2]="234"; function affi() { document.form.txt.value=nome[document.form.liste.selectedIndex][document.form.taille.selectedIndex]; } </SCRIPT> <form name="form" class="texto" > Choose the article : <select name="liste"> <option>Camisas <option>Polos <option>T-shirts <option>base corporal </select> <br> Choose the size: <select name="taille"> <option>T. Small <option>T. Médium <option>T. Large </select> <br> <input type="button" value="Obter preço" onClick="affi(this.form)" name="button"> <br> <br> <input type="TEXT" name="txt"> </form> Thank's in advance rui Hi there! I've been trying to edit this script but it continues to open my slideshow images into new tabs. I would like that the images on the slideshows when clicked they will open in the same tab. How can I do that? Thanks in advanced Here is the script I am using <a href="javascript:gotoshow()"><img src="http://imgkk.com/i/hPnvq8.jpg"target="_self""_innerframe" name="slide" border=1 width=375 height=275></a> <script> <!-- //configure the paths of the images, plus corresponding target links slideshowimages("http://imgkk.com/i/hPnvq8.jpg","http://imgkk.com/i/blxJnL.jpg","http://imgkk.com/i/7UzTr8.jpg","http://imgkk.com/i/_CP_mA.jpg") slideshowlinks("http://www.pimpthatfood.com/ptf-articles","http://www.pimpthatfood.com/food-forum","http://www.pimpthatfood.com/ptf-store","http://www.pimpthatfood.com/healthips") //configure the speed of the slideshow, in miliseconds var slideshowspeed=5000 var whichlink=0 var whichimage=0 function slideit(){ if (!document.images) return document.images.slide.src=slideimages[whichimage].src whichlink=whichimage if (whichimage<slideimages.length-1) whichimage++ else whichimage=0 setTimeout("slideit()",slideshowspeed) } slideit() //--> </script> This used to work and suddenly it does not work in IE. Here's the function Code: function pdfWindow(loc) { if(loc == "#RefQuide") { location.href = loc; } else { // The window attributes var window_attribs = "height=650,width=850,resizable=yes,scrollbars=yes"; window.open(loc,"PDF",window_attribs); } } Here's part of the HTML Code: <form name="myForm"> <select name="hypercomList"> <option value="/CWRWeb/pdf/HypercomT4000.pdf">Hypercom T4000 </option> <option value="/CWRWeb/pdf/HypercomT4100.pdf">Hypercom T4100 </option> </select> <input type="button" value="Go!" onclick="pdfWindow(myForm.hypercomList.options[myForm.hypercomList.selectedIndex].value)"> </form> Any ideas why it would open a blank page instead of the PDF? Works ok in FF. Hi, I am using Javascript to display options in a form with 2 dropdown lists. However, despite using the rel="nofollow" target='_self', the result opens in a new window. Help would be much appreciated. Code: // JavaScript Document function setOptions(chosen) { var selbox = document.ChronoContact_course_finder.opttwo; selbox.options.length = 0; if (chosen == ' ') { selbox.options[selbox.options.length] = new Option('Choose Option',' '); } if (chosen == '85') { selbox.options[selbox.options.length] = new Option('ITEC Beauty Specialist Diploma','index.php?option=com_content&view=article&id=49&Itemid=68',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('ITEC Professional Makeup','index.php?option=com_content&view=article&id=57&Itemid=76',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Fashion Catwalk & Photographic Makeup Course','index.php?option=com_content&view=article&id=67&Itemid=91',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Bridal Makeup Course','index.php?option=com_content&view=article&id=68&Itemid=92',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Special Effects Makeup','index.php?option=com_content&view=article&id=56&Itemid=77',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Gel Nails Course','index.php?option=com_content&view=article&id=65&Itemid=88',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Acrylic Nails Course','index.php?option=com_content&view=article&id=66&Itemid=89',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Spray Tanning Course','index.php?option=com_content&view=article&id=55&Itemid=73',rel="nofollow" target='_self'); } if (chosen == '69') { selbox.options[selbox.options.length] = new Option('ITEC Holistic Massage Course','index.php?option=com_content&view=article&id=51&Itemid=2',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('ITEC Sports Massage Diploma','index.php?option=com_content&view=article&id=59&Itemid=78',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('Indian Head Massage Course','index.php?option=com_content&view=article&id=60&Itemid=79',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('ITEC Reflexology Diploma','index.php?option=com_content&view=article&id=64&Itemid=87',rel="nofollow" target='_self'); } if (chosen == '80') { selbox.options[selbox.options.length] = new Option('ITEC Teaching Diploma','index.php?option=com_content&view=article&id=61&Itemid=81',rel="nofollow" target='_self'); selbox.options[selbox.options.length] = new Option('FETAC Train The Trainer Level 6','index.php?option=com_content&view=article&id=63&Itemid=86',rel="nofollow" target='_self'); } if (chosen == '83') { selbox.options[selbox.options.length] = new Option('ITEC Sports Massage Diploma','index.php?option=com_content&view=article&id=59&Itemid=90',rel="nofollow" target='_self'); } } And the HTML... Code: <div class="form_item"> <div class="form_element cf_heading"> <h1 class="cf_text">course finder</h1> </div> <div class="cfclear"> </div> </div> <div class="form_item"> <div class="form_element cf_dropdown"> <label class="cf_label" style="width: 200px;">Step 1: Choose type of course</label> <select name="optone" class="cf_inputbox" size="1" onchange="setOptions(document.ChronoContact_course_finder.optone.options[document.ChronoContact_course_finder.optone.selectedIndex].value);"> <option value=" " selected="selected">Choose Option</option> <option value="85">Beauty courses</option> <option value="69">Complimentary courses</option> <option value="80">Teaching courses</option> <option value="83">Fitness courses</option> </select> </div> <div class="cfclear"> </div> </div> <div class="form_item"> <div class="form_element cf_dropdown"> <label class="cf_label" style="width: 200px;">Step 2: Choose a subject</label> <select size="1" name="opttwo" class="cf_inputbox" > <option value=" " selected="selected">Choose Option</option> </select> <!--<input type="button" name="go" value="Value Selected" onclick="window.open(document.ChronoContact_course_finder.opttwo.options[document.ChronoContact_course_finder.opttwo.selectedIndex].value);">--> </div> <div class="cfclear"> </div> </div> <div class="form_item"> <div class="form_element cf_button"> <input type="submit" name="go" value="search" onclick="window.open(document.ChronoContact_course_finder.opttwo.options[document.ChronoContact_course_finder.opttwo.selectedIndex].value);"> </div> <div class="cfclear"> </div> </div> Many thanks, Paul Probably a stupid noob question, is there any way I can stop document.write from outputting info to a new page I would prefer to have it shown in a textarea. Info from an array that is suppose to display in a text area when button is clicked and when another button is clicked it is suppose to show some other info. But what happens is the first info displays in textarea for a few seconds and then the second info is displayed but on a new page and not the textarea where I want it to go I have marked code within the code // I want this specific code to be displayed second but I know its in the wrong spot. Here is the code [CODE] function show() { var myArray = new Array(); myArray[0] = document.getElementById('fullname').value; ' myArray[1] = document.getElementById('address').value; myArray[2] = document.getElementById('phone').value; myArray[3] = document.getElementById('email').value; //Code I want to display second in the textarea //var string = myArray.join("\n") //document.getElementById('textarea').value = string; document.writeln('Thank you for registering,' + ' ' + myArray[0] + '. Your membership will be confirmed by E-mail to ' + myArray[2] + "<br>"); document.writeln('Registration Details:') document.writeln("<br>") for (var i=0; i<myArray.length; i++) { document.write(myArray[i] + "<br>"); } } [\CODE] Thanks in advance Hi there! I am using GlassBox "http://www.glassbox-js.com/" As a light box on a website. Basically, You click an thumbnail image, and a window pops up with a larger version of that image. Now originally, the window opened X number of pixels from the top of the page. However, My thumbnail images were located mid page, so when you clicked on one, the window would open at the top of the page and the user would not see it unless they scrolled up. So I attempted to modify the script so that it would get the users page width/height and display it directly in the center no matter the position. Now my problem is that the script only works when the user has already scrolled down. So if the page is scrolled all the way to the top, and you click on a thumbnail, the window will not open center screen. Here is an example: http://synaxis.pcriot.com/ When the page loads, DO NOT scroll it, and click on the image. You will see the window pop up, and not centered, like it should be. However, now if you scroll down, and click the image again, you see that it is now centered. I also noticed that when the page is scrolled up, and the image does not center, it always is placed below the thumbnail image, or otherwise where ever the DIV is located. It normally located under the image, but if i place the DIV at the top of the page then the window will pop up there. And this does happen on every browser that I have tested, Firefox, IE, and Chrome. So, I am pretty much stumped as to why this is happening. If anyone can shed some light I would be very grateful. Thank You Here is a link to the original code: http://synaxis.pcriot.com/javascript...ox/glassbox.js And modified code: http://synaxis.pcriot.com/javascript...ox/glassbox.js The modified code is at the very bottom of the script. Original Code: Code: /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } Modified Code Code: /** * @private */ var removeElement = function(id) { var Node = document.getElementById(id); Node.parentNode.removeChild(Node); } /** * @private */ var getDocHeight = function() { var db = document.body; var ddE = document.documentElement; return Math.max( db.scrollHeight, db.offsetHeight, db.clientHeight, ddE.scrollHeight, ddE.offsetHeight, ddE.clientHeight ); } /** * @public */ if ( typeof($) == 'undefined' ) { $ = function (id) { return document.getElementById(id); } } I need to add a form field to be on the top - centered on the page regardless if the page is portiat or landscape. Is this possible? Everything works like a Charm with the exception of the alignment on the different page orientation - Here is what I have so far: // add form field to each page of the PDF for (var pageNumber = 0; pageNumber < this.numPages; pageNumber++) { var dateStamp = this.addField("DateStamp","text",pageNumber,[450,770,155,790]); dateStamp.textSize=10; dateStamp.textColor=color.red;} this.setAction("WillPrint", "var today = new Date(); var current_hour = today.getHours(); var current_minute = today.getMinutes(); this.getField('DateStamp').value = \"Valid 24 Hours From Printed Date... \" + util.printd(\"dd/mmm/yyyy\",new Date()) + \" \" + current_hour + \":\" + current_minute;"); Please help! DSatele Hello all, I'm trying to open up an internal link from my leftnav div into my content div. I used the following JS code from my book but im not quite sure how to make it all work. Any thoughts appreciated. Thank you 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> <!--header script starts here --> <script type="text/javascript"> window.onload = initlinks; function initlinks() { for (var i = 0; i < document.links.length; i++) { document.links[i].onclick = setContent; } } function setContent() { document.getElementById("content").contentWindow.document.location.href = this.href; return false; } </script> <style type="text/css"> html, body { margin: 0; padding: 0; } #container { width: 90%; margin: 10px auto; background-color: #fff; color: #333; border: 1px solid gray; line-height: 130%; } #header { height: 60px; background-color: #ddd; border-bottom: 1px solid gray; } #leftnav { float: left; width: 160px; height: 380px; margin: 0; padding: 1em; } #content { margin-left: 200px; border-left: 1px solid gray; padding: 1em; height: 380px; } </style> <title>JavaScript</title> </head> <body> <div id="container"> <div id="header"> <h1>JavaScript</h1> </div> <div id="leftnav"> <p> <a href='#'>Load Content</a> <br /><br /> <a href='#'>Load Content</a> <br /><br /> <a href='#'>Load Content</a> <br /><br /> <a href='#'>Load Content</a> <br /><br /> <a href='#'>Load Content</a> <br /><br /> </p> </div> <!--Div to load content into--> <div id="content"> <h2>Subheading</h2> <p> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel erat volutpat. </p> </div> </div> </body> </html> Ok, newbie here. Like, REAL new. Anyway, used some script for an animated drop down menu from clarklab.net. I want users to click on menu to expand to sub's, but I can't figure out how to fix it from expanding every single one. I also want users to be able to close back up. Help? I am ready to jump. Thanks Here is the site, vertical navigation on left side: Here's ma' code Code: <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function () { $("ul.menu_body li:even").addClass("alt"); $('.menu_head').click(function () { $('ul.menu_body').slideToggle('medium'); }); $('ul.menu_body li a').mouseover(function () { $(this).animate({ fontSize: "14px", paddingLeft: "20px" }, 50 ); }); $('ul.menu_body li a').mouseout(function () { $(this).animate({ fontSize: "12px", paddingLeft: "10px" }, 50 ); }); }); </script> Code: <div class="container"> <div class="menu_head_nodrop"><p><a href="administrativeservices.html">Administrative Services</a></p> </div> <div class="menu_head_nodrop"> <p><a href="birthdeathcertificates.html">Birth & Death Records</a></p> </div><div class="menu_head"> <p>Construction Programs</p> </div> <ul class="menu_body"> <li><a href="manufacturedhomes.html">Manufactured Homes Installation</a></li> <li><a href="plumbingprogram.html">Plumbing Inspections</a></li> <li><a href="healthyhomes.html">Healthy Homes</a></li> </ul><div class="menu_head"> <p>Environmental Health</p> </div><ul class="menu_body"> <li><a href="environmentalhealth.html">Beach Monitoring</a></li> <li><a href="rabies.html">Rabies Control</a></li> <li><a href="foodprotection.html">Food Service</a></li> <li><a href="householdsewage.html">Sewage Treatment Systems</a></li> <li><a href="Radon.html">Radon</a></li> <li><a href="leadsafety.html">Lead Safety</a></li> <li><a href="manufacturedhome.html">Manufactured Home Parks</a></li> <li><a href="marinas.html">Marinas</a></li> <li><a href="http://0052c90.netsolhost.com/nuisance.html">Nuisance Complaints</a></li> <li><a href="privatewater.html">Private Water Systems</a></li> <li><a href="poolandspa.html">Public Swimming Pools & Spas</a></li> <li><a href="realestatesurveys.html">Real Estate Surveys</a></li> <li><a href="rvparks.html">RV Parks & Campgrounds</a></li> <li><a href="http://www.odh.ohio.gov/odhPrograms/eh/schooleh/sehmain.aspx" target="_blank">Schools</a></li> <li><a href="tattooandbody.html">Tattoo & Body Piercing</a></li> </ul><div class="menu_head"> <p>Health Education & Outreach</p> </div><ul class="menu_body"> <li><a href="communityhealth.html">Community Health</a></li> <li><a href="http://www.scrubclub.org/home.aspx" target="_blank">Handwashing</a></li> <li><a href="healthyhomes.html">Healthy Homes</a></li> <li><a href="leadsafety.html">Lead Safety</a></li> <li><a href="lifeskills.html">LifeSkills</a> <li><a href="schoolwellness.html">School Wellness</a> <li><a href="smokefreeworkplace.html">Smoke Free Workplace</a></li> <li><a href="teenpregnancy.html">Teen Pregnancy Prevention</a></li> </ul><div class="menu_head"> <p>Nursing & Clinic Services</p> </div><ul class="menu_body"> <li><a href="familypractice.html">Family Practice Services</a></li> <li><a href="bccpinfo.html">Breast & Cervical Cancer Program</a></li> <li><a href="childrenshealth.html">Sports & Work Physicals</a></li> <li><a href="specialneedschildren.html">Children with Special Needs</a></li> <li><a href="communicabledisease.html">Communicable Disease</a></li> <li><a href="familyplanningclinic.html">Family Planning</a></li> <li><a href="helpmegrow.html">Help Me Grow</a></li> <li><a href="HIVAIDS.html">HIV/AIDS Testing</a></li> <li><a href="homehealthcare.html">Home Health Care</a></li> <li><a href="immunizationfaqs.html">Immunization/Shots</a></li> <li><a href="leadscreeningandtesting.html">Lead Screening & Testing</a></li> <li><a href="prenatalclinic.html">Pregnancy Testing & Assistance</a></li> <li><a href="schoolnursing.html">School Nursing</a></li> <li><a href="seniorclinic.html">Senior Clinic</a></li> <li><a href="specialtyclinics.html">Outreach Clinics</a></li> <li><a href="HIVAIDS.html">STD Clinic</a></li> <li><a href="tbtesting.html">TB Testing</a></li> </ul><div class="menu_head"> <p>Public Health Preparedness</p> </div><ul class="menu_body"> <li><a href="publichealth.html">General Information</a></li> <li><a href="medicalreservecorps.html">Medical Reserve Corps</a></li> </ul><div class="menu_head"> <p>WIC</p> </div><ul class="menu_body"> <li><a href="wic.html">WIC Services</a></li> <li><a href="http://www.odh.ohio.gov/odhPrograms/ns/wicn/wic1.aspx" target="_blank">Learn More About WIC</a></li> </ul> </div> I want to open a new tab "http://www.example.com/" when the user presses a key. How can this be done?
Hi, I need to open a PDF file via a web page. Basically, I want to have a textbox where I type in a filename and then click submit and it will open that document. For example, I need to open a PDF document... I need to have a text box where I can input "test1" for example, click "GO" and it will add the "C:/test/" + textbox value + ".pdf" and open it in the browser. I could do it in PHP but this is going to run on a local machine with no serverside so I assume JS will be the way forward. Any ideas? Many Thanks MJFCAD is there a way in HTML or Javascript to open a new window and force it to be a new Window, not a new tab? and also avoid popup blockers??
You can see the website here with all the code to make it easier for you to diagnose what is happening: Code: http://www.fdfdaa.com/desktop/desktop.html When you go to the start menu and select anything on the left side, you will see that windows open 100% of the screen by default. I did that by adding maximized:true but that doesn't appear to be working for the icons on the desktop itself. If you click on one of those 4 icons on the desktop though, it isn't opening at 100% for some reason. You can see my classes file here as well: Code: http://www.fdfdaa.com/desktop/classes.js Any help will be greatly appreciated. Thank you for your time! Hello, I need your help, I have the following code below, and its giving me an error saying: "The system cannot find the file specified". Code: <html> <script language="javascript" type="text/javascript"> function start_ccm(){ var wsh = new ActiveXObject('WScript.Shell'); wsh.exec("C:\Program Files\WorkDynamics Technologies\ccmApplications\ccmMercury.exe") } </script> </head> <body> <input id="Button1" onclick="start_ccm()" type="button" value="START" /> </body> </html> There is nothing wrong with the location, but my best guess are the spaces in the file path. Any help with this is greatly appreciated. Cheers, J Hi, I am having some problems with this modified version of Lightbox. I had a programmer implement this into the site and then one day it just stopped working. I'm trying to fix it myself, with no success. To view the problem go to: http://www.uscgq.com/question/deck/2 and click the red flag icon. The lightbox opens, but only shows the "Loading" message. I have isolated the problem to somewhere in the Lightbox.js just don't know where or what it is. Any help is greatly appreciated! Code: /* Created By: Chris Campbell Website: http://particletree.com Date: 2/1/2006 Inspired by the lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ */ /*-------------------------------GLOBAL VARIABLES------------------------------------*/ var detect = navigator.userAgent.toLowerCase(); var OS,browser,version,total,thestring; /*-----------------------------------------------------------------------------------------------*/ //Browser detect script origionally created by Peter Paul Koch at http://www.quirksmode.org/ function getBrowserInfo() { if (checkIt('konqueror')) { browser = "Konqueror"; OS = "Linux"; } else if (checkIt('safari')) browser = "Safari" else if (checkIt('omniweb')) browser = "OmniWeb" else if (checkIt('opera')) browser = "Opera" else if (checkIt('webtv')) browser = "WebTV"; else if (checkIt('icab')) browser = "iCab" else if (checkIt('msie')) browser = "Internet Explorer" else if (!checkIt('compatible')) { browser = "Netscape Navigator" version = detect.charAt(8); } else browser = "An unknown browser"; if (!version) version = detect.charAt(place + thestring.length); if (!OS) { if (checkIt('linux')) OS = "Linux"; else if (checkIt('x11')) OS = "Unix"; else if (checkIt('mac')) OS = "Mac" else if (checkIt('win')) OS = "Windows" else OS = "an unknown operating system"; } } function checkIt(string) { place = detect.indexOf(string) + 1; thestring = string; return place; } /*-----------------------------------------------------------------------------------------------*/ Event.observe(window, 'load', initialize, false); Event.observe(window, 'load', getBrowserInfo, false); Event.observe(window, 'unload', Event.unloadCache, false); var lightbox = Class.create(); lightbox.prototype = { yPos : 0, xPos : 0, initialize: function(ctrl) { this.content = ctrl.href; Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false); ctrl.onclick = function(){return false;}; }, // Turn everything on - mainly the IE fixes activate: function(){ if (browser == 'Internet Explorer'){ this.getScroll(); this.prepareIE('100%', 'hidden'); this.setScroll(0,0); this.hideSelects('hidden'); } this.displayLightbox("block"); }, // Ie requires height to 100% and overflow hidden or else you can scroll down past the lightbox prepareIE: function(height, overflow){ bod = document.getElementsByTagName('body')[0]; bod.style.height = height; bod.style.overflow = overflow; htm = document.getElementsByTagName('html')[0]; htm.style.height = height; htm.style.overflow = overflow; }, // In IE, select elements hover on top of the lightbox hideSelects: function(visibility){ selects = document.getElementsByTagName('select'); for(i = 0; i < selects.length; i++) { selects[i].style.visibility = visibility; } }, // Taken from lightbox implementation found at http://www.huddletogether.com/projects/lightbox/ getScroll: function(){ if (self.pageYOffset) { this.yPos = self.pageYOffset; } else if (document.documentElement && document.documentElement.scrollTop){ this.yPos = document.documentElement.scrollTop; } else if (document.body) { this.yPos = document.body.scrollTop; } }, setScroll: function(x, y){ window.scrollTo(x, y); }, displayLightbox: function(display){ $('overlay').style.display = display; $('lightbox').style.display = display; if(display != 'none') this.loadInfo(); }, // Begin Ajax request based off of the href of the clicked linked loadInfo: function() { var myAjax = new Ajax.Request( this.content, {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} ); }, // Display Ajax response processInfo: function(response){ console.log('calling process info'); if($('lbHeader')) Element.remove($('lbHeader')); info = "<div id=\"lbHeader\"><a href=\"javascript: closeLightboxes();\">close</a> or hit ESC</div><div id='lbContent'>" + response.responseText + "</div>"; new Insertion.Before($('lbLoadMessage'), info) $('lightbox').className = "done"; this.actions(); }, // Search through new links within the lightbox, and attach click event actions: function(){ lbActions = document.getElementsByClassName('lbAction'); for(i = 0; i < lbActions.length; i++) { Event.observe(lbActions[i], 'click', this[lbActions[i].rel].bindAsEventListener(this), false); lbActions[i].onclick = function(){return false;}; } }, // Example of creating your own functionality once lightbox is initiated insert: function(e){ link = Event.element(e).parentNode; Element.remove($('lbContent')); var myAjax = new Ajax.Request( link.href, {method: 'post', parameters: "", onComplete: this.processInfo.bindAsEventListener(this)} ); }, // Example of creating your own functionality once lightbox is initiated deactivate: function(){ if($('lbHeader')) Element.remove($('lbHeader')); Element.remove($('lbContent')); if (browser == "Internet Explorer"){ this.setScroll(0,this.yPos); this.prepareIE("auto", "auto"); this.hideSelects("visible"); } this.displayLightbox("none"); } } /*-----------------------------------------------------------------------------------------------*/ // Onload, make all links that need to trigger a lightbox active function initialize(){ addLightboxMarkup(); lbox = document.getElementsByClassName('lbOn'); for(i = 0; i < lbox.length; i++) { valid = new lightbox(lbox[i]); } } // Add in markup necessary to make this work. Basically two divs: // Overlay holds the shadow // Lightbox is the centered square that the content is put into. function addLightboxMarkup() { bod = document.getElementsByTagName('body')[0]; overlay = document.createElement('div'); overlay.id = 'overlay'; lb = document.createElement('div'); lb.id = 'lightbox'; lb.className = 'loading'; lb.innerHTML = '<div id="lbLoadMessage">' + '<p>Loading</p>' + '</div>'; bod.appendChild(overlay); bod.appendChild(lb); } // Send AJAX Call function sendForm(url) { new Ajax.Updater('lbContent', url, { method: 'post', parameters: Form.serialize($('content_form'),true) }); } // Function to destroy lightbox elements function closeLightboxes() { if(lightbox.prototype) lightbox.prototype.displayLightbox('none'); if($('lbHeader')) Element.remove($('lbHeader')); if($('lbContent')) Element.remove($('lbContent')); } // Close the lightbox if ESC is pressed document.onkeypress=function(e){ var KeyID = (window.event) ? event.keyCode : e.keyCode; if(KeyID == 27) { closeLightboxes(); } } I am facing problem in IE6.x.x. when opening pdf document for modaldialog. Some security warning appears and the PDF not getting open. Can you suggest how to solve this problem. This happens only in some machine. We checked all the browser settings in the PC.Any suggesstions please? Getting : Security Warning instead of opening PDF. In the warning pop up i can see file name : my URL[The PDF open URL formed in java side with the report name and pasing parameters] File type : Un known file type If i click "open", or "save" or "Cancel" the window is getting closed. I checked the browser setting also. Everything is fine. Please note : This happens only in some machine, not every time.The problem only occurs first time for the user and from next time he is not getting this problem again[Rare case]. All documents are getting opened successfully. Please post me if any body facing this problem and let me know the solutions if any. Thanks in advance. Hello, I am in the midst of designing an HTA application, such that I would be able to open a file via notepad in Javascript using the Shell.Application object. I have the following code, however, It does not work and can't seem to figure the rest out. Code: function test101() { var oShell = new ActiveXObject("Shell.Application") var commandtoRun = 'C:\\WINDOWS\\system32\\notepad.exe "F:\\WEB\\saved items\\A-2010-00455.txt"' oShell.ShellExecute(commandtoRun,"","","open","1"); } Any help with this is greatly appreciated. Thanks in advance. Cheers, Jay |