Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change text into Bold

Posted on 2001-06-08
14
Medium Priority
?
233 Views
Last Modified: 2012-05-04
Hello all,

I am using the following HTML code to create a link in my page..

<DIV ID="LinkA"><A HREF=myURL" onClick= "MakeBold('LinkB')>LinkA</A></DIV>
<DIV ID="LinkB"><A HREF=myURL">Link B</A></DIV>

I want to make the link B bold when the link A is clicked? I tried to create a Java Script function, and pass the Id of the link B to it as a parameter, but what is the java script statment that change a text into bold?

Any idea?!!
Areej
0
Comment
Question by:Areej
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +3
14 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6168308
There is none.

You can change a STRING to bold by using
document.all('LinkB').innerHTML = document.all('LinkB').innerHTML.bold()
in IE

Alternatively use a stylesheet and change the class of the link

Michel
0
 

Author Comment

by:Areej
ID: 6168430
Thanx a lot..
It is working fine from Explorer, but what about Netscape?!

Many thanx,
Areej
0
 

Expert Comment

by:rogpereira
ID: 6168755
function MakeBold(l_obj) {
  document.all(l_obj).style.fontWeight = "bold";
}
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Areej
ID: 6168847
Thanx a lot rogpereira, but that statment works only with Explorer. It is not working with Netscape. I'm getting "document.all has no properties" when I try to run it from netscape.

Any idea?!

Areej
0
 

Expert Comment

by:rogpereira
ID: 6168882
I'm sorry, but I don't work with Netscape.
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6170429
You need to put your HTMLLink code in a
<DIV> or <LAYER> object and rewrite the content of the Layer everytime the Link A is clicked. That is the only possibility I know to make the thing work in Netscape.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6171209
Yep it is IE only.

So

<script>
boldText = '<A HREF="myURL"><B>Link B</B></A>'


function makeBold(divId) {
   if (document.all) {
      document.all(divId).innerHTML = boldText;
   }
   else if (document.layers) {
      with(document.layers[divId].document) {
        write(boldText);
        close()
      }
   }
   else if (document.getElementById) {
      document.getElementById(divId).innerHTML = boldText;
   }

   return false
}

<DIV ID="LinkA"><A HREF="myURL"
onClick= "return MakeBold('LinkB')>LinkA</A></DIV>
<DIV ID="LinkB" STYLE="position:absolute"><A HREF="myURL">Link B</A></DIV>

Another alternative is to have the two kinds of links in two layers and show one and hide the other

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6171210
Sorry missed a </script>
0
 
LVL 9

Expert Comment

by:nimaig
ID: 6171259
Michel -:
You missed the double quotes :
  i.e. it should be onClick= "return MakeBold('LinkB')"
and the method name must me makeBold('LinkB') not MakeBold('LinkB')

cheers :)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6171268
yeah - thanks

Michel
0
 

Accepted Solution

by:
hjainu earned 160 total points
ID: 6175748
<html>
<head>
<style>
.c1{
font-weight:"bold"
}
</style>
<script language="javascript">

function abc()
{
i1.className="c1"
}

</script>
</head>

<body>
<a href="url"><span  onClick=abc()>A Link</span></a>
<a href="url"><span id="i1">B Link</span></a>
</body>
</html>
0
 

Author Comment

by:Areej
ID: 6178470
Thanx a lot 4 all of u.. :-)
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6178936
??????????

Michel
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6199003
mplungjan...

check the other q he answered!!
???
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question