[HTML/Javascript] URL, Concatenation and Variables.
4 posters
Page 1 of 1
[HTML/Javascript] URL, Concatenation and Variables.
Hi, i'm not sure if this is the right forum, but it looks the best to post this in.
I'm trying to make a widget that incorporates this code, but this is the first time i am using HTML/Javascript, i have knowledge of basic programming and i'm not use to the syntax of these two languages.
Here is my code:
Can someone fix it up, i want it to get data from the combo and textbox then insert it into a url, example: http:// [data from combobox here] .thecbl.net/ [data from textbox here] /, then go to that url.
Keep in mind i want this in a widget, if possible, so i can display it on my clan page.
I'm trying to make a widget that incorporates this code, but this is the first time i am using HTML/Javascript, i have knowledge of basic programming and i'm not use to the syntax of these two languages.
Here is my code:
- Code:
<html>
<head>
<script type="text/javascript">
function go()
{
var searchtype = document.cblsearch.searchtype;
var searchname = document.cblsearch.searchname;
var searchurl = "http://"+searchtype+".thecbl.net/"+searchname+".html";
searchtype = document.cblsearch.searchtype;
searchname = document.cblsearch.searchname;
searchurl = "http://"+searchtype+".thecbl.net/"+searchname+".html";
window.location="searchurl";
}
</script>
</head>
<body>
<FORM NAME="cblsearch">
<br>
<select name="searchtype" size="1">
<option value="player">Player</option>
<option value="clan">Clan</option>
</select>
 <input type="text" name="searchname" size="15">
</br>
<br><INPUT TYPE="button" VALUE="Search" onclick="go()"></br>
</FORM>
</body>
</html>
Can someone fix it up, i want it to get data from the combo and textbox then insert it into a url, example: http:// [data from combobox here] .thecbl.net/ [data from textbox here] /, then go to that url.
Keep in mind i want this in a widget, if possible, so i can display it on my clan page.
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
Re: [HTML/Javascript] URL, Concatenation and Variables.
You would need a database to do this, searching for names ect.
We dont have access to forum database.
The only way i think you could do this for example. Build a wiget with notepad or wordpad with a list of name built iin which would pull out the names.
You would have to use a program lang VB you should know what i mean if you have programing exprence.
Good luck with this one.
But even then it might not work on the forum.
Brenda
We dont have access to forum database.
The only way i think you could do this for example. Build a wiget with notepad or wordpad with a list of name built iin which would pull out the names.
You would have to use a program lang VB you should know what i mean if you have programing exprence.
Good luck with this one.
But even then it might not work on the forum.
Brenda
Re: [HTML/Javascript] URL, Concatenation and Variables.
I can easily make this in VB.
But i want a widget, and i don't think you understand what i want.
It will access another site, i just need to be able to modify the site URL, using user input from a textbox and combobox.
But i want a widget, and i don't think you understand what i want.
It will access another site, i just need to be able to modify the site URL, using user input from a textbox and combobox.
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
Re: [HTML/Javascript] URL, Concatenation and Variables.
So the combobox when clicking on it will redirect you to a website.
Also if you type a entry it will also take you to a site. is that what you mean.
Brenda
Also if you type a entry it will also take you to a site. is that what you mean.
Brenda
Re: [HTML/Javascript] URL, Concatenation and Variables.
the combobox has 2 options so it is either on one of them, the textbox will have anything.
then when a button is clicked it will go to a url. that url is modified from the data from the combobox and textbox.
example:
combobox [ player]
textbox [playername]
so the button is clicked
it will go to url
http://[player].thecbl.net/[playername]/
like that.
then when a button is clicked it will go to a url. that url is modified from the data from the combobox and textbox.
example:
combobox [ player]
textbox [playername]
so the button is clicked
it will go to url
http://[player].thecbl.net/[playername]/
like that.
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
Re: [HTML/Javascript] URL, Concatenation and Variables.
These use jQuery right?
the HTML for a line break is either <br> or <br/> for XHTML its <br /> but either way its definitely not what you were doing </br>
- Code:
<html>
<head>
<script type="text/javascript">
function go()
{
window.location="http://"+$('select[name=searchtype]').val()+".thecbl.net/"+$('input[name=searchname]').val()+"/";
}
</script>
</head>
<body>
<FORM NAME="cblsearch">
<br />
<select name="searchtype" size="1">
<option value="player">Player</option>
<option value="clan">Clan</option>
</select>
 <input type="text" name="searchname" size="15">
<br />
<br /><INPUT TYPE="button" VALUE="Search" onclick="go()"><br />
</FORM>
</body>
</html>
the HTML for a line break is either <br> or <br/> for XHTML its <br /> but either way its definitely not what you were doing </br>
Last edited by Quozzo on Sat Apr 02 2011, 01:46; edited 1 time in total (Reason for editing : HTML was messsssy!)
Quozzo- New Member
- Posts : 2
Reputation : 10
Language : English
Re: [HTML/Javascript] URL, Concatenation and Variables.
it doesn't seem to work.
i tried to test it by making a html file and when i click search nothing happens.
i tried to test it by making a html file and when i click search nothing happens.
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
Re: [HTML/Javascript] URL, Concatenation and Variables.
You probably havn't got jQuery on the board, try this instead
- Code:
function go()
{
var option=document.cblsearch.searchtype.options[document.cblsearch.searchtype.selectedIndex].value
window.location= "http://" + option + ".thecbl.net/" + document.cblsearch.searchname.value
}
Quozzo- New Member
- Posts : 2
Reputation : 10
Language : English
Re: [HTML/Javascript] URL, Concatenation and Variables.
It works perfectly!
Thanks Quozzo!
Thanks Quozzo!
-AusKinetic-- Forumember
- Posts : 29
Reputation : 0
Language : Australia
Re: [HTML/Javascript] URL, Concatenation and Variables.
Since this thread appears to be solved, I will lock this thread and mark it as solved.
![[HTML/Javascript] URL, Concatenation and Variables. 2j4t5a8](https://2img.net/h/oi35.tinypic.com/2j4t5a8.png)
Sanket
![[HTML/Javascript] URL, Concatenation and Variables. 2j4t5a8](https://2img.net/h/oi35.tinypic.com/2j4t5a8.png)
Sanket

Sanket- ForumGuru
-
Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai

» Displaying variables in HTML templates
» Forum variables don't convert to HTML?
» Javascript/Html uploading
» What's That "Javascript&HTML"?
» Can someone help me with Javascript/HTML coding?
» Forum variables don't convert to HTML?
» Javascript/Html uploading
» What's That "Javascript&HTML"?
» Can someone help me with Javascript/HTML coding?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum