Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

make dynamically generated button text bold

Posted on 2004-11-12
15
Medium Priority
?
270 Views
Last Modified: 2010-04-06
Hi how can I make this part of the code bold. I tried strong. tags but they just printed into the button.



<?=$displayOnlyInCat?>


from this php page code

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="6" height="42" background="http://www.domain.com/images/cats/open_lbg.gif"></td>

    <td background="http://www.domain.com/images/cats/openbg.gif">

        <input name="search" type="textfield" style="width:130px;" value="<?php echo $_COOKIE['term'] ; ?>">

        <input type="submit" name="submit" value="Search in <?=$displayOnlyInCat?> Category" >

        <input type="hidden" name="cat" value="<?=$onlyInCat?>"><input type="hidden" name="all" value="no"></td>

    <td width="6" height="42" background="http://www.domain.com/images/cats/open_rbg.gif"></td>
  </tr>
</table>

0
Comment
Question by:macuser777
  • 5
  • 3
  • 3
  • +3
15 Comments
 
LVL 10

Expert Comment

by:rockmansattic
ID: 12569487
css.
<input type="submit" name="submit" value="Search in <?=$displayOnlyInCat?> Category" style="font-weight:bold; ";>
 

Rockman
0
 
LVL 4

Author Comment

by:macuser777
ID: 12570082
Hi

But I only want

<?=$displayOnlyInCat?>

part in bold
0
 
LVL 4

Expert Comment

by:reginab
ID: 12570283
and this has failed ?
<input type="submit" name="submit" value="Search in<b><?=$displayOnlyInCat?></b> Category">
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Expert Comment

by:TIGClaudio
ID: 12570291
I don't think you can do that using only an <input> tag.

Try using a blank value in the <input> tag. Then setup a <div> tag on top of the botton with the text formatted in the way you need it. You would need javascript to submit the form after the onclick event on top of the <div> tag.
Sound ugly, but this is the first thing I could think of.
0
 
LVL 4

Expert Comment

by:reginab
ID: 12570353
here are a couple of different ways from here in EE
<script>
function ChangeFont(size)
{document.getElementById("text2").style.fontFamily="Arial";
document.getElementById("text2").style.fontWeight="bold";
document.getElementById("text2").style.fontSize=size;}
</script>
<div align="center">
<p><br><span style="font-family: Times New Roman; font-size: 16px;" id="text2">Page Header</span></p>
</div>
<input type="button" value="Change It" onClick="ChangeFont('11px');">

or

<span id="text2" style="font-family: Times New Roman; font-size: 16px;">Page Header</span>
<br>
<input type="button" value="Bold" onClick="document.getElementById('text2').style.fontWeight = 'bold'">
<input type="button" value="Italic" onClick="document.getElementById('text2').style.fontStyle = 'italic'">

good luck.
0
 
LVL 4

Author Comment

by:macuser777
ID: 12570541
>>>>><input type="submit" name="submit" value="Search in<b><?=$displayOnlyInCat?></b> Category">

yeah - tried that , and <strong> tags as well. Just prints into input button like text.

>>>good luck.

you're not kidding! :)

Javascript ??? - hmmmm....i'll have to save up some more points I think.....:)

and...may be being dense...but can't see how that would just bold <?=$displayOnlyInCat?> and not all text in button......

hmmmm...maybe if I make static images of static text and put them next to bolded button with dynamic text.....hmmm dunno...i'll let you know

It's a small thing ... but it would make navigation clearer
0
 
LVL 4

Expert Comment

by:reginab
ID: 12570642
hmmmm
how about try something like this.
<input type="submit" name="submit" value="Search in'<b>'<?=$displayOnlyInCat?>'</b>' Category">

I am not really sure about the placement of the single ticks. but I am thinking it might work i know in jsp you can use single ticks to add code to tags. just a thought might not work but if it did it would be a great simple solution.
0
 
LVL 4

Author Comment

by:macuser777
ID: 12570770
Unfortunately not. That printed into button as text as well.
0
 
LVL 13

Expert Comment

by:StormyWaters
ID: 12571556
<button type="submit" name="submit">Search in <b><?$displayOnlyInCat?></b></button>
0
 
LVL 13

Expert Comment

by:StormyWaters
ID: 12571567
(May not work in all old browsers)
0
 
LVL 4

Author Comment

by:macuser777
ID: 12573079
Tried it in Mozilla and safari. It leaves out the dynamic part of button text altogether. Button just says 'search in'

0
 
LVL 13

Accepted Solution

by:
StormyWaters earned 360 total points
ID: 12574807
Oops, forgot the = sign.
 <button type="submit" name="submit">Search in <b><?=$displayOnlyInCat?></b></button>

Sorry.
0
 
LVL 10

Expert Comment

by:rockmansattic
ID: 12576583
It would be easier to create a gif, that looks like input button, then have the text dynamically overlay the image, and have the image dynamically expand to fit the text.

But I suggest considering just how important just that text is to be bold?

Good Luck

Rockman
0
 
LVL 18

Expert Comment

by:arantius
ID: 12588493
Ah I scrolled through all of that and pow, stormywaters has the answer !  And as he pointed out, yes, not all older browsers support <button>.
0
 
LVL 4

Author Comment

by:macuser777
ID: 12589427
>>>><button type="submit" name="submit">Search in <b><?=$displayOnlyInCat?></b></button>

:))))))))))

StormyWaters, it works like a charm in mozilla based, IE for Mac, Opera and Netscape on my mac.


In safari it bolds in the right place but changes the button style from the Mac default Aqua type to something more like a windows IE button. That's was ok, but it also in safari  it then put the button on a new line. Dealt with that by using

style="display:inline;"
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Suggested Courses

580 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