如何在html中单击一个按钮将图像和值传递到另一个html页面 [英] How to pass image and values to another html page at one button click in html
本文介绍了如何在html中单击一个按钮将图像和值传递到另一个html页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的第一个html页面
This is in my first html page
<form type=get action="DisplayProduct.html">
<pre>Quantity : <input name="passquan" id="Quantity" class="myinput" type="textbox" value="" readonly /></pre>
<pre>Name : <input name="passname" id="Name" class="myinput1" type="textbox" value="" readonly /></pre>
<pre>Price : <input name="passprice" id="Price" class="myinput2" type="textbox" value="" readonly /></pre>
<A HREF="DisplayProduct.html?Australia.png">
<img border="0" src="Australia.png" width="50" height="50"></A>
<input type=submit value="View Details">
</form>
和我的DisplayProduct.html是,
and my DisplayProduct.html is,
<html>
<head>
<title> Separate Product </title>
<script language="JavaScript" type="text/javascript">
if (location.search)
{
var image_filename = location.search.substring(1)
//document.write('<IMG SRC="' + image_filename + '">')
document.write('<IMG "STYLE="position:absolute TOP:200px LEFT:300px" SRC="' + image_filename + '">')
}
</script>
<script LANGUAGE="JavaScript">
function getParams(){
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1) {
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i<pairs.length; i++){
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}
params = getParams();
quantity = unescape(params["passquan"]);
name = unescape(params["passname"]);
price = unescape(params["passprice"]);
document.write("Quantity = " + quantity + "<br>");
document.write("Product Name = " + name + "<br>");
document.write("Product Price = " + price + "<br>");
</script>
</head>
<body>
<a href="indexcornew.html"> Back </a>
</body>
</html>
我可以单独传递值和图像。但是如何将图像和值同时传递到另一个html页面。
i am able to pass values and image separately. but how to pass both images and values at the same time to another html page.
推荐答案
看看这个
使用表单传递变量 [ ^ ]
这篇关于如何在html中单击一个按钮将图像和值传递到另一个html页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文