...

View Full Version : 2parts-text area, and js alerts, how do you...



ImperialSpider
01-29-2005, 09:45 AM
PART I. How do you specify the background color of a text area? and also would like to know if there is a way to write protect the info in the text area, so a user does not change what is written in the text area, then print out so something completely different comes out. <would be for a legal agreement form>. Can someone help me with this???

PART II. I am interested in a script that would allow me to specify what options come out on a javascript alert box. I want to have options like 'yes' and 'no' instead of 'OK' and 'Cancel'., and then have those options take the user to different pages within the site, depending on which option they click. Is this possible?

I am very new to javascripts, so please answer in lamens terms. below is the code I am working with. Any help would be greatly appreciated...Thanks in Advance...ImperialSpider

<html>
<head>
<title>agreement form</title>
<script type="text/javascript">
function agreesubmit(el){
var tempobj;
var els=el.form.elements;
for (var i=0;i<els.length;i++){ //hunt down submit button
tempobj=els[i];
if(tempobj.type.toLowerCase()=="submit")
tempobj.disabled=!el.checked;
}
}
function defaultagree(el){
if (el.agreecheck.checked){
alert("Great, Lets get started.");
location.href='page1.html';
}
else
alert("Please check the box if your agree to the conditions")
return false
}
</script>
</head>
<body>
<form name="agreeform" onSubmit="return defaultagree(this)">
<p>YOU MUST MEET MY CONDITIONS, WHICH ARE...</p>
<textarea rows="5" name="S1" cols="30" style="width:60%" wrap="virtual">
1. FIRST CONDITION.
2. SECOND CONDITION.
3. THIRD CONDITION.
4. FOURTH CONDITION.
5. FIFTH CONDITION.
6. SIXTH CONDITION.
7. SEVENTH CONDITION.
</textarea>
<p>
<input name="agreecheck" type="checkbox" onClick="agreesubmit(this)" />
<b>Check box if you agree to the above conditions</b>
<p><input type="Submit" value="Submit!" disabled="disabled" /></p>
</form>
</body>
</html>

Brandoe85
01-29-2005, 09:53 AM
<textarea rows="5" name="S1" cols="30" style="width:60%; background-color: red;" wrap="virtual" readonly="readonly">

You cannot change which buttons appear in a javascript alert(as far as I know anyhow :rolleyes: )

ImperialSpider
01-29-2005, 10:26 AM
That worked and was exactly what I was looking for. However, with the alert script does exist...I have seen it on some helpsite like javascriptkit.com somewhere, but dont remember where, and now I can't find it. I also tried dynamicdrive.com and could not find it there either. I am not sure what the script would be called to look it up either, and dont remember which one it was, or if it was at another site altogether. I hope someone in here knows it. But thanks for your help.

Imperial Spider

Brandoe85
01-29-2005, 10:29 AM
I did a search for alert box...http://www.sitelevel.com/query.go?crid=0c521e0c5dfcffa3&query=alert+box&I1.x=0&I1.y=0
I've heard it's been done in vbscript, for IE only, but never with javascript...

ImperialSpider
01-29-2005, 10:44 AM
Yes, it seems you are the correct one here... but I did see it, only I was looking at the vbscript, and not javascript...at any rate, I found what I was looking for in that link, and I have you to thank for that. Many Kudos go to you for your help. Thanks again,

Imperial Spider

Brandoe85
01-29-2005, 10:47 AM
You're welcome :thumbsup:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum