我现在有2个页面,Login.html和Welcome.html。
然后我单独写了一个JS的文件,在JS文件中定义了函数,目的是为了将Login所输入的一个值到Welcome中来显示,
现在我在Login输入的值已经传到了Welcome页面,请问怎么用JS定义函数的方法将传到Welcome页面的值取出来呢?
<input type="image" src="E:/Web/QQ/image/returnSet.jpg" onClick="returnLg()" />还有问下怎么在 <input>标签里面写那取出来的值?

解决方案 »

  1.   

    用jQuery可以实现:/*
    描述:
    加载并执行一个 JS 文件。
    *///jQuery 代码:
    $.ajax({
      type: "GET",
      url: "test.js",
      dataType: "script"
    });
      

  2.   


    jQuery.getScript("http://dev.jquery.com/view/trunk/plugins/color/jquery.color.js", function(){
      $("#go").click(function(){
        $(".block").animate( { backgroundColor: 'pink' }, 1000)
          .animate( { backgroundColor: 'blue' }, 1000);
      });
    });jQuery手册中有Ajax事件实例:
    http://download.csdn.net/detail/dmtnewtons/4126497
      

  3.   

    这个问题我做过,
    直接给你看代码吧如果你的js里面是这样跳转的:window.location.href='welcome.jsp?param=xxxx';
    那么你在welcome.jsp里面写一个js方法 a()

    body onload='a()'
    function a(){
       var url=window.location.href.toString(); //这个方法可以取出你的url字符串
       alert(url);//
       //如果你想取出指定参数,就截取字符串吧,具体自己想办法
       var pram = url.substr(xx,xxx);
       //如果你想把他显示在input里面 ,事先给input加一个id='b',document.getElementById('b').innerHTML=pram;//给标签赋值
    }
      

  4.   


    是直接写  <input type=“text” value=“document.getElementById('weltext').innerHTML”>
    ???