开发者

Using a value in HTML

开发者 https://www.devze.com 2023-03-10 08:39 出处:网络
<html> <head> <script type=\"text/vbscript\"> Function myFunction(tx) fname=InputBox(tx,,,700)
<html>
<head>
<script type="text/vbscript">

Function myFunction(tx)
fname=InputBox(tx,,,700)
document.getElementById("mySpan").innerHTML=fname
End Funct开发者_运维技巧ion

</script>
</head>
<body>


Email: <input 
 mail="email"
 type=text
 > <br/>
Username: <input
 user="user"
 type=text>
 <br/>
Password: <input
 pass="pass"
 type=password> <br/>
Submit: <input
 value="Submit"
 type=submit
 onclick="myFunction(<pass>)"
 >

<span id="mySpan"></span>
</body>
</html>

-- My function is supposed to open up an InputBox (using VBS) and display the password entered. Unfortuneatly, I have no clue how. How can I get the entered text from the input "password"?


Firstly, its not 'pass="pass"', its 'value="pass"'. Secondly, you need to set an id on your field: id="password". Then you can do this...

 MsgBox(document.getElementById("password").value);

Also, your HTML is non standards compliant, HTML tag attributes should always be enclosed by quotes, eg.

<input type="text" name="fname" id="fname" value="First Name">

There is no "mail" or "user" attribute either.


I haven't seen client side VB script in...forever.

Based on your sample, it looks like it uses a bit of JavaScript's syntax so you could try giving your input an ID and use what you did for the SPAN:

document.getElementById("IDofYourInput").value
0

精彩评论

暂无评论...
验证码 换一张
取 消