View Full Version : html code needed
queerfm
06-28-2006, 07:57 PM
Hi i was wondering is there any way that i can have a text field that when some one types in a stock market code for e.g. google = GOOG it goes to that page which is goog.html
Please Help
<form action="" onsubmit="this.action=this.elements[0].value.toLowerCase()+".html";return true;">
<input type="text">
<input type="submit" value="Go">
</form>
queerfm
07-06-2006, 11:55 AM
Hi that code is not working i have setted it up to test it at http://www.queerfm.net/stock/test.html and i typed in the following goog i also set up a page in the same file called goog.html however it does not work it only brings up this http://www.queerfm.net/stock/test.html?
Whoops, sorry, I used double quotes inside double quotes.
onsubmit="this.action=this.elements[0].value.toLowerCase()+'.html';return true;"
queerfm
07-06-2006, 01:23 PM
got one more Question how do i make go to another folder like www.queerfm.net/stockwatch/goog.html
Ill be setting up hosting for the domainname http://www.queerfmstocks.com
BLiZZaRD
07-06-2006, 01:44 PM
Are you going to list every stock quote avaliable?
It would seem to me to be easier (if you are NOT) to use a form with a drop down menu, or check boxes for the stocks you ARE listing, let the visitor choose from your selections, instead of entering their own.
For many reasons,
first, you can set each to go to a specific URL
second, you don't have to use redirect, worry about typos and error pages, etc
and you make it simple on the user, they can choose from a list instead of looking up the stock name and coming back to your site, etc..
onsubmit="this.action='stockwatch/'+this.elements[0].value.toLowerCase()+'.html';return true;"
BLiZZaRD is correct, though.
queerfm
07-06-2006, 01:47 PM
well the way we are doing it is both ways i need this code for people to use our website on there desktop.
Also the drop down box we are doing the demo site called BETA 0.0.1 will be up and running soon it will only have the home page.
But you will be able to see what we are doing.
queerfm
07-06-2006, 01:49 PM
oh and that code works great thank i was tring to figgr it out and i could not work it out now i get it
queerfm
07-06-2006, 01:51 PM
one last think is there away i can get it to do this lets say they type in google it takes them to goog.html
also if they type something like yah and i don't have that code that it takes them to a contact page so they can contact me.?
BLiZZaRD
07-06-2006, 01:57 PM
I think you need to start looking into PHP for all these what ifs..
You can set many many variables to check when submitted.
To answer simply though... yes you can.
Twey will know better on the goole to goog part, but for the yah not existing one, just make an error page... call it something like notyet.html when a name is put in that doesn't exist, have it redirect to that page which contains a contact form.
<script type="text/javascript">
function setStockAction(frm) {
var db = {
google : "goog.html",
queerfm : "quee.html"
};
if(db[frm.elements[0].value.toLowerCase()])
frm.action = 'stockwatch/' + db[frm.elements[0].value.toLowerCase()];
else
frm.action = 'contact.html';
return true;
}
</script>
<form action="" onsubmit="return setStockAction(this);">
<input type="text">
<input type="submit" value="Go">
</form>Something like that? It does require you to enter all the values, though, in the form
value : "page.html".
queerfm
07-06-2006, 04:53 PM
is this php or html
I just tested it, it could work for. i.e. for people that don't know the code they could just type in the company name i am also thinking if i put goog like you have done here
google : "goog.html",
but instead also like this so it looks like this
google : "goog.html",
goog : "goog.html,
i think that would work???
queerfm
07-06-2006, 05:00 PM
can i also get the code to get rid or . signs? for e.g some asx codes have . in them how would that work?
i think that would work???Yep.
can i also get the code to get rid or . signs? for e.g some asx codes have . in them how would that work?
if(db[frm.elements[0].value.toLowerCase().replace(/\./g, '')])
queerfm
07-06-2006, 05:23 PM
its not working here is the script what did i do wrong
<script type="text/javascript">
function setStockAction(frm) {
var db = {
google : "goog.html",
goog : "goog.html",
google.com : "goog.html",
queerfm : "quee.html"
};
if(db[frm.elements[0].value.toLowerCase().replace(/\./g, '')])
frm.action = 'stockwatch/' + db[frm.elements[0].value.toLowerCase()];
else
frm.action = 'contact.html';
return true;
}
</script>
<form action="" onsubmit="return setStockAction(this);">
please type in Stock market code, business name or website.<input type="text">
<input type="submit" value="Go">
</form>
help
BLiZZaRD
07-06-2006, 05:25 PM
is this php or html
Neither, it's javascript :p ..... <script type="text/javascript">
I just tested it, it could work for. i.e. for people that don't know the code they could just type in the company name i am also thinking if i put goog like you have done here
google : "goog.html",
but instead also like this so it looks like this
google : "goog.html",
goog : "goog.html,
i think that would work???
Thats what Twey was saying.. you HAVE to enter every single choice the user will make, so you will have to manually add
google : "goog.html
goog : "goog.html"
goo : "goog.html"
yahoo : "yahoo.html"
yah : "yahoo.html
and on and on and on and on...
Which is precisly why I suggested the checkbox or drop down option. Then you only have to do it once for each one :p
queerfm
07-06-2006, 05:31 PM
ok sorry i just eally understaood what you where answering to yes i under stand but i don't mind putting it in. thats the fun part
queerfm
07-07-2006, 03:21 PM
Also how do they give the search button a background colour thanks
Also how do they give the search button a background colour thanksThe only reliable way is to use images to create a button effect.
queerfm
07-07-2006, 04:17 PM
sorry to ask this but how? i know how to make a go button but how would i place it where the search button would go sorry to be a bother but i don't know how to do this.
This will be the first site i have really done every thing by my self so i must thank you all for helping me out also i need to ask you Twey can i use your name for our Thanks page? if you have a website i am willing to list it on the site.
Instead of a submit button, yes?
<input type="image" src="button-normal.png" onmousedown="this.src='button-pressed.png';" onmouseup="this.src='button-normal.png';">Two images: button-normal.png (the normal button) and button-pressed.png (the button in a "pressed" state).
i need to ask you Twey can i use your name for our Thanks page? if you have a website i am willing to list it on the site.Of course, if you want to. My site (the latest in a short line) is http://www.twey.co.uk/.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.