• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Change href in jsp dynamically

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am stuck in a problem.
I need to change email in text box , as soon as the email is changed the href which exist to that email address in the screen should also change.

I have called a java script but it only change the reference but not the text dispalyed along. For example when email entered is changed to abc@qq.com from xyz@qq.com then link text should also change .
But in my code although actual reference is getting changed but text dispalying email is not getting changed.

Please provide me solution

Below is the code:



java script
function changeLink()
{
var qwerty ='priyanka.kakkar@ps.net';
document.getElementById("myAnchor").href=qwerty;
}

java script ends

JSP

//form tag
form method="get"
//input tag
input type="text" id="id" name="username" size="25" onblor="changeLink()"
//anchor tag
a id="myAnchor" href="mailto:priyanka.kakkar@gmail.com" priyanka.kakkar@gmai.com






Thankz

Priyanka
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because you are only setting the href and not the innerHTML which is the text the user sees.

Eric
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic