Forum Moderators: open

Message Too Old, No Replies

using text box or list

         

BaptistKitty

8:36 pm on Sep 26, 2005 (gmt 0)

10+ Year Member



Ok, here's the original script:

<form name="jumpy">
<select name="example" size="1" onChange="gone()">
<!-- CHANGE THE BELOW URLS TO YOUR OWN-->
<option value="http://www.yahoo.com" selected>Yahoo.com</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.lycos.com">Lycos</option>
<option value="http://www.AltaVista.com">AltaVista</option>
</select>

<input type="button" name="test" value="Go!" onClick="gone()">
</form>

<script language="javascript">
<!--

//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=1
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else{
if (!window.win2¦¦win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}
//-->
</script>

the italic part is where I editied to this;

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Jumpy</title>

<SCRIPT>
function yes() {
MMDiv.style.visibility='visible';
mainform.MakeModel.focus();
}
function no() {
MMDiv.style.visibility='hidden';
}
</SCRIPT>

</head>

<body>

<form name="jumpy">

<INPUT TYPE="RADIO" NAME="PRINTER" onclick="no();" CHECKED>Listed

<select name="example" size="1" onChange="gone()" onclick="no();">
<!-- CHANGE THE BELOW URLS TO YOUR OWN-->
<option value="http://www.yahoo.com" selected>Yahoo.com</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.lycos.com">Lycos</option>
<option value="http://www.AltaVista.com">AltaVista</option>
<BR><BR>
<INPUT TYPE="RADIO" NAME="PRINTER" onclick="yes();">Other

<BR>
<DIV ID="MMDiv" style="visibility:hidden">
<LABEL FOR="MakeModel">
<INPUT TYPE="TEXT" name="example" ID="MakeModel">
Or, Enter your own using format [mysite.com<...]
</DIV>
<BR>

</select>
</form>

<input type="button" name="test" value="Go!" onClick="gone()">
<BR>
<BR>

<script language="javascript">
<!--

//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=0
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else{
if (!window.win2¦¦win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}
//-->
</script>

</body>

</html>

Just in case you cant tell what I'm trying to do, here's what it is. I'm trying to get it to where you can either select something from the list to show or you can type in what you want and it will show that. I merged two different codes for the second one. I'm not sure if I'm even on the right track and I dont know what to search for to figure it out my self. Can any one help?

BaptistKitty

8:37 pm on Sep 26, 2005 (gmt 0)

10+ Year Member



oops forgot to say.. the error is "'document.jumpy.example.options' is null or not an object"

Dijkgraaf

12:13 am on Sep 27, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The first problem is that you've called both the select and the input "example", hence it has become an array of objects. I'd rename the text input to something else.