JavaScript - 2 Actions From One Link
Hi all,
Trying to something i guess is pretty basic but i cant seem to get it working. I have a page with an iframe name="grid" and on that page i am also running a mootools script which toggles a pannel. The javascript for the pannel is: Code: <script type="text/javascript"> window.addEvent('domready', function(){ var mySlide = new Fx.Slide('top-panel'); $('toggle').addEvent('click', function(e){ e = new Event(e); mySlide.toggle(); e.stop(); }); }); </script> so this link opens the pannel Code: <a href="#" id="toggle">Show Panel</a> However, i want to make a it so that one link can both call a page in the iframe AND toggle the pannel. I tried: Code: <a href="page_to_call.htm" target="grid" id="toggle">Show panel and call page in iframe</a> but no joy. I want more than one link to be able to do this (calling different pages to the iframe and each one toggling the pannel) Can anyone help? Thanks loads in advance for any reply. Similar TutorialsI have a javascript code to let people subscribe to our newsletter. I would like to get a mail each time a person get subscribed to our newsletter. The code to let people subscribed to our newsletter is: [I] <!-- newsletter subscribe below here --> <script language="Javascript" type="text/javascript"> var fieldstocheck = new Array(); fieldnames = new Array(); function checkform() { for (i=0;i<fieldstocheck.length;i++) { if (eval("document.subscribeform.elements['"+fieldstocheck[i]+"'].value") == "") { alert("Please enter your "+fieldnames[i]); eval("document.subscribeform.elements['"+fieldstocheck+"'].focus()"); return false; } } return true; } function addFieldToCheck(value,name) { fieldstocheck[fieldstocheck.length] = value; fieldnames[fieldnames.length] = name; } </script> <form action="http://www.investinginmongolia.com/phplist/?p=subscribe&id=2" method="post" name="subscribeform"> <p class="linkleft12">Our Newsletter:</p> <p class="linkleft12">Email: <input name="email" style="width: 105px" type="text" value="" /> <script language="Javascript" type="text/javascript">addFieldToCheck("email","Email Address");</script> <input name="list[2]" type="hidden" value="signup" /></p> <p class="linkleft12"> <input name="subscribe" onclick="return checkform();" type="submit" value="Subscribe" /></p> </form> <!-- newsletter subscribe ends here --> I also would like that an e-mail is send automatically to info@yurt-ger-yourte.com through http://www.yurt-ger-yourte.com/cgi-sys/FormMail.cgi Thanks for your help. Bernard Hello: I am a newbie to learning Javascript. I have some problems with a file. The goal of the file is that when it loads in a browser, the 1st image is displayed in the top left (image 7441805.gif), along with the following three titles to the right of the image, as listed below: Java Demystified OOP Demystified Data Structures Demystified When you place the mouse over "Java Demystified," the 7441805.gif image should still appear (which it does)), and a new window should pop-up and stay on the screen displaying "10% Discount for Java Demystified" until the user decides to do away with the new window by clicking on the "X". The new window does appear for about less than a second , and then goes away (actually it continuously flashes on and off very quickly), which is not what I want. When you place the mouse over "OOP Demystified," the 0072253630.jpg image should appear (which it does), and a new window should pop-up and stay on the screen displaying "20% Discount for OOP Demystified" until the user decides to do away with the new window by clicking on the "X". The new window does appear for about less than a second , and then goes away (actually it continuously flashes on and off very quickly), which is not what I want. When you place the mouse over "Data Structures Demystified," the 7417436.gif image should appear (which it does), and a new window should pop-up and stay on the screen displaying "15% Discount for Data Structures Demystified" until the user decides to do away with the new window by clicking on the "X". The new window does appear for about less than a second , and then goes away (actually it continuously flashes on and off very quickly), which is not what I want. All of the files are loaded on my laptop, which is using Vista, is 32bit, has the IE9 browser installed, and pop-ups are disabled. When I try to use Mozilla (version 6.0), I am unable to disable the pop-ups, and therefore can not even get any new windows to open. I would appreciate your help. The html file is below: [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" lang="en" xml:lang="en"> <head> <title>Open Window</title> <meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" /> <meta http-equiv="Content-Language" content="en-us" /> <meta name="description" content="XYZ" /> <meta name="keywords" content="XYZ" /> <!-- the absolute pathname of this file is: --> <!-- C:\MISCSUP2_10_17_8\MISCSUP2\Javascript_Demystified_Download_Working\ --> <!-- Ch_12_Page241.html --> <!-- this file was created on Wednesday, 8/24/11: --> <!-- this file was updated on Wednesday, 8/24/11: --> <script language="Javascript" type="text/javascript"> <!-- function OpenNewWindow(book) { if (book== 1) { document.cover.src='7441805.gif' MyWindow = window.open('', 'myAdWin', 'titlebar="0" status="0", toolbar="0", location="0", menubar="0", directories="0", resizable="0", height="50", width="150",left="500",top="400"') MyWindow.document.write('10% Discount for Java Demystified!') } if (book== 2) { document.cover.src='0072253630.jpg' MyWindow = window.open('', 'myAdWin', 'titlebar="0" status="0", toolbar="0", location="0", menubar="0", directories="0", resizable="0", height="50", width="150",left="500",top="500"') MyWindow.document.write('20% Discount for OOP Demystified!') } if (book== 3) { document.cover.src='7417436.gif' MyWindow = window.open('', 'myAdWin', 'titlebar="0" status="0", toolbar="0", location="0", menubar="0", directories="0", resizable="0", height="50", width="150",left="500",top="600"') MyWindow.document.write("15% Discount for Data Structures Demystified!") } } --> </script> </head> <body> <table width="100%" border="0"> <tbody> <tr valign="top"> <td width="50"> <a> <img height="92" src="7441805.gif" width="70" border="0" name="cover"> </a> </td> <td> <img height="1" src="" width="10"> </td> <td> <a onmouseover="OpenNewWindow(1)" onmouseout="MyWindow.close()"> <b><u>Java Demystified </u></b> </a> <br> <a onmouseover="OpenNewWindow(2)" onmouseout="MyWindow.close()"> <b><u>OOP Demystified</u></b> </a> <br> <a onmouseover="OpenNewWindow(3)" onmouseout="MyWindow.close()"> <b><u>Data Structures Demystified</u></b> </a> </td> </tr> </tbody> </table> </body> </html>[ICODE] Hey All, I have the following function - where I can get one of the conditions to work, but not both together. Here's the code: Code: function test_function() { $('#form_field_name').focus(); window.location = window.location + "#form_field_name"; } Basically when clicking an error link, I want to focus onto the form field, and then move to the anchor itself on the page. One of these will work at a time, but not both and I'm not sure why. Any suggestions would be appreciated. Thanks. Hi there! I've been searching for threads to solve my problem but I don't have the knowledge necessary to figure it out (you know, graphic designers....) so your help will be very appreciated!!! Here's the problem : I have a div named "cat" that I want to hide with a Javascript:animatedcollapse (slideup) action. The action is linked externally on another page. This is the line/link that hides it : <a href="javascript:animatedcollapse.hide('cat')">Hide the div<br/> It works fine. But, I want this action to happen at the same time that you press another link (that other link opens a page in an iframe). This is the iframe link : <p><a href="page.html" target="iframe">Open link in iframe</a></p> Both links work fine. But i want to merge the two together. How? Thanks in advance! Here's my object constuctor: Code: function suggest_object(result_id) { this.in_result_div = false; this.search_element = document.getElementById(result_id); } And the execution code: Code: var suggest = new suggest_object(result_id); document.getElementById(result_id).onmouseover = function(){suggest.in_result_div = true;} It works as is, but i'd really like to be able to set the onmouseover inside of the object. Something like Code: function suggest_object(result_id) { this.in_result_div = false; this.search_element = document.getElementById(result_id); this.input_element.onmouseover = function() { this.in_result_div = true; } } So how can I get the 'this' inside the onmouseover function to refer to the object? I am very new to javascript and cannot find any info anywhere regarding the following problem: On my website I have around 100 pages containing an action form. Occasionally it is necessary to cancel the action throughout the 100 pages which is very time-consuming. Then the action has to be reinstated once again for all the 100+ pages. I thought the solution would be to use javascript to change the action from a .js file which would mean only one page, the .js file, would require alteration: The action that appears on all 100+ pages several times that I am trying to change or stop happening by overwriting the "form action": <form action="http://www.changenamecart.com/" method="post"> <input type="hidden" name="userid" value="1234567"> <input type="hidden" name="return" value="http://www.thehomepage.co.uk/index.htm"> <input type="image" src="http://www.changenamecart.com/images/pic.gif"> </form> My efforts to date a The change .js file: function change() { var myChange = form action; if(myChange == form action){ document.write("form xction"); } } The html file in the header: <script src="change.js" type="text/javascript"></script> I am afraid that my knowledge of programming is very small and I would welcome any help to solve this problem. Hello, I am using this code Code: <form style="display: none;" name="num1form" id="num1form" action=""> <input type="image" name="1" id="num1" value="1" src="imgl/img_first_01.png" onclick="document.forms[0].action='javascript:ChangeNum1();'"/> </form> What the above code does is change the action state, it allows me to have multiple image inputs which is great as I can define various inputs with different IDs. However, this is used for one section of the page I happen to have another <form> with basically the same code but it's using num2 values, I'm not sure why but I can only using one of these Code: onclick="document.forms[0].action='javascript:ChangeNum1();'" at a time, for one form only. Is there anyone able to help me divide this, or make these onClick actions unique so they can be used in more than 1 form? Thanks, Keenan I'm working on a technical document that has a glossary section. When I use a technical term, I link to its definition in the glossary then provide a return link to return the user to whence they came. But if I use that same term again, and if I want to link it to the glossary, I need to duplicate the glossary entry in order to provide a return link that returns them to the right place. Is there some way I could link them to the glossary and embed a unique return link in the link to the glossary?
I've been using this slidehsow but each time I click on a link (Newsflash) it goes to yahoo.com, even though each link goes to a different website, it looks like the last link of the last slidehsow is the one which controls all the slidehsow links link of slidshow as you can see from the code each link for each slidehsow should go to a diffrent website. Code: <div class="lof-main-outer"> <ul class="lof-main-wapper"> <li> <img src="images/791902news3.jpg" title="Newsflash 2" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 2" href="http://www.google.com">Newsflash 2</a></h3> <p>The one thing about a Web site, it always changes! Joomla! makes it easy to add Articles, content,...</p> </div> </li> <li> <img src="images/435576news10.jpg" title="Newsflash 1" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 1" href="http://www.gmx.com">Newsflash 1</a></h3> <p>Joomla! makes it easy to launch a Web site of any kind. Whether you want a brochure site or you are...</p> </div> </li> <li> <img src="images/641906img1.jpg" title="Newsflash 3" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 3" href="www.godaddy.com">Newsflash 3</a></h3> <p>With a library of thousands of free Extensions, you can add what you need as your site grows. Don't...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.flickr.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.intel.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> <li> <img src="images/416719news7.jpg" title="Newsflash 5" height="300" width="900"> <div class="lof-main-item-desc"> <h3><a target="_parent" title="Newsflash 5" href="http://www.yahoo.com">Newsflash 5</a></h3> <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web...</p> </div> </li> </ul> </div> I know you may think... why is he doing this? There is a reason, this is just the simplified version. Code: <a href="URL TO COPY" id="COPYME">Next</a> <a href="COPIED URL HERE VIA JAVASCRIPT" >Next</a> Hi, I have a flash code, I need to add alink in this code, but I don't know how I can. This is the link I want to add " www.baligim.com" Thanks. Code: Code: <div id="wb_Flash1" style="margin:0;padding:0;position:absolute;width:300px;height:60px;text-align:left;z-index:0;"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" <param name="movie" value="http://www.baligim.com/download/reklam-banner.swf"> <embed src="http://www.baligim.com/download/reklam-banner.swf" width="300" height="60"> </embed> </object></div> . Hello and good morning... I am a locking for a script, so i can open this: <div class="topprofile"><a href="index.php?side=editprofile#editpw">Edit password</div> After i have push in this, "topprofile" button, i want to have link like this: http://localhost/index.php?side=editprofile#editpw Can you plaese help me with this one? How can I let link page open using IE? for example, I open a webpage using firefox or chrome/opera/safari. when I click the link, open the link using IE <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head2" runat="server"> </head> <body> <a href="#" onClick="window.showModalDialog ('http://www.google.ca','','width=600,height=600','screenx=200','screeny=200')"><img src="images/benemanc-01th.jpg" alt="img-01" width="125" height="155" class="thumb" style="display:inline"></a> </body> </html> Many thanks T Hello! I wan't to know what is the best way for hitting a given URL whit javascript. I just need that that page hitted know that it was hitted. Tanks! I have the following codes and it seems to work well but when exiting the site and re-entering it resets the values to 0 again. I am not sure how to proceed with this, been considering cookies but what if the user clears there cookies, I then looked at PHP but not understanding that to well at this stage. Javascript Code: // Function to count clicks on links var clicks1 = 0; var clicks2 = 0; var clicks3 = 0; var clicks4 = 0; function link1(){ document.getElementById('clicked1').value = ++clicks1; } function link2(){ document.getElementById('clicked2').value = ++clicks2; } function link3(){ document.getElementById('clicked3').value = ++clicks3; } function link4(){ document.getElementById('clicked4').value = ++clicks4; } HTML Code: Code: <tr valign="middle" align="center"><td colspan="1"><a target="_blank" href="http://mistiquestormelectronics.webs.com/" onclick="link1()"><img src="site_graphics/reinet.jpg" alt="Mistique Storm" width="120" height="90" /></a></td> <td colspan="2" align="left"><p>For all your Electronic equipment needs.</p></td> <td colspan="1" width="8%"><input id="clicked1" style="color: #000000; font-weight:bold; border-style: none; font-family: arial; background-color: #00FF00; text-align: center;" readonly="readonly" size="10" onfocus="this.blur();" value="0" ></td></tr> Any ideas, suggestions. Please Help? I once bought some plans on the net and was sent a link that said I could open so many times or for 1 week, I cant remember exactly. But now I am doing a web site and need a link like that any ideas. I would prefer it to open only so many times.
Hello, im a noob when it comes to this. But what Im trying to do is this. I have a members site im trying to start up, I can get my D link, server cam to inbed on the page but it requires a admin/ pw log in. Is there a way I can have a page to auto authenticate the camera so the viewers dont have to log onto the camera, the most obvious reason is that i dont want to give out the cameras admin log in info. Thanks in advance. Hi all, I am new to this forum so hope this is the right place to post my question. I'm learning how to create JavaScript menus and using online generators and tutorials, I was able to get the following working. What I can't figure out, is how I can add link to the items. For example, I want to be able to click on the sub-menu and it takes me to test.html Would someone please help me please? Thanks in advance. Edit - Code removed |