Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

anyone good with java script-toggle text on input button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul - 28 Mar 2008 20:29 GMT
Hi I need to toggle the text on an html input button in a .net web application.
the name of the button is btn_hide and I do have an onclick function for it.

<script language="javascript" type="text/javascript">
// <!CDATA[

function btn_hide_onclick()
{

}

// ]]>
</script>
Signature

thanks,
Paul G
Software engineer.

Mark Rae [MVP] - 28 Mar 2008 20:35 GMT
> <script language="javascript" type="text/javascript">

Firstly, get rid of the language tag, as that's deprecated syntax...

> Hi I need to toggle the text on an html input button in a .net web
> application.

Toggle? From what to what? I.e. what precisely do you want to happen when a
user clicks the button...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Paul - 28 Mar 2008 20:53 GMT
hi thanks for the response.  I got it working by toggling the state of a
variable, just wanted the text to change back and forth each time the user
clicks on it.  hide,expand,hide,expand.  Should the
<script language="javascript" type="text/javascript">
be removed?
I double clicked on the input button in the aspx page and the designer in
vs2005 auto created this tag.

Signature

Paul G
Software engineer.

> > <script language="javascript" type="text/javascript">
>
[quoted text clipped - 5 lines]
> Toggle? From what to what? I.e. what precisely do you want to happen when a
> user clicks the button...?
Mark Rae [MVP] - 28 Mar 2008 23:58 GMT
> just wanted the text to change back and forth each time the user clicks on
> it

OK, but change from what to what...?

> Should the <script language="javascript" type="text/javascript"> be
> removed?

No. As I said, the language tag should be removed as it is deprecated:
http://www.google.co.uk/search?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4
GZEZ_en-GBGB252GB252&q=language+javascript+deprecated


Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Paul - 31 Mar 2008 15:58 GMT
ok thanks I removed the language tag. I am changing the value of the button
from hide to expand as I am collapsing and expanding a panel.

Signature

Paul G
Software engineer.

> > just wanted the text to change back and forth each time the user clicks on
> > it
[quoted text clipped - 6 lines]
> No. As I said, the language tag should be removed as it is deprecated:
> http://www.google.co.uk/search?sourceid=navclient&aq=t&hl=en-GB&ie=UTF-8&rlz=1T4
GZEZ_en-GBGB252GB252&q=language+javascript+deprecated
Peter Bromberg [C# MVP] - 29 Mar 2008 13:08 GMT
Quick 'n' Dirty:

<script type="text/javascript">
function toggle()
{
value = document.getElementById("myButt").value;
if(value=="First")
document.getElementById("myButt").value="Second";
else
document.getElementById("myButt").value="First";
}
</script>

<input type = "button" id="myButt" value="First" onclick="toggle();"/>

-- Peter
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short Urls & more: http://ittyurl.net

> Hi I need to toggle the text on an html input button in a .net web application.
> the name of the button is btn_hide and I do have an onclick function for it.
[quoted text clipped - 9 lines]
> // ]]>
> </script>
Paul - 31 Mar 2008 16:02 GMT
ok thanks it works!
Signature

Paul G
Software engineer.

> Quick 'n' Dirty:
>
[quoted text clipped - 29 lines]
> > // ]]>
> > </script>

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.