I am programming a website. On there website the users will be able to click "Add as friend". I am basically wanting it so that when my users click "Add as friend" the link will dis-appear and then it will visit a page on the iframe that I have already coded with a variable (addfriend.php?pid=CODEHERE).
If there is anyone that knows how I can make the code dis-appear using Ajax.
I am pretty new to JS but I've managed to create a function to show and hide a div according to a link's URL, but I am gonna have lots of url's and lots of div's to show and hide, its not a problem to show and hide them, the only trouble is that they stack, if I show div 1, and then press link 2 to show div 2, Div 2 is gonna be below div 1, and what I want is that when I click link 2 to hide div 1 or any other shown divs, I am sure its possible but i don't know how to do it. I think it would be possible by storing the id of the div in a variable, but the only problem is that when I call that function, the variable always changes so it would be a matter of storing the id in a variable outside the function, but i don't know how to do that, or what are the rules?
This is my code: JS function showHide(product) { var el = document.getElementById(product); el.className = (el.className == 'hide') ? '' : 'hide'; }
HTML <div id="1" class="hide">Content of Div 1</div> <div id="2" class="hide">Content of Div 2</div> <a href="javascript:showHide('1');">Show Hide 1</a> <a href="javascript:showHide('2');">Show Hide 1</a>
CSS .hide { display:none; }
I need to have the javascript function call in href because of an applet I am using. In resume, the divs are hidden at the start, when I click one link, the div shows, when I click the other link I need the previous div shown to be hidden (class="hide"), and show the new div and so on.
I need a javascript code that allows me to hide a link at a certain time and show the link again at a certain time. my project requirement is that i need to be able to hide the link at a certain period of time to restrict users from acessing it.only from 12pm to 2pm the link will be display, users are able to click the link. after and before that timing, the link will not be displayed[hide] or the when click on the link error message will be shown.
I am having trouble trying to hide a link and a div when I click on a link. Here is what I tried to do first.
I have two links and one div box. When I click the first link I want to show the div box and another link (hide) then at the same time I want to hide the link that I clicked.
If it is not possible to do with link (<a> tags) can I achieve this with an image? Lets say I just change the image onclick and show a div box and then click the same (now changed image) and hide the box.
I have a link, and a onClick event, which calls jscript function.
Everything is okay, but how can i for example hide that link on click ?
I mean, i can do onClick = "this.hide()" or link.observe('click', function() { ... I can acomplish it this way, but can i do it with a function ?
Because, on click,a function does ajax reuqests, and i want that function to hide the link, not with inline code, or with some observe actions..and after that request, i want to hide the link.
I know you can do an onmouseover/onmouseout to display alternate text for links but Im looking for a script that would cover all links on a page without having to add code to each link.
Is there such a thing?
I also know lots of people hate it when you do that but this is for an application which requires IE5.5+ and there is no need for the user to view the links.
I have a menu, on which is a delete link. The URL of the link is quite plain: <a href="http://mysite.com?delete=true&id=123">http://mysite.com?delete=true&id=123</a> (quite obvious I think that the request is to delete the id=123) I wish to hide the destination URL in the browser from the user - so that it shows a harmless url like: <a href="http://mysite.com?#">http://mysite.com?#</a> or similar. The reasons are more aesthetic than anything else. Also the other advantage is once the user clicks on the link, and then hits on refresh, the request gets posted again and because the id=123 has already been deleted, it will just generate an error. I dont mind using ajax for this - ajax and non-ajax.<br clear="all">
Basically what I'm looking to do is at first, I want to hide the previous link until next is clicked. When next is clicked the first href will change to #2 and the 2nd will change to #3. If then #2 is clicked it'll go back to the first step, if #3 is clicked it'll move on to... #2 changes to #3 and #3 changes to #4, repeat above process. #3 changes to #4 and #4 from the last frame is now hidden. Is this possible with javascript?
just wondering, anybody has script/tutorial that does the show link after 45 seconds like rapidshare? There's a counter and after 45 seconds it displays the link.
I have multiple divs called article which have a show/hide link to toggle a div inside called articleBody. Problem is when I click the link all divs show/hide. The html structure is below:
<div class="article"> <p class="show"><a href="#">Hide [-]</a></p> <div class="articleBody"><!-- Stuff i need to hide on click</div> </div>
how I can toggle the text to say show/hide as well as just closing that one instance of div article rather than every instance on the page?
I have 11 elements with long description of each element of them. I decided to display the elements on the sidebar and the description of each one of them will be displayed on the body directly when the user clicks on the element.but the problem with this one is put the content (or description) inside the javascript code, and I want the description be on the HTML code to make it later on flexible for changes by the admin after putting the data including the description of these elements on the database instead of hard-coded style.
I'm hiding the email address on a website with this javascript which works fine: --------------------------------- <p>Send your comments and questions to our <script language=javascript> <!-- var contact = "Newsletter Editor" var email = "news" var emailHost = "netmechanic.com" document.write("<a href=" + "mail" + "to:" + email + "@" + emailHost+">" + contact + "</a>" + ".") //--> </script> </p> --------------------------------- How can I make an image instead of the text as a link to start thisscript?
I have a table that contains information that is hidden within a 'td' element. Users can access this information if they wish by clicking on a link that is held in another 'td' element on the previous row (table structure below):
There are various widgets and plugins that show link preview via tooltip or iframe,So as I am trying to continuously improve web sites experience with new trends and web functionalities - thus it come the task for uniform link preview via div and iframe.
I'm basically trying to make it so a link click will hide and display a series of DIVs to make my site look a bit neater and more professional. The code I have WORKS, it can make a DIV appear and disappear easily enough but the issue I'm having is that it only works if you click the same link to show nad hide. Click a link to show a DIV then click another link and both will be visible.
But the only other code I tried to hide all but the selected DIV just results in my page becoming invisible (Its constructed with DIVs from top to bottom) so its not a suitable result. I'm basically after this: [URL]. Where you click on the link (in this case an image) and it shows what you need. I did try searching through their HTML and code but their javascript file appears as one long string to me so its hard to find any real useful detail.
This is the code I have at the moment: Code JavaScript: function showHide(shID) { if (document.getElementById(shID)) { if (document.getElementById(shID).style.display != 'block') { document.getElementById(shID).style.display = 'block'; }else { document.getElementById(shID).style.display = 'none'; }}}
And this is my current page in practice. [URL]. I'm assuming I might need an array but I need to stop it picking on every DIV and only the DIVs in my content area.
I have a html link like , <a href=""> Show More..</a>.On click of Show more, the text of link should be change and it should show Show less as text and hide the previous text i.e Show more.
I found code online to avoid the insecure mailto:email@email.com function, but what I am looking for is, instead of text link I want an image link.So, where it says Click here to email, or any other text, I want that to be my image file, which will be placed in a DIV.
I have a large set of input fields (of checkboxes and radio buttons), and aside each set, is a clear button (just looks like text you can click on) that clears any input next to each of the input fields. When no input buttons are selected, the HTML entities that depend on them are supposed to disappear, and this works on load.
My question is how does one easily incorporate that clear button so that it tells the listeners already in action to clear those entities when they click on clear, and without having to manually do it over again with the clear button, if that makes any sense.
I'm not allowed to post a link yet since I'm a newbie. But the page is here: tinyurl dot com /m8ajyp
This page (and others on the site) use javascript to show/hide some divs in order to have a tab-like interface.
Is there any way to link to this page with the "Past Events" div showing as the default? Right now you can see that "Coming Events" shows on page load. And that's the way we want it most of the time.
But there are places in the site where I'd like to link specifically to this page with the "Past Events" div showing on page load.code...
I need to show/hide certains divs when a link is clicked.These are my divs:
div1 div2 div3 div4 div5
I will have several links. Depending on which link is clicked it will hide/show several divs simultaneously For example, if link1 is clicked it will hide div1, div2 and div3 and show div4 and div5.
I am trying to create a Link that changes its currently displayed text and also toggles the css.display property from inline to hidden. I'm sure there are solution outs there btu I have not been able to find one that does both functions with one click properly and is also easy to implement for people not as familiar with html and javascript. Obviously I am trying to create a show more, show less type link. currently this often shared code works fine to change the current state of the target ID's css.display from none to inline. My end goal is to be able to not only toggle the display of the LONG1 div but to also change the innerhtml of 'short1' from "Show More" to "Show Less".I am still learning about JS so Im really rough around the edges. I tried some different techniques btu I dont ahev them posted on my work pc.