What browser are you using?
You should use firefox and download the 'firebug' addon so you aren't in the dark:
These errors appear when you click a color.
relateColor is not defined
[IMG]chrome://firebug/content/blank.gif[/IMG] Color: <input type="button" onclick="showColorGrid3('COLORcompanyName','no...
form.html (line 85)
document.getElementById(objID) has no properties
[IMG]chrome://firebug/content/blank.gif[/IMG]function getScrollY(){var scrOfX = 0,scrOfY=0;if(typeof(window.pageYOffset)=='nu...
301a.js (line 14)
You are calling relateColor() - why? There IS no relateColor function that I see.
2. The second error seems to indicate that objID is not defined with a proper object.
I will assume also that objID is the id we pass it.
Now, we can assume that it refers to COLORcompanyName in the form.
and according to the script instructions:
// Call: showColorGrid3("input_field_id","span_id")
... and if we do a search on id=COLORcompanyName in your code, we see nothing.... and neither does the browser.
So here is a fundamental 'gotcha' in this.
name= is for form elements.
id= is for anything.
Any object can contain both. a name can be the same as an id.
So problem is, your code asks for an object ID and you gave it a name.
Try this:
HTML Code:Color: <input type="button" onclick="showColorGrid3('COLORcompanyName','none');" value="..."> <input type="text" ID="COLORcompanyName" name="COLORcompanyName" size="9">
and get rid of this:
Now, I can tell you ahead of time, all you are doing is filling in the Color object. There can be great biblical gnashing of teeth trying to get the preview to change.HTML Code:<script language="javascript">relateColor('companyName', getObj('color1').value);</script>
The obvious should be to do this:
Remember that I said you can do multiple JS commands by separating them with a semi-colon.HTML Code:onclick="showColorGrid3('COLORcompanyName','none');document.getElementById("companyName").style.color=document.getElementById(o"COLORcompanyName").value;"
Simple! We call the color picker, and then we get the color the picker put in the field and apply it to the preview!
Let me save you the agony. Javascript is not modal. Which means, it won't wait for you to choose a color. It will execute the color picker and then do the second part quicker than you can even focus on the colors, no matter what strength your coffee is.
So we put the second part in an 'onChange' on COLORcompanyName and when the color picker changes it it changes the preview!
Nice try. onChange should be renamed to onHumanChange. It doesn't get triggered by JS itself.
What to do.... to be continued.


LinkBack URL
About LinkBacks

Reply With Quote

