Reputation: 157
I am new to web programming,learning VBScript.I want to display few text boxes in a form using HTML tags.But when creating text box using this statement - document.write("input type="text"") something is going wrong and nothing is displayed in web page.I know I can create the text box using HTML outside of script block,but can we do it in document.write?
Upvotes: 1
Views: 5037
Reputation: 661
Always, use two quotation marks ("") within a string to represent a single quotation mark.
Example String - "Alex : "how are you", he said"
Wscript.Echo "Alex : ""how are you"", he said" 'Using double quotes
Same is the case when you try to insert html tags in a wbscript. Hope this helps.
Upvotes: 0
Reputation: 42192
You can do it like this
<script language=vbscript>
document.write("input type='text'") '=> input type="text"
document.write("input type=""text""") '=> input type="text"
'as suggested in other answer won't work
'document.write("input type=\"text\"")
'document.write("input type='text'")
</script>
Upvotes: 1
Reputation: 187
either try 1 of the 2 following options:
You are passing your doc.write function its parameter using double quotes, therefore you either have to escape them if you use double quotes again, or use single quotes around 'text'
Upvotes: 0