/    Sign up×
Community /Pin to ProfileBookmark

Help Returning JS

I haven’t messed with JavaScript in quite sometime and I need to make a very simple script and I am completely drawing a blank on how to do it. If anyone could just help me with this example I can take it from there. Thanks for any help you may provide

exalple:

[CODE]<form method=”POST”>

<input type=”text”size=”20″>

<input type=”submit” value=”Submit”>

</form>

<table border=”1″>

<td>
<font color=”*”>1</font> 2 3 4 5 <font color=”*”>6</font> 7 8 <font color=”*”>9</font> 10
</td>

</table>[/CODE]

Basically I am trying to have the table hidden until OnClick of the submit button. I aslo want all the * in the table to change to what ever is typed into the submit box. So for example if i entered “red” in the submit box numbers 1 and 6 would be red. Thanks again for your time and any help you can provide.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisFeb 20.2008 — Apparently you haven't messed with HTML in a while either. ?
<i>
</i>[color=red]&lt;script type="text/javascript"&gt;
function change() {
document.getElementById("t1").style.display = "block";
document.getElementById("s1").style.color = document.f1.color.value;
document.getElementById("s2").style.color = document.f1.color.value;
document.getElementById("s3").style.color = document.f1.color.value;
}
&lt;/script&gt;[/color]
&lt;form [color=red]name="f1" onsubmit="change();return false"&gt;&lt;!--[/color]method="POST"[color=red]--[/color]&gt;
&lt;input [color=red]name="color"[/color] type="text" size="20"&gt;
&lt;input type="submit" value="Submit"&gt;
&lt;/form&gt;
&lt;table border="1" [color=red]id="t1" style="display: none"[/color]&gt;
&lt;tr&gt;
&lt;td&gt;&lt;[color=red]!--[/color]font color="*"[color=red]--[/color]&gt;[color=red]&lt;span id="s1"&gt;[/color]1[color=red]&lt;/span&gt;[/color]&lt;[color=red]!--[/color]/font[color=red]--[/color]&gt; 2 3 4 5 &lt;[color=red]!--[/color]font color="*"[color=red]--[/color]&gt;[color=red]&lt;span id="s2"&gt;[/color]6[color=red]&lt;/span&gt;[/color]&lt;[color=red]!--[/color]/font[color=red]--[/color]&gt; 7 8 &lt;[color=red]!--[/color]font color="*"[color=red]--[/color]&gt;[color=red]&lt;span id="s3"&gt;[/color]9[color=red]&lt;/span&gt;[/color]&lt;[color=red]!--[/color]/font[color=red]--[/color]&gt; 10&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
Copy linkTweet thisAlerts:
@rabitauthorFeb 20.2008 — Apparently you haven't messed with HTML in a while either. ?
[/QUOTE]

That would be an accurate statement, thanks for the help.

I had hoped to apply any help I got with this problem to other concepts other than just changing colors of a font. For example if the user input value "X" it will change the HTML of a hidden table inputing value "X", then display the table. Unfortunetly, although you 100% resolved what I had asked help with, it wouldn't allow me to apply the same method to say, a link with an * in the url (ex. /index.html">www.aol.com/*/index.html)

You have proven the concept of what I am trying to do is possible, I just can't seem to figure this out on my own. The link example I just gave is specifically what I am trying to do, the color problem was also an issue, so thanks for your help.
×

Success!

Help @rabit spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...