简体   繁体   English

任何人都可以制作文本(""); 功能?

[英]Can anyone make a text(""); function?

I need help making a function that works like document.write("");我需要帮助制作一个类似于document.write("");的函数document.write(""); I need it to be called by using text("");我需要使用text("");来调用它text(""); instead of printing out document.write("");而不是打印出document.write(""); every single time.每一次。 I just want to be able to use something other than document.write("");我只想能够使用document.write("");以外的东西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?" PS真正的问题是:“任何人都可以帮助制作text("");功能?”

Should be应该

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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