Two Plus Two Newer Archives  

Go Back   Two Plus Two Newer Archives > 2+2 Communities > Other Other Topics
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2006, 06:24 PM
traz traz is offline
Senior Member
 
Join Date: Oct 2005
Location: Sleeping on stacks
Posts: 19,775
Default 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
Reply With Quote
  #2  
Old 11-03-2006, 06:28 PM
IggyWH IggyWH is offline
Senior Member
 
Join Date: Sep 2004
Location: America\'s Finest City
Posts: 8,170
Default 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.
Reply With Quote
  #3  
Old 11-03-2006, 06:29 PM
lippy lippy is offline
Senior Member
 
Join Date: May 2006
Location: i ain\'t got my taco
Posts: 3,905
Default 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.
Reply With Quote
  #4  
Old 11-03-2006, 06:32 PM
traz traz is offline
Senior Member
 
Join Date: Oct 2005
Location: Sleeping on stacks
Posts: 19,775
Default 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> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;

&lt;head&gt;
&lt;title&gt;A Simple Color Picker&lt;/title&gt;
&lt;script type="text/javascript"&gt;
/*&lt;![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;
}
}

/*]]&gt;*/
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;h1 style="text-align:center"&gt;A Simple Color Picker&lt;/h1&gt;
&lt;form id="ColorPicker" method="post" action=""&gt;
&lt;table width="70%" border="1" cellpadding="5" style="align:right"&gt;
&lt;tr&gt;
&lt;td valign="top" align="left" style="width:42%"&gt;
&lt;p style="text-align:left"&gt;
Background (enter values from '00' to 'FF')
RED:&lt;input name="bgRed" type="text" size="2" maxlength="2" value="FF" /&gt;
GREEN:&lt;input name="bgGreen" type="text" size="2" maxlength="2" value="FF" /&gt;
BLUE:&lt;input name="bgBlue" type="text" size="2" maxlength="2" value="FF" /&gt;
&lt;/p&gt;
&lt;p style="text-align:left"&gt;
Text (enter values from '00' to ''FF')&lt;br/&gt;
RED:&lt;input name="txtRed" type="text" size="2" maxlength="2" value="00" /&gt;
GREEN:&lt;input name="txtGreen" type="text" size="2" maxlength="2" value="00" /&gt;
BLUE:&lt;input name="txtBlue" type="text" size="2" maxlength="2" value="00" /&gt;
&lt;/p&gt;
&lt;p style="text-align:center"&gt;
&lt;input type = "button" value = "Apply" onclick="CheckData()"/&gt;&amp;nbsp;&amp;nbsp;
&lt;input type = "reset" value = "Reload" onclick = "location.reload(true)"/&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" align="left"&gt;
&lt;h3&gt;Hamlet:&lt;/h3&gt;
&lt;p&gt;Speak the speech, I pray you, as I pronounced it to you...TEST&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt; </pre><hr />
Reply With Quote
  #5  
Old 11-03-2006, 06:38 PM
IggyWH IggyWH is offline
Senior Member
 
Join Date: Sep 2004
Location: America\'s Finest City
Posts: 8,170
Default Re: Quick javascript help

Do you have activex access restricted in your IE? It worked fine for me once I allowed it.
Reply With Quote
  #6  
Old 11-03-2006, 06:39 PM
lippy lippy is offline
Senior Member
 
Join Date: May 2006
Location: i ain\'t got my taco
Posts: 3,905
Default Re: Quick javascript help

Work on both FF and IE on my computer. Check your security settings in IE.
Reply With Quote
  #7  
Old 11-03-2006, 06:41 PM
traz traz is offline
Senior Member
 
Join Date: Oct 2005
Location: Sleeping on stacks
Posts: 19,775
Default 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.
Reply With Quote
  #8  
Old 11-04-2006, 12:38 AM
BrunoThePug BrunoThePug is offline
Senior Member
 
Join Date: Aug 2005
Location: Arizona
Posts: 882
Default 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.
Reply With Quote
Reply


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

Forum Jump


All times are GMT -4. The time now is 06:51 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.