JavaScript - Opening A Link In The Same Browser??
ok so here what i want to do (im a noob):
i want a dropdown menu i want a button (go) i want ten different items in the dropdown menu if i choose the first item and click go i want a new page to open in the same window if i choose the second item and click go i want to a different page to open in the same window and so on all ten items lead to a different link when i click go....how do i do this?? thanks!! Similar Tutorialssay i have this url in my hand as a string, stored in a variable: http://img.youtube.com/vi/wgGh9RmO5vA/default.jpg i can copy and paste it to my browser manually and see a thumbnail. but how can i automatically open up a browser window and i see the thumbnail? without manually copying and pasting, i want to automaticallly open a broswer window with this string Hi, I asked this in php first, but they directed me to javascript forum... I have a variable that I obtain from a php code. This variable contains a link such as http://....... with this variable, say $a, once I obtain it with that php code, I want a browser window to open automatically. I dont know javascript. can you give complete code to do this? I am new to javascript and am trying to make a script that would open a link every xx randomly seconds. So far I have come up with this after searching: Code: <script> function reloadMe() { window.location.reload(); } function getInterval(){ var lowerBound = 30; var upperBound = 60; var randNum = Math.floor((upperBound-lowerBound+1)*Math.random()+lowerBound) * 1000; return randNum; } var interval = getInterval(); var srcInterval = setInterval("reloadMe()",interval); </script> This works on refreashing a page every xx seconds between 30 and 60 seconds. But it does not open a link. Is it possible to make a script that opens a link every xx seconds at random. It would be even greater if it can exclude certian times of the day, or can that be done with a cron job? Hi there, Ive been asked to find out something in work and I hope someone can help me with this. I am looking to put a search box within a website. Users in work will be searching by 1 of 50 keywords, and each of these key words relates to a different web page that I want the search to open. For Example, typing 'one' in search bar opens link 'one.htm', typing 'two' in search bar opens link 'two.htm' and so on. Ideally it would be great if the seach bar will autocomplete text as well, but anything will be of great help to me!! Is it possible to get a code to do this? As Im a relative newbie, any help you can provide will be greatly appreciated. Many Thanks Glen Hi there Im a relative newbie and am trying to have a searchbar that users can complete, with the text entry being from a pre-defined list. The hope is that a new page will open with the link that relates to the search bar entry. Im using an Autocomplete code but cant work out how to get the link part to work. See below code Code: <html> <head> <script src="jquery-latest.js"></script> <link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css" type="text/css" /> <link rel="stylesheet" href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css" type="text/css" /> <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script> <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script> <script type="text/javascript" src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script> <script> $(document).ready(function(){ var data = "092 610 343 505 Utilities".split(" "); $("#example").autocomplete(data); }); var data = [ {text:'Link A', url:'/page2'}, {text:'Link B', url: '/page2'} ]; $("...").autocomplete(data, { formatItem: function(item) { return item.text; } }).result(function(event, item) { location.href = item.url; }); </script> </head> <body> Number: <input id="example" /><p></p> </body> </html> Can someone help me complete this code? For example, how can I change the code so that a text entry of "092" opens "www.google.com" when I hit enter after text entry? Your help with this is greatly appreciated Glen 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 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 Greetings, I am currently using the websites tutorial about browser detection using the navigator. http://www.javascriptkit.com/javatutors/navigator.shtml I am however finding myself unable to detect a pattern in order to learn from. My aim is to use Browser detection to have a CSS file for each browser type, such as Firefox, IE, Opera, Safari and then an overall CSS file if none of the above, to fix numerous flaws. For IE and Firefox using the site's code is all well and good and while I haven't tested it yet I'm wondering how to set up the coding so that it can detect a safari browser. There are lots of slashes and d's and brackets and I do find myself unable to understand their purpose. So if someone can explain how I could do it for Safari I would be very appreciative. I need a script that will redirect to a specific page is the browser is safari version 4. if the browser is NOT safari 4 I want the browser to stay on the current page.
Hello, I have a question what is the best way to identify a browser, browser version and OS in javascript. I have try a few scripts but they all fail. This will help me out formating the code for diferent browsers. Thanks I want to open a new tab "http://www.example.com/" when the user presses a key. How can this be done?
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> 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! 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??
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> I am trying to write a javascript to open multiple websites in the same window for Internet Explorer. However I keep getting the website opening in a new window. Here is my code. Code: var url = [ "http://www.google.com", "http://www.yahoo.com", "http://www.msn.com" ]; var interval = 3000; var startTime = 0; for (i = 0; i < url.length; i++) { startTime = startTime + interval; setTimeout("openWindow("+i+")", startTime); } function openWindow(num) { window.open(url[num],'mywindow','width=800,height=600,menubar=yes,status=yes,location=yes,toolbar=yes,scrollbars=yes'); } So currently, this code behaves like this. Every 3 seconds, it opens up a new website. However this code I wrote opens google.com in a new window, then yahoo.com in a new window and so on. I want it to open all the websites in the same window. How do I achieve this? Hi there all, Trying to adapt a bit of Code, but failing wonderfully! I'm writing in Cold Fusion, but using a little java script to create the sliding effect. It's from a sliding open list function in another site, and I tried to just hack my current needs in there. Code: <script> function DC_ShowHideMoreWebsites(id) { if( document.getElementById( "contentsections2").style.display=="none" ) { Effect.BlindDown( "contentsections2"); return false; } else { Effect.SlideUp( "contentsections2" ); return false; } } </script> is followed by Code: <p id="moreScreenshots"><a href="#" onclick="DC_ShowHideMoreWebsites"; return false;">More Website Examples</a></p> I've tested the script, div and the DB call by just calling it with Code: <p id="moreScreenshots"><a href="#" onclick="Effect.BlindDown('contentsections2'); return false;">More Website Examples</a></p> And that works fine. I've never coded in Java, hence the problem! any help appreciated Hey Guys, I feel like a complete idiot posting this, but I clearly am missing something. I'm trying to open a window with the specs below but all it does is open a standard sized window. Any help would be greatly appreciated. Code: <SCRIPT LANGUAGE="javascript"> function open_window() { window.open ('https://domain.com/document.php','newwindow',config='height=418,width=590,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no') } </SCRIPT> <p><a onclick="open_window()"><img src="images/image.png" width="142" height="113" /></a></p> Guys, this is a script which runs on a Mac not a browser. I have created a script which transfers data from an Excel CSV file into an In-Design document and formats it, I am now just trying to take out some of the options for human error. I need the script to Open the Excel file which has been selected by dialog box and then save it to the desktop as a csv file. I thought this bit would be simple, but I cannot get the file to even open. Help please, Nick |