Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > anyone good with java script-toggle text on input button

Reply
Thread Tools

anyone good with java script-toggle text on input button

 
 
Paul
Guest
Posts: n/a
 
      03-28-2008
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>
--
thanks,
Paul G
Software engineer.
 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      03-28-2008
"Paul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> <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...?


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

 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      03-28-2008
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.

--
Paul G
Software engineer.


"Mark Rae [MVP]" wrote:

> "Paul" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > <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...?
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>

 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      03-28-2008
"Paul" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

> 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?sourc...ipt+deprecated


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

 
Reply With Quote
 
Peter Bromberg [C# MVP]
Guest
Posts: n/a
 
      03-29-2008
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


"Paul" wrote:

> 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>
> --
> thanks,
> Paul G
> Software engineer.

 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      03-31-2008
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.

--
Paul G
Software engineer.


"Mark Rae [MVP]" wrote:

> "Paul" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>
> > 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?sourc...ipt+deprecated
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net
>
>

 
Reply With Quote
 
Paul
Guest
Posts: n/a
 
      03-31-2008
ok thanks it works!
--
Paul G
Software engineer.


"Peter Bromberg [C# MVP]" wrote:

> 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
>
>
> "Paul" wrote:
>
> > 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>
> > --
> > thanks,
> > Paul G
> > Software engineer.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Width of text input box vs. password input box cjl HTML 1 10-31-2005 11:46 AM
Off Topic: Width of text input box vs. password input box cjl Javascript 7 10-30-2005 10:11 PM
can i pass data with input text instead of input hidden? Walter ASP General 6 09-17-2004 11:16 AM
Coloring input type=input browse button; uploading multiple files Ron Brennan Javascript 5 05-14-2004 08:13 PM
why does form with only 1 text input and 1 button input submit on enter? Guy HTML 5 12-13-2003 06:44 AM



Advertisments