简体   繁体   中英

Can anyone make a text(""); function?

I need help making a function that works like document.write(""); I need it to be called by using text(""); instead of printing out document.write(""); every single time. I just want to be able to use something other than document.write(""); every time. Here is what I have:

<script>
function text(a) {document.write("");}
text("Hi.");
</script>

But the function needs a parameter in the function to work. Can anyone help? PS The real question is: "Can anyone help with making a text(""); function?"

Should be

<script>
function text(a) {document.write(a);}
text("Hi.");
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM