JS Help?

Axle12693

New Member
OK I want my web page to turn a string into a variable - like, if a user inputs the string "hello", i I want my web page to create a variable named hello. Is there a way to do this? Thx in advance.


EDIT:

OK it's been a couple hours since posting, and got no answer... seems to me it's not possible - at least not with just JavaScript. Is it possible to do this with another scripting language? VBScript? PHP? ASP? It has to be possible somehow, any modern-day processor should be able to handle this.
 
Last edited:

jnjc

New Member
This is an example of what (I think) you want to do using JS:

Code:
<html>

<head>
<script type="text/javascript">
function gettheValue() {
y = document.getElementById("var1").value;
alert(y);

}
</script>
</head>

<body>
<label for="var1">Enter your text:</label>
<input id="var1"/>
<button onclick="gettheValue();">Click Me</button>
</body>

</html>

HTH,
JC
 

emopoops

Banned
no just use a form
<input name="name" type="text"> then a submit button that kind of thing and then use u know the action to submit it to the new page which can even be the same page then be like oh do that one thing with _POST[name] =$name
that kind of thing make sure if ur using a databse then u need to prevent mysql injections with preg_replace and uh mysqlrealescape()
 
Top