Thread: href + javascript onlick event
Results 1 to 5 of 5
Related
-
Javascript event inside echo statement Forum: PHP Forum
Replies: 2 -
Javascript onclick Event Handler: Forum: Javascript Forum
Replies: 3 -
need help with passing query string to href - javascript function Forum: Javascript Forum
Replies: 2 -
javascript onclick event to refresh iframe. Forum: Javascript Forum
Replies: 5 -
Help-a href hide them please Forum: Website Scripts Forum
Replies: 7
-
09-06-2008, 02:49 AM #1
href + javascript onlick event
Hello,
am doing one program, where user types an alphabet or name in text field, then below at span , all the data related to alphabet or name will be retrived.
so now i want to do is , in span, i want an href (link) , so wen i click on that link, i will call onClick() and i will alert the particular name .
<a href="#" onClick="return view();" id="aa"><?php $response=$hint; ?></a>
<script type="text/javascript">
function view()
{
alert("inscript");
var a=document.getElementByID(aa).value;
alert(a);
return true;
}
</script>
what should i do,
and can i put id or name to href, so i want to access that value in javascript through id or name
thanks in advance
-
09-06-2008, 03:07 AM #2
Re: href + javascript onlick event
You just missed on adding highlighted:
Code:var a=document.getElementByID('aa').value;
Checkout my porfolio.
Please click thebutton when a member helped you.
Take time to use Forum's Search function.
-
09-06-2008, 03:11 AM #3
Re: href + javascript onlick event
ya, jus did that
but am not able to enter into function view()
1st line of function i hav put line, alert("in function");
but onClick event does not enter that function.
-
09-06-2008, 03:34 AM #4
Re: href + javascript onlick event
Could you please show to us the generated markup (HTML) instead of the PHP raw file.
Checkout my porfolio.
Please click thebutton when a member helped you.
Take time to use Forum's Search function.
-
09-08-2008, 09:13 AM #5
Re: href + javascript onlick event
You don't have anything entered in for a link. There is nothing for you to click on. How are you getting to the function as is?
All this line does is assign the variable. Nothing will show up on screen: <?php $response=$hint; ?>