OnClick="function Value Of The Anchor Tag Just Clicked?

Oct 23, 2010

onClick="function(' whats the value of the anchor tag just clicked? Title basically says it. I need to get the object that was just clicked, to insert into a JavaScript function. I've tried "function('this')" and similar things, but it doesn't work. I'm sure this is REALLY easy to do, but I don't know it and I have no idea what to search for.

View 1 Replies


ADVERTISEMENT

OnClick="function - Whats The Value Of The Anchor Tag Just Clicked

Oct 23, 2010

I need to get the object that was just clicked, to insert into a JavaScript function. I've tried "function('this')" and similar things, but it doesn't work.

View 3 Replies View Related

JQuery :: Reload Page With Anchor When Anchor Link Is Clicked?

May 26, 2011

I need to get the page to reload with the anchor in the link when it is clicked in a dropdown menu. For example if I am on 'www.domain.com/about/#2' and I then click on 'www.domain.com/about/#3' the url changes but the page doesn't reload so I need the page to reload, but keep the new anchor (#3).I gave the links with anchors a class of 'reload' and tried this:

$('a.reload').click(function() {
window.location.reload();
});

View 4 Replies View Related

JQuery :: Getting Attributes From Clicked Anchor?

May 7, 2010

oing through my learning curve now. If I have my html (being generated by a PHP MySQL call) set up as such:

<a href="javascript:void(0);" class="clickable" opendesc="<?php print $thisid; ?>"><?php print $appname; ?></a>

so where opendesc will equal 1, 2, 3, 4...how can I pass this to jquery?I tried this:

$(document).ready(function(){
$("a.clickable").click(
function(){

[code]....

View 3 Replies View Related

Get To Know Which Anchor Link Being Clicked Using Script?

Oct 2, 2009

Sorry I am new to JavaScript.

Says that a.html has two same anchor links (<a href="b.html">b</a>). The anchor links are uneditable but we could add JavaScript to the a.html.

Except for dynamic adding onclick event, any other ways could get to know which anchor link being clicked?

View 1 Replies View Related

JQuery :: Hiding List When Another Anchor Is Clicked?

Feb 16, 2011

This is my FIRST attempt at using Jquery to make a site menu for a client, and I'm pretty new to Javascript as a whole..I have a two column horizontal menu, and when an anchor on the left column is clicked it brings up a list in the right column..how do I hide list in the left column when a different anchor is clicked, bringing the new list to the top of the column?

<style type="text/css">
ul.nobulletnoindent {
list-style-type: none;

[code]....

View 2 Replies View Related

JQuery :: Anchor Links - Toggle Need To Clicked Twice

Feb 25, 2011

I basically have many anchor links where when I click each of them it slidesdown its own div with some text in it. So have I wanted is when I click on one link it will show me the current one and hide the others. This is what I have tried which works great but when I click on a link it opens the div, then click on another one opens the div with one click and when I go back to re-click the previous link I have to double click it in order to work..

This is my js code:
$(".anchorlink").toggle(
function() {
var cont_val = $(this).attr("id");
$("div#unique_anchor_text", this).show();
$("div#unique_anchor_text").hide();
$('.unique_anchor_text'+cont_val).slideDown("fast");
},
function() {
var cont_val = $(this).attr("id");
$('.unique_anchor_text'+cont_val).hide();
});

HTML looks like:
<a class='anchorlink' id='$item'>Comment</a>
<div id='unique_anchor_text' class='unique_anchor_text$item'>some text</div>

View 3 Replies View Related

Refresh Website After 1 Sec When Anchor Link Clicked

May 25, 2011

I need a script which will refresh the page 1 sec. After the anchor text is clicked
PHP Code:
<a href="#YourAnchor"></a>

View 1 Replies View Related

JQuery :: Perform / Execute So And So, When Anchor Element 'clicked'?

Jul 29, 2010

as you can tell by the following statements, i'm new to jQueryI'm trying to do the following (in plain english) without too much success.. ) when document ready.. 2) find the element with id 'next'.3) pull / take all 'li' elements, and perform so and so, all whilst excluding 'last' element.

$(document).ready(function() {
$('#next').click(function() {
$('li').each(function() { //for each li ..

[code]....

View 4 Replies View Related

HTML - Displaying A Hidden Slider When <Anchor> Is Clicked

Nov 2, 2009

The <a> is a list of menu items that when clicked.... a specific gallery-slider-images should been shown in relation to the galleryId....<div class"gallery" is hidden in CSS> I'd like to use jQuery to complete this task if at all possible, i can't seem to .show() the selected 'gallery' w/o showing them all...........

View 1 Replies View Related

JQuery :: Highlight Content Based On Clicked Anchor From Another Page?

Sep 30, 2011

I recently had a request from a client and I'm not entirely sure this is possible. I'll try to explain it the best I can, as I can't share the development files yet...

We have a page with an image map of the United States. If anyone clicks on a state, it will bring them to a new

page. This new page contains a table that has named anchors on it, each row being a different state.

So, for example, if someone clicks on South Carolina on the map page, they will be brought here[code]...

The #sc anchor will scroll the new page down to the row in the table about South Carolina.

Is there any way to highlight the table row that the person is looking for? For example, if they click on South Carolina, they will be brought to this new page and the South Carolina row in the table would be highlighted.

View 2 Replies View Related

Way To Have Two Onclick Events Within One Anchor Tag?

Jul 20, 2011

I'm filling in for a coworker on a radio stations website.

The station currently streams live online. I want to add an event tracking so I can track how many people are streaming. I'm really new to js, but I think I figured it out (keyword is "think"). However, there was already an onclick event within the anchor tag. Can I have two in the same tag? Is there a better way to do this?

View 1 Replies View Related

Using An Anchor In OnClick Alert?

Sep 25, 2011

To order a customized product from my site, the user has to upload an image and then submit text (separate steps but part of the same php form) before adding to their cart. Currently, the user must scroll back down from the top of the page to the next part of the form after each step which is more confusing than I would like.

The first step of the form uses a straight forward <form> and I was able to add an action="#anchor" to jump down to where I set the first anchor.

The second step is regrettably not so straight forward and I'm having trouble adding an anchor. After entering text, the user clicks a submit button which triggers an alert letting them know the text was submitted successfully. When the user clicks the okay button on the popup alert, I would like the page to jump down to the 'add to cart' portion.

This is the button:

echo '<tr>
<td valign="bottom" colspan="2" align="center">
<input id="delete_button" class="button" type="submit" value="Attach Text" onclick="return( confirm( this.form ) );" />

[Code]....

How can I prevent the page from returning to the top after the user submits text?

View 5 Replies View Related

JQuery :: Anchor Tag OnClick With A Parameter?

Feb 4, 2011

I am trying to call an ajax function from the onclick event of an anchor tag. Currently I reference the function like this. I would have liked to bind the function to the anchor tag but did not know how to do that when I need to pass in a parameter?

<a href="#" onClick="getCredentialFromId(${link.id})">${link.name}</a>

link.id and link.name are rendered on the serverside so when the page is rendered it looks like this:

<a onclick="getCredentialFromId(35)" href="#">MySQL</a>

my function looks like this:

function getCredentialFromId(cred_id) {
$.post('link.htm?linkCredentials',{cred_id: cred_id},function(response) {
try {

[code]....

View 1 Replies View Related

Why Does Onclick Change The Page Anchor Position

Nov 1, 2010

I have two pieces of Javascript attached to my open/close text boxes.

One for the visibility function:
<script type="text/javascript">
function toggle_visibility(id) {

[Code].....

The problem only shows further down the page, when I click to open a box it automatically goes back to the top of the page instead of staying at the user's current page position

I would like it to stop changing the page position onclick.

View 5 Replies View Related

Can't Save Id Of Dynamically Created Anchor Onclick / Fix It?

Jul 21, 2011

I am trying to save a dynamically created anchor's id onclick, but I am having a lot of trouble. code...

View 2 Replies View Related

Using HREF And ONCLICK In An Anchor Tag Doesnt Seem To Work

Aug 11, 2005

I'm trying to setup a page that uses JavaScript in a text link to submit a form:

<a href="do.htm" onclick="javascript:document.forms.Q01.submit();">

I also have added a fallback page in the href (do.htm) in case users have JavaScript disabled. But the JavaScript doesn't seem to be working. When I click the link it always goes to the fallback page, and doesn't submit the form.

I've tried swaping the order in the anchor tag (JS first, href second):

<a onclick="javascript:document.forms.Q01.submit();" href="do.htm">

and the same thing happens.

If I remove the href value:

<a href="#" onclick="javascript:document.forms.Q01.submit();">

the JS does execute properly.

How can I get the JS to execute by default for browsers that support it, and the href be the backup for browsers that dont support it?

View 1 Replies View Related

Anchor Onclick - Changing InnerHTML Of Enclosing Div?

May 11, 2010

I found a function online that allows me to swap text onclick and have amended it as follows:

Code:
function swapText(obj, n) {
if(obj.oldText){
obj.innerHTML = obj.oldText;
obj.oldText = null;

[Code]...

I have this partially achieved when clicked, any number will indeed "turn into" an h1'd representation of itself but I can't get the other links in the group to disappear when the h1'd number appears (onclick).

View 17 Replies View Related

Onclick Not Working In Anchor Tag To Autofill An Input Box?

Apr 6, 2010

I am trying to autofill a box by clicking a link (with return false). The function to autofill works with button tag but not in anchor tag - instead of returning false, the click event transitions to the href.

Here is the simplified code.

<!DOCTYPE html PUBLIC"-// W3C//DTD Xhtml 1.0 Strict//EN"" http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>

[Code].....

View 1 Replies View Related

Onclick Not Working In Anchor Tag To Autofill An Input Box / Sort It?

Apr 6, 2010

I am trying to autofill a box by clicking a link (with return false). The function to autofill works with button tag but not in anchor tag - instead of returning false, the click event transitions to the href. code...

View 2 Replies View Related

Navigate Anchor Links Using A Button Onclick Event?

Feb 18, 2010

I am wondering if it is possible to navigate anchor links using a button onclick event. I want next and previous hit buttons to navigate the already existing hits (#hit1, #hit2, etc.).For instance, I have:

<script type="text/javascript">
var numHits = {HITS}-1;
function nextHit(){[code]....

I have seen working examples with the href tag (e.g. <a href="#" onclick="func();return false">), but nothing with buttons. I also can't seem to get the working href examples to work on my server.For instance, I cannot get this code to work, it just goes to js_required.html:

<a href="js_required.html" onclick="doSomething(); return false;">go</a>
function doSomething(){
alert("test");
}

View 3 Replies View Related

Adding A Html Anchor To An Onclick Toggle Event?

Sep 16, 2011

Complete newb trying to break apart existing code to add some additional function.

This is the working code:

<a class="hackadelic-sliderButton" title="click to collapse panel" onclick="toggleSliderOfGroup('.a-32', '#hackadelic-sliderPanel-1')" href="javascript:;">Close Panel </a>

What I would like to do is add in an html anchor so that the browser relocates to the top of the page just as the panel toggles closed. ie

<a href="#topofpage"></a>

View 4 Replies View Related

Difference In Calling Javascript In Href And Onclick Of Anchor Tag.

Jan 18, 2006

I am looking for a generic javascript function to identify the form with in which a element exists, thus developer can avoid coding like document.forms[index].submit() - where they are sure, they want the form with in which this element exists is to be submitted. This way when forms are introduced at top level the code can remain unchanged, else every form introduce above in the DOM will result in increasing the index by one.

The code is given below. While doing so i am stuck with 2 problems
P1: In the code, you can see i am giving a explicit 'break' in the code. If i don't do so the code seems to be looping. Obviously i am missing some basic.

P2: I am able to pass 'this' for anchor element by name="xy"
<a href="#" name="xy"

in its onclick function by which, in the javascript function i move up the DOM.

While i am unable to do that on the anchor element given below since this function is now on the href attribute.

<a name="xy1" href="javascript:doFormSubmit(this);">Q test</a>

Hence the script fails. Code:

View 10 Replies View Related

Update OnClick Event After Clicked Once?

Dec 5, 2009

I am trying to update the .onclick event after its been clicked once. Everything works fine in my script except updating the .onclick event. I have searched the web and found that I should do the following:
div.onclick = function(params);
or
div.onclick = new function(){updatedStatement};

I have tested both of these steps in IE and FF with no luck. Here is my code:
function movePhrase(OPT,MENU,ID,DIR,LEVEL){
if(DIR == "up"){
var num = OPT - 1;
}else{
var num = OPT + 1;
} .....
function newOnClcik(opt,menu,id,level,dir){
var string = "movePhrase("+opt+","+menu+","+id+",'"+dir+"',"+level+")";
return string;
}

Below is an example or the div code I am trying to update:
<div id="downImage1">
<img id="down1" src="images/downArrow.JPG" onmouseover="this.src='images/downArrowPressed.JPG'" onclick="movePhrase(1,20,331,'down',1)" onmouseout="this.src='images/downArrow.JPG'" width="40" height="40" />
</div>

View 5 Replies View Related

Second OnClick Not Working - Page With A Div That Is Hidden Until Clicked On

Apr 23, 2010

I have a page with a div that is hidden until clicked on, and can be hidden if clicked on again (at least that is the goal).

The html looks like:

HTML Code:

I currently have the following javascript:

Code:

My goal being to click on the main <div> and show the content in the <span> and change the image, and then clicking again returns it to it's original (hidden) state. I have been able to successfully show the <div> but can't get it to hide again. And when troubleshooting it using Firebug it shows that clicking on the <div> is simply removing the class that hides it, leaving no class, and definately not replacing it like I am trying to do. Any ideas why the second click is not producing ANY results? Also, if I get it working I have thought that by making the entire <div> have the onClick handler if someone tries to click inside the unhidden <span> (for links or to click in a search box) would result in hiding the <span> rather than following the link or focusing on the input box. Is there any possibility for that?

The main reason handled the <div> is because there will be multiple sections that I would like to reuse the function on, and creating an id for the <div> and then referencing this.id was the first way I was able to get the functionality that I currently have.

View 2 Replies View Related

Onclick Event - Alert Pops Up When One Of The Buttons Is Clicked

May 10, 2011

I'm just learning javascript. I need to create an onclick event for a three-state rollover. I just can't figure out where to place the event. I know it needs to go in my setup rollover function, but can't figure out where to place it so an alert pops up when one of the buttons is clicked. Anyone have any guidance for me? HTML code is (JS is below and button 1 images attached):

[Code]...

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved