/    Sign up×
Community /Pin to ProfileBookmark

colorcube script

I picked up the script for the color cube at javascriptsource.com [url]http://javascript.internet.com/miscellaneous/color-cube.html[/url]
and have the cube on [url]http://www.geocities.com/adilbookz/Utilities/colorcubefinished.html[/url] But for reasons that are beyond me, it doesn’t work. Does anyone have any idea of what might be wrong?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@bunner_bobDec 30.2002 — I'm trying to adapt this colorcube script to create a form field populated with the chosen color, so when the form is submitted, the chosen color is sent to a database.

It's not working.

I have this function defined:

<script language="javascript" type="text/javascript">

function SendColor(color) {

document.getElementById("headingcolordiv").innerHTML = "<input type="text" name="headingcolor" size="12" value="" + color + "">";

}

</script>

And here's the accompanying color cube and form field:

<A HREF="webpal.map"><IMG SRC="images/cube.gif" WIDTH=292 HEIGHT=196 BORDER=0 ALT="" USEMAP="#map_webpal" ISMAP></A><br>

<div ID="headingcolordiv"><input type="text" name="headingcolor" size="12" value="<?php echo $headingcolor ?>"></div>

If there's a color already in the database, the <?php echo $headingcolor ?> pulls it out of the db. This works fine. If I manually type a value into the form field it posts to the db just fine as well.

If I click on a color square in the cube, it appears to set the innerHTML properly (i.e. I can make the form field change size, and the specified color value shows up in the field) but the value does NOT get passed on "Submit". It's as if the field were empty.

Any idea what I'm missing here?

thanks!
Copy linkTweet thisAlerts:
@bunner_bobDec 31.2002 — Well that's interesting, because I finally arrived at something that works, which is:

function SendColor(color) {

document.schemestructure.headingcolor.value = color ;

}

where the link is

<A HREF="webpal.map"><IMG SRC="images/cube.gif" WIDTH=292 HEIGHT=196 BORDER=0 ALT="" USEMAP="#map_webpal" ISMAP></A><br>

<input type="text" name="headingcolor" size="12" value="<?php echo $headingcolor ?>">

and it works just exactly like a charm.
Copy linkTweet thisAlerts:
@bunner_bobDec 31.2002 — Oh I see - I thought you were saying I COULDN'T do document.formName.fieldName.value = "...";

I didn't see your "instead" - comes from being a "skimming" reader instead of paying better attention.

I've clearly spent too much time in front of the computer today...forgive my boobishness
Copy linkTweet thisAlerts:
@adilbookzauthorJan 01.2003 — Thanks, Dave. Your suggestion worked.
Copy linkTweet thisAlerts:
@adilbookzauthorJan 01.2003 — Thanks, Dave. Your suggestion worked.
×

Success!

Help @adilbookz 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.24,
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,
)...