#1
|
|||
|
|||
Quick javascript help
I'm a noob. All my coding works for FF, but not for IE. I was wondering if anyone was willing to check my code and help me get it working for IE as well. I can paste here or through pm or aim or whatever.
Any help would be appreciated :P |
#2
|
|||
|
|||
Re: Quick javascript help
It's been a while, but go ahead and post it. If I can't figure it out, I'm sure someone else can.
|
#3
|
|||
|
|||
Re: Quick javascript help
There is a computer tech help forum, you may get a better response there.
Posting it here can't help. I used to be okay at Jscript editing and understand it. |
#4
|
|||
|
|||
Re: Quick javascript help
The comp tech forum is usually dead from my experiences. I'll post the coding here. If I get help, then great. If a mod wants to move this, then thats ok too.
<font class="small">Code:</font><hr /><pre> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>A Simple Color Picker</title> <script type="text/javascript"> /*<![CDATA[*/ function Color() { var red, green, blue; var red1, green1, blue1; var msg = ""; with (document.getElementById("ColorPicker")) { red = bgRed.value; green = bgGreen.value; blue = bgBlue.value; red1 = txtRed.value; green1 = txtGreen.value; blue1 = txtBlue.value; var pound = "#"; var color = red + green + blue; var textcolor = red1 + green1 + blue1; document.bgColor = ( pound + color); document.fgColor = ( pound + textcolor); } } function CheckData(){ var isValid = true; var msg = ""; with (document.getElementById("ColorPicker")) { /* function Color */ Color(); /* bgRed must be hexadecimal*/ if (bgRed.value=="") { isValid = false; msg += "\n You must enter a value for Red-Background."; } else { var re = /[0-9,A-F]{2}/; var found = bgRed.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Red-Background field"; } } /* bgGreen must be hexadecimal*/ if (bgGreen.value=="") { isValid = false; msg += "\n You must enter a value for Green-Background."; } else { var re = /[0-9,A-F]{2}/; var found = bgGreen.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Green-Background field"; } } /* bgBlue must be hexadecimal*/ if (bgBlue.value=="") { isValid = false; msg += "\n You must enter a value for Blue-Background."; } else { var re = /[0-9,A-F]{2}/; var found = bgBlue.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Blue-Background field"; } } /* txtRed must be hexadecimal*/ if (txtRed.value=="") { isValid = false; msg += "\n You must enter a value for Red-Text."; } else { var re = /[0-9,A-F]{2}/; var found = txtRed.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Red-Text field"; } } /* txtGreen must be hexadecimal*/ if (txtGreen.value=="") { isValid = false; msg += "\n You must enter a value for Green-Text."; } else { var re = /[0-9,A-F]{2}/; var found = txtGreen.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Green-Text field"; } } /* txtBlue must be hexadecimal*/ if (txtBlue.value=="") { isValid = false; msg += "\n You must enter a value for Blue-Text."; } else { var re = /[0-9,A-F]{2}/; var found = txtBlue.value.match(re); if ( !found ) { isValid = false; msg += "\n You must enter 2 hexadecimal characters for the Blue-Text field"; } } if (msg != "") { alert(msg); } return isValid; } } /*]]>*/ </script> </head> <body> <h1 style="text-align:center">A Simple Color Picker</h1> <form id="ColorPicker" method="post" action=""> <table width="70%" border="1" cellpadding="5" style="align:right"> <tr> <td valign="top" align="left" style="width:42%"> <p style="text-align:left"> Background (enter values from '00' to 'FF') RED:<input name="bgRed" type="text" size="2" maxlength="2" value="FF" /> GREEN:<input name="bgGreen" type="text" size="2" maxlength="2" value="FF" /> BLUE:<input name="bgBlue" type="text" size="2" maxlength="2" value="FF" /> </p> <p style="text-align:left"> Text (enter values from '00' to ''FF')<br/> RED:<input name="txtRed" type="text" size="2" maxlength="2" value="00" /> GREEN:<input name="txtGreen" type="text" size="2" maxlength="2" value="00" /> BLUE:<input name="txtBlue" type="text" size="2" maxlength="2" value="00" /> </p> <p style="text-align:center"> <input type = "button" value = "Apply" onclick="CheckData()"/>&nbsp;&nbsp; <input type = "reset" value = "Reload" onclick = "location.reload(true)"/> </p> </td> <td valign="top" align="left"> <h3>Hamlet:</h3> <p>Speak the speech, I pray you, as I pronounced it to you...TEST</p> </td> </tr> </table> </form> </body> </html> </pre><hr /> |
#5
|
|||
|
|||
Re: Quick javascript help
Do you have activex access restricted in your IE? It worked fine for me once I allowed it.
|
#6
|
|||
|
|||
Re: Quick javascript help
Work on both FF and IE on my computer. Check your security settings in IE.
|
#7
|
|||
|
|||
Re: Quick javascript help
ok, so I'm REALLY stupid.
yea my fault, go ahead and lock the thread. Thanks whoever replied and read the thread. |
#8
|
|||
|
|||
Re: Quick javascript help
If you're testing javascript in FireFox there is a great FF addon called FireBug that has a great javascript debugger/console.
|
|
|