Click to See Complete Forum and Search --> : This is probably starting to get annoying, but....


JScriptNewbie
03-10-2003, 08:08 PM
I have another problem. I have the code that pyro gave me which worked wonderfully (yay!), and now I wish to combine it with a different code. I tried just putting the "new" code after pyro's, and it didn't work. How can I include the new code in with pyro's? The codes are:

pyro's code (I added some stuff):

<html>
<head>
<script language="javascript" type="text/javascript">
function addText()
{
document.getElementById("mydiv").innerHTML = "<FONT Color=black size=5>Text</FONT Color=black size=5>";
}
</script>
<center>
<body>
<form name="myform">
<input type="button" name="mybutton" value="Next" onClick="addText()">
</form>
<div id="mydiv"></div>
</body>
</html>

And the other code (which I think might be pyro's too..I don't remember):


<center>
<script>
function takeAction() {

// The right choice
var rightOne = 1;
var msg = "Correct";
var msg2 = "Incorrect";

var c = document.form1.menu1.selectedIndex;

if (c == rightOne) {
if (confirm(msg)) {

document.form1.extra.value = "Congradulations!"

}


} else {
if (confirm(msg2))
location.replace("http://www.altavista.com");

}

}

</script>

Basically, I would like to have the button bring up the text, the select-and-go menu, and the text box all at the same time. Is it possible????

pyro
03-10-2003, 08:16 PM
How about something like this:

document.getElementById("mydiv").innerHTML = '<FONT Color=black size=5>Text</FONT Color=black size=5><form name="form1"><select name="menu1"><option value="1">1</option><option value="2">2</option></select><input type="text" name="extra"></form>';

BTW, the second code snippet was not mine... :p

JScriptNewbie
03-10-2003, 11:40 PM
Well, the code that you gave me worked, but it only worked some of the time. I don't know why that is, and I'd like it if the code was a bit more dependable.....

pyro
03-11-2003, 06:55 AM
It works dependably in IE6, NN7, Mozilla 1.2 and Opera 7 for me...what browser are you useing?

JScriptNewbie
03-11-2003, 04:46 PM
Never mind. It works.