Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 10th, 2004, 11:29 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to pigtail Send a message via Yahoo to pigtail
Default Change a button's name dynamically

I tried to change a button name dynamically but couldn't. Here is the code, can someone tell me why?

<body>
<script language="JavaScript" type="text/javascript">
<!--
var working = false;
function StartWork() {
if (!(working)) {
    working = true;
    button1.Value='STOP'; }
else {
    working = false;
    button1.Value='START';}
}
//-->
</script>
<input type=button name=button1 value="START" onclick='StartWork()'>



Reply With Quote
  #2 (permalink)  
Old April 11th, 2004, 02:47 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Is this what you're going for?

Code:
<script language="JavaScript" type="text/javascript">

    function change_button(this_button)
    {
        document.getElementById(this_button).value = (document.getElementById(this_button).value == 'Hello')? 'World' : 'Hello';
    }

</script>

<form action="javascript:void(0);">
    <input type='submit' name'button' value='Hello' id='this_button' onclick='change_button("this_button");' />
</form>
hth,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
Reply With Quote
  #3 (permalink)  
Old April 11th, 2004, 06:02 PM
Authorized User
 
Join Date: Apr 2004
Location: , , .
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to pigtail Send a message via Yahoo to pigtail
Default

Yes, thank you.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to dynamically change an HTML page kpnikhil PHP How-To 1 September 7th, 2007 03:53 AM
How to change the globalization dynamically? sfs00784 General .NET 1 July 16th, 2004 04:13 AM
How to change report's objects dynamically. Vadim Crystal Reports 2 May 17th, 2004 09:40 AM
dynamically change the row colors in datagrid bvrao VS.NET 2002/2003 0 December 24th, 2003 06:19 AM
Dynamically change event handlers oranginalab Javascript How-To 2 July 31st, 2003 10:11 AM



All times are GMT -4. The time now is 04:08 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.