View Full Version : Need help with a code please
old1
Mar 6th 2005, 8:00 pm
Hello
First of must say im newbie + not fluent english + not much webmaster knowledge :)
im tryin to do something i dont know even how it call but i paste my doce below for you to got it
<td><form>
<select multiple size="5">
<option>menu name here </option>
<option value="<a href=site a addy here >site a</option>
<option value="<a href=site b addy here >site b</option>
<option value="<a href=site c addy here >site c</option>
<option value="<a href=site d addy here >site d</option>
<option value="<a href=site e addy here >site e</option>
<option value="<a href=site f addy here >site f</option>
</select></form></td>
in firefox browser iy does what i want i mean when someone 1 click on site a it take the visitor that site
but in ie ( i hate it but most visitor still uses :mad: ) when i move my curser on site a the arrow goes and the one comes like this ( I ) and when click on site a nothing happens.
i read about pplz make this with jawa or css but i dont want em so is there a way to do this please.
thx for read
regards
Corey Bryant
Mar 6th 2005, 8:50 pm
Depending on what you want, try:
<script language="JavaScript" type="text/javascript">
<!--
function go1(){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
}
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
document.write('<form name="selecter1"><select name="select1" size=1>');
document.write('<option value=none>Select your destination');
document.write('<option value=none>--------------------');
document.write('<option value="http://www.example.com">Example');
document.write('</select>');
document.write('<input type="button" value="Go" onclick="go1()">');
document.write('</form>');
// end hiding contents -->
</script>
or
<script language="JavaScript" type="text/javascript">
<!--
function go1(){
if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
}
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
document.write('<form name="selecter1"><select name="select1" size=1 onchange="go1()">');
document.write('<option value=none>Select your destination');
document.write('<option value=none>--------------------');
document.write('<option value="http://www.example.com">Example');
document.write('</select>');
document.write('</form>');
// end hiding contents -->
</script>
old1
Mar 7th 2005, 11:33 am
hey thx for answer but as i said i would prefer another way then jawa script if possible even i will try to integrate that code in php :confused:
Corey Bryant
Mar 7th 2005, 12:54 pm
Are you wanting a drop down or a menu - like www.udm4.com?
old1
Mar 7th 2005, 3:32 pm
hello ty for trying help me
my english not well so i having problems about tellin what im thinkin :(
i dont want a drop down menu but i want a drop down thing and something like text area ok ill try to explain better
for example when you sign up a site in where are you from ( counrty option ) you see all contries in the world ( with a scroll bar coz its too long )
the first thing i wanna try a drop down thing like that which i can setup after 5 lines it shows a scrollbar )
the second thing i want to try is a text area which there are links in it with scroll bar it can be a go button near it when i click on a site it take me there .
if you can try the code which i gave at my first post may be you can understand me better
thanks again
regards
Corey Bryant
Mar 7th 2005, 3:38 pm
Do you have a website as an example?
old1
Mar 7th 2005, 4:17 pm
yes i have a website but i cant show how it looks coz didnt upload it but i setup 2 screenshots at http://www.geocities.com/xfiles0066 for you to see what i mean
small screenshot is about what ia want looks like a test box and when i hit on site 1 it will take me there
big screenshot is about drop down but i want it with scrollbar for example show after 5 lines( coz i can have 150 site may be and would look terrible to show all lines without scrollbar .it can be a go button near it or can automaticly go to site i click on it .
hope this help :(
regards
Corey Bryant
Mar 7th 2005, 4:27 pm
That is just a regular drop down field. It is an input field so, you can put 150 options in it and then the browser will show the scrollbar. Something like this contact form (http://www.comparemaps.com/merchant_account/offshore/world/contact.asp) where all the countries are listed?
old1
Mar 7th 2005, 4:47 pm
ya its answer of my second question and i need a code for it which not a jawa script can you help me about it ? or even for my first question ( first screenshot)
thanks again
Corey Bryant
Mar 7th 2005, 4:50 pm
Well from what I can tell - you are trying to do basic HTML? Something like the Simple drop down box (http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2), right?
old1
Mar 7th 2005, 5:17 pm
i found that addy from a google search also and tryed but didnt wanna type all my 150 links in it coz couldnt see a scrollar bar i wanna setup the scroller bar like after 5- 10 sites
oh btw did you tryed to see my code which i type at my first post of this thread at a page for se how it looks like ?
i sorry again im not good at coding :(
J.D.
Mar 7th 2005, 5:18 pm
Well from what I can tell - you are trying to do basic HTML? Something like the Simple drop down box (http://www.w3schools.com/html/tryit.asp?filename=tryhtml_select2), right?I think he's trying to make a combo box into a menu-like collection of links (there's href in the initial example).
old1, according to the HTML spec, you can't put <a> inside an attribute, you can't put it inside <option> and you can't put it inside <select>. In other words, all these examples show invalid HTML:
<select>
<option><a href="...">link 1</a></option>
<option><a href="...">link 2</a></option>
</select>
<select>
<a href="..."><option>link 1</option></a>
<a href="..."><option>link 2</option></a>
</select>
<select>
<option value="<a href=...>link 1</a>">link1</option>
<option value="<a href=...>link 1</a>">link2</option>
</select>
If you want a combo box to behave this way, you need to use JS, as Corey showed you.
J.D.
Corey Bryant
Mar 7th 2005, 5:22 pm
Yes I tried it - but I am not clear on what you want - if it is a simple HTML dropdown, just create it & do not worry about the 150 options. The browser will create the scrollbar for you.
old1
Mar 7th 2005, 5:32 pm
ok thx jd and corey
i was tryin to integrate that code to a php nuke ( not in a html site) but thanks again for try to help me :)
peace
old1
Aug 21st 2005, 3:39 pm
old man is back :)
i reopen my old folders now this time ill try to be more clear about what i need
what i want is called is a combo box like the one seen at this addy
http://www.geocities.com/xfiles0066/
i have this code and tons more <input type=\"button\" Value=\"8 Ball Nightmare\" ONCLICK=\"window.open('http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1','RoomName', 'toolbar=no,top=2,left=2,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=786,height=520')\">
all combo box has codes like simular the code below ( thats where i http:////us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/102.gif)<select name=\"menu\" onChange=\"location=document.dropdown.menu.options[document.dropdown.menu.selectedIndex].value;\" value=\"GO\" size=\"$menu3\">
now my problem is i cant integrate my first code to any combo box.
in my first code when click on link it opens that link in a new window ( sizes there ) without any icon,tab at that browser window
i dont want to have a GO button i want when my visitor hit on that link in combo box it opens that pop window automaticly
i want it shows only 5 links out of tons and visitors scrool down or up for chose :(
i even not sure if this possible but if someone can try to help me appreciate
coz i really stuck
Regards
Macbert
Aug 22nd 2005, 10:28 am
This should work, if I understood correctly what you're trying to accomplish.
<script type="text/javascript">
function popup(url) {
menu = document.forms[0].menu;
url = menu.options[menu.selectedIndex].value;
if (url)
window.open(url, '', 'toolbar=no,top=2,left=2,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=786,height=520');
}
</script>
<form>
<select name="menu" onChange="popup()" size="5">
<option value="http://someurl.com">Some URL</option>
<option value="http://example.com">Example</option>
<option value="http://acme.com">Acme</option>
<option value="http://acme.com">Acme 1</option>
<option value="http://acme.com">Acme 2</option>
<option value="http://acme.com">Acme 3</option>
<option value="http://acme.com">Acme 4</option>
<option value="http://acme.com">Acme 5</option>
</select>
</form>
You can of course generate the option tags in PHP by looping through your values and printing out the option tag where the value and label strings are replaced with suitable PHP variables.
old1
Aug 22nd 2005, 2:04 pm
hello ty for answer
i tryed this and no works again :( .
<form>
<select name=\"menu\" onChange=\"popup()\" size=\"5\">
<option value=\"http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1'\">Some URL</option>
<option value=\"http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1\">Example</option>
<option value=\"http://acme.com\">Acme</option>
<option value=\"http://acme.com\">Acme 1</option>
<option value=\"http://acme.com\">Acme 2</option>
<option value=\"http://acme.com\">Acme 3</option>
<option value=\"http://acme.com\">Acme 4</option>
<option value=\"http://acme.com\">Acme 5</option>
</select>
</form>
i was thinkin to make it work without jawa but i see you make it a jawa so i feel i can show you the jawa i didnt used.
this is the orijinal jawa they used ( old one but still works )
<SCRIPT language=javascript>
<!--
function initialize() {
this.name = "yahoo_games_home";
}
function lobbyopen(name) {
var res = document.resolution.res;
var small;
if (res.value == "small") {
dms = "height=425,width=620,";
small = "&small=yes";
} else {
dms = "height=520,width=786,";
small = "";
}
window.open("http://games.yahoo.com/games/ante?room="+name+"&prof_id="+"chat_pf_1", name,
"top=2,left=2,"+dms+",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1");
return false;
}
initialize();
-->
</SCRIPT>
and this is the code line which uses that jawa script
<a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
as you see this is used basic link
this is an example page which you can see and the source
http://games.amishdonkey.com/pool/
this is the link where you can see the latest orijinal code ( if you have a Yahoo id )
http://games.yahoo.com/games/login2?page=pl
at this pages you ll see tons of rooms links and what im trying is to collect them in combo box instead lots of pages
Thanks for the answer
Macbert
Aug 22nd 2005, 2:23 pm
There's no way (at least that i know of) of opening the kind of popup window that you're using without using javascript.
Correct me if I'm wrong, but it seems that basically you just want to get an independently scrollable list of links so that a user doesn't need to scroll the whole page.
You can do this with an select list and javascript, but that requires you to change all your links to option tags. An easier way in your specific situation would be to enclose the link list in a div and specify the overflow attribute to auto. That way you get the scrollbars and you can keep the links untouched. How cool is that? :cool:
Here's an example (the links are taken from your source):
<div style="overflow:auto;height:90px;width:400px">
<a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
<a href="#here" onclick='return lobbyopen("pool_19_r");'>Afraid to Lose</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_d");'>Alien</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_7");'>Alive</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_h");'>Alive And Kicking</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_1");'>All Right Now</a><br>
</div>
Just change the width and height attributes to suite your needs.
old1
Aug 22nd 2005, 2:49 pm
ty for answer but :(
below link example need that jawa applet to open (the one i paste at last post)
<a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
and i tryed your example without jawa and with jawa still no works
plus at your example i didnt get a combo box :(
Macbert
Aug 22nd 2005, 3:08 pm
I took your source and made the necessary changes to it. Check the HTML file attached (had to zip it because of size limitations).
In the example file, all the links still work and you get a "combo boxish" functionality. Is this what you are looking for? If not, try to explain what is wrong or missing :)
By the way, what browser are you using?
old1
Aug 22nd 2005, 3:21 pm
im totally lost lol even i already losted coz i suck at coding
i add screenshots
1- thats lookin of the last code of yours with firefox1.0.6 and ie 6 ( they same )
2- your test.html how looks in firefox1.0.6
3- your test.html how looks in ie 6
Macbert
Aug 22nd 2005, 3:45 pm
That looks pretty much as I expected it to look :)
Firefox wraps the links, but that can easily be fixed by adding a width attribute to the div.
The question is: is that the way you want it to look and behave, or is there something I missed? :rolleyes:
old1
Aug 22nd 2005, 4:07 pm
lol it works well on your test.html page but not at my site
here is what i have at least so may be you see what im doing wrong :(
<SCRIPT language=javascript>
<!--
function initialize() {
this.name = "yahoo_games_home";
}
function lobbyopen(name) {
var res = document.resolution.res;
var small;
if (res.value == "small") {
dms = "height=425,width=620,";
small = "&small=yes";
} else {
dms = "height=520,width=786,";
small = "";
}
window.open("http://games.yahoo.com/games/ante?room="+name+"&prof_id="+"chat_pf_1", name,
"top=2,left=2,"+dms+",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1");
return false;
}
initialize();
-->
</SCRIPT>
<?php
echo"
<div style=\"overflow:auto;height:90px;width:400px\">
<a href=\"#here\" onclick='return lobbyopen(\"pool_105\");'>Achilles Last Stand</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_19_r\");'>Afraid to Lose</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_d\");'>Alien</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_7\");'>Alive</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_h\");'>Alive And Kicking</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_1\");'>All Right Now</a><br>
</div>
";
?>
* i keep jawa out of my php tags coz i have a script which works like that
* i removed some code parts coz it is about php nuke
* at your example all boxes shows 13 lines where do i setup it for show 5 or may be 7 lines
* also is that possible i dont have a scroll bar under combo box
thank you for been patiance to me appreciated :)
Macbert
Aug 22nd 2005, 4:33 pm
The javascript fails because it tries to access a form named "resolution" which decides what size popup will be used. Just insert the following code anywhere in the body element and I'm sure it will work. :cool:
<form name=resolution action="http://play.yahoo.com/games/" method=post>
<select name=res>
<option value="large" selected>Large 800X600</option>
<option value="small">Small 640x480</option>
</select>
</form>
at your example all boxes shows 13 lines where do i setup it for show 5 or may be 7 lines
You can change the "height:90px" part in the div. Just experiment with different pixel values, like 50px, and I'm sure you'll get a hang of it ;)
also is that possible i dont have a scroll bar under combo box
I take it you mean the horizontal scrollbar. Try different values for the "width:400px", it works the same way as the height.
thank you for been patiance to me appreciated
No problem at all... Glad I can help :D
old1
Aug 22nd 2005, 5:50 pm
man im gonna crash the screen in a min
i have this now ( deleted jawascript ) see the attacment file how it looks plz
echo"
<form name=resolution action=\"http://play.yahoo.com/games\" method=post>
<select name=res>
<option value=\"large\" selected>Large 800X600</option>
<option value=\"small\">Small 640x480</option>
</select>
</form>
<div style=\"overflow:auto;height:90px;width:400px\">
<a href=\"#here\" onclick='return lobbyopen(\"pool_105\");'>Achilles Last Stand</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_19_r\");'>Afraid to Lose</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_d\");'>Alien</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_7\");'>Alive</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_h\");'>Alive And Kicking</a><br>
<a href=\"#here\" onclick='return lobbyopen(\"pool_51_1\");'>All Right Now</a><br>
</div>
";
old1
Aug 22nd 2005, 6:25 pm
ok i copied all the test.html to my page and cleaning the code looks like i can do it i will let you know how it went coz its 4.25 am here
ty
Macbert
Aug 22nd 2005, 6:31 pm
No worries, you'll get it working ;)
Forget what I said before about the form. Lets study the fully working example PHP file I attached to this post. I made the code a bit more readable, but it still does the some thing as before.
I'll try to break the code into pieces so that it's easier to understand why all the elements are needed.
Javascript part:
var name = "yahoo_games_home";
function lobbyopen(name) {
var res = "small";
/* Uncomment this if the users need to be able to change the resolution */
// var res = document.resolution.res;
if (res.value == "small") {
dms = "height=425,width=620,";
} else {
dms = "height=520,width=786,";
}
window.open("http://games.yahoo.com/games/ante?room=" + name + "&prof_id="+"chat_pf_1", name, "top=2,left=2," + dms + ",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1");
return false;
}
The javascript is responsible for opening the popup windows. The popup windows won't open if this code is removed.
var name = "yahoo_games_home";
This part tells the popup opener which game room to open.
function lobbyopen(name) {
The lobbyopen function is called everytime a link is clicked. It takes care of actually opening the popup.
var res = "small";
This just tells that we want a smaller popup. Change the "small" part to anything else, i.e. "big", if you'd prefer a bigger one.
window.open("http://games.yahoo.com/games/ante?room=" + name + "&prof_id="+"chat_pf_1", name, "top=2,left=2," + dms + ",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1");
This is finally the code that defines the popup window, gives it some default values and opens it. You don't need to worry about this part in detail, but if you're interested in what all that text does, you could try searching google for "window.open javascript".
The HTML code:
<div style="overflow:auto;height:90px;width:400px">
<a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
<a href="#here" onclick='return lobbyopen("pool_19_r");'>Afraid to Lose</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_d");'>Alien</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_7");'>Alive</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_h");'>Alive And Kicking</a><br>
<a href="#here" onclick='return lobbyopen("pool_51_1");'>All Right Now</a><br>
</div>
This wraps all the links that you want in a scrollable div. The lobbyopen javascript function is being called everytime a link is pressed. That's why the links don't work if the javascript is missing.
<div style="overflow:auto;height:90px;width:400px">
The height and width define the size of the div. Scrollbars become visible if the text doesn't fit into the div.
old1
Aug 22nd 2005, 6:56 pm
Macbert Your da Man http://us.i1.yimg.com/us.yimg.com/i/mesg/emoticons7/6.gif
tested with ie and fireworks and thats what i want, now i can play with it with my superior coding knowledge :D and show you the results
thank you very very very much for been patience
i also want to thanks all the members who tryed to help me at this thread
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.