Windows 7 Support
Become a Fan of PCHF on Facebook!
User Reviews - Add Yours!
The PCHF Lounge
Go Back   PC Help Forum » Software » Programming
Register for a Free Account

Programming - HTML - display variable posted in the Software forums; Hi, Does anyone have an example of this html. I want to display 2 buttons in html. If I click button 'a' I want to set a variable to a ...

Advertisement
Advertisement

Reply
Recommended Driver Scanner
Old 12-03-2008   #1
Bronze Member
 
Join Date: Jun 2008
Posts: 8
PC Experience: Some Experience
Default HTML - display variable

Hi,
Does anyone have an example of this html.

I want to display 2 buttons in html. If I click button 'a' I want to set a variable to a value (eg name = "john smith" ) and then display a block of text with the variable 'name' somewhere in it. If I click button 'b', I set the variable to another name and display the same block showing this different variable within it. However, the text displayed is within a <pre> </pre> tag.
eg:-

<pre>
hello, my name is <name> and I live in a tent.
I have changed my <name> from a to b,
thankyou
</pre>
Jediknight is offline   Reply With Quote
Old 12-03-2008   #2
Stoooooopid Girl.
 
Jelly Bean's Avatar
 
Join Date: Feb 2008
Location: Swansea
Posts: 12,804
PC Experience: None.
Default Re: HTML - display variable

Hello and welcome back to PCHelpForum.

I am a little thick when it comes to this but I am sure they other guys and girls will answer your questions.

I have marked your thread as "Open" to receive help.



JB.
__________________
Rwy'n ceisio fy ngorau.
Jelly Bean is offline   Reply With Quote
Old 12-06-2008   #3
Site Manager
 
madmonkey's Avatar
 
Join Date: Oct 2006
Location: South Wales
Posts: 9,968
PC Experience: ...
Default Re: HTML - display variable

Hi JK,

I really don't see how this could be done in plain HTML to be honest, you could do it in Javascript?
__________________

madmonkey is offline   Reply With Quote
Old 12-07-2008   #4
Bronze Member
 
Join Date: Jun 2008
Posts: 8
PC Experience: Some Experience
Default Re: HTML - display variable

OK thanks. How about this question ?

One other thing which should be really simple, but I'm having problems with the syntax.

I have a subroutine and I want to pass 3 parameters from the ONCLICK command. I have tried lots of combinations and none of them work. Perhaps you could help please.

sub toggleA(e, f, g)
msgbox e
msgbox f
msgbox g
End sub

This is my line in the HTML, but it doesn't seem to work and I have tried lots of combinations :-

onClick="toggleA('pdactr21','b','zzzz')"

Finally, If I wanted to pass the contents of an input field on the 3rd parameter, how would that look :-

onClick="toggleA('pdactr21', 'b',form1.PDACTR21RC.value)"
Jediknight is offline   Reply With Quote
Old 12-07-2008   #5
Site Manager
 
madmonkey's Avatar
 
Join Date: Oct 2006
Location: South Wales
Posts: 9,968
PC Experience: ...
Default Re: HTML - display variable

works for me JK, but when calling a sub routine, make sure you use the Call statement.

Passing a parameter like that is perfect, but personally, I try to use the least amount of variables necessary to accomplish the task. There is no need to pass that via a sub routine if the information in that text box can already be retrieved from within the sub routine, for example:

<body>
<script language="VBScript">
<!--
sub toggleA(e, f)
msgbox e
msgbox f
msgbox form1.textBox.value
End sub
-->
</script>

<form method="POST" name="form1" onSubmit="call toggleA('pdactr21','b')" >
<p><input type="text" name="textBox" size="20"></p>
<p><input type="submit" value="Button" name="submit"></p>
</form>

</body>

EDIT: Marked as Answered.
__________________


Last edited by madmonkey; 12-14-2008 at 05:16 PM.
madmonkey is offline   Reply With Quote

Reply

Bookmarks

Tags
answered, Answered:, display, html, open, variable
Similar discussions...
Thread Thread Starter Forum Replies Last Post
Information: *HOT* Windows XP Tips n Tricks Hengis Windows XP/2000 98 02-04-2010 08:11 AM
Solved: Problem with Warhammer Online bestbunch PC Games 38 10-10-2008 02:18 PM
Pending: Bad Display? NVidia GeForce MX Nyture Graphics 6 08-16-2008 05:13 PM
Solved: Portal (a valve-produced game) needs what kin AddyParaso Windows XP/2000 6 11-13-2007 10:30 PM
[Fixed] Switched display to TV, now screen permanently blank jiminspain Windows XP/2000 2 06-26-2005 11:17 PM

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




All times are GMT. The time now is 07:38 AM.
Powered by vBulletin
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.2