通过JavaScript将函数输出到不同的HTML页面
我有一个函数,它以文本形式从我页面上的选择中获取所有选择的值。我需要一个按钮,点击打开新的“空白”与不同的HTML页面,并把从我的selectgetting功能的输出到新页面上的文本框 如何通过JavaScript实现这一点通过JavaScript将函数输出到不同的HTML页面,javascript,html,text,output,Javascript,Html,Text,Output,我有一个函数,它以文本形式从我页面上的选择中获取所有选择的值。我需要一个按钮,点击打开新的“空白”与不同的HTML页面,并把从我的selectgetting功能的输出到新页面上的文本框 如何通过JavaScript实现这一点 var w = window.open('form.html', 'blank', 'scrollbars=yes,toolbar=no,width=500,height=950') var box = w.getElementById('input_16'); box.v
var w = window.open('form.html', 'blank', 'scrollbars=yes,toolbar=no,width=500,height=950')
var box = w.getElementById('input_16');
box.value = "bodystyle: " + body + "<br>" + "color: " + color;
w.focus();
var w=window.open('form.html','blank','scrollbars=yes,toolbar=no,width=500,height=950'))
变量框=w.getElementById('input_16');
box.value=“bodystyle:“+body+”
“+”颜色:“+color;
w、 焦点();
这应该适用于更改框文本,不是吗?我首先在新窗口中打开第二个HTML,然后通过id获取它的文本框并更改它的值。为什么它不起作用
感谢您将下拉值传递到_空白页,您可以将其作为参数添加到URL中。 他们用Javascript从下一页的url中读取它,并将它放在您的文本框中 因此: 1.读取值
2.添加到URL
3.从url读取值
4.向文本框添加值 祝你好运 编辑:这是1和2
<div>
<input type="button" value="click me" />
<input type="text" id="input_16" value="input16" />
</div>
<script>
$(function(){ $("input[type='button']").on('click',function(){ var val = document.getElementById('input_16').value; window.open('form.html¶m1='+val, '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes') })})
</script>
$(function(){$(“input[type='button'])。on('click',function(){var val=document.getElementById('input_16')。value;window.open('form.html¶m1='+val','u blank','location=yes,height=570,width=520,scrollbars=yes,status=yes'))
你试过什么?您是否尝试过使用localstorage、Cookie或查询字符串?没有尝试任何操作:D因为im JS noob。写在这里获取一些提示如何做可能最简单的方法是将querystring参数附加到用于新页面的url,然后在新页面中查询该参数以填充文本输入。