i designed 2 pages using html,here when we select checkbox in one page ,then i have to display some text in another page .how can i do this one.can any one help me.
the code in first page is
<p style="margin: 25px 0px 0px 10px; font:13px verdana;">would you like to show others to copy ?</p>
<input type="checkbox" name="remember" id="remember1" style="border: 0px;padding: 10px; margin-left:125px;font-size:12px;" />Yes<a href="#"></a><br/>
<input type="checkbox" name="remember" id="remember2" style="border: 0px;padding: 10px; margin-left:125px;font-size:12px;" />No<a href="#"></a>
here,when i select yes in this ,i have to display text as "you have to show others" .and when i select no ,it has to display as "you dont have permission to show others" .
can anyone help me?
唯一的方法是制作表单,然后使用_POST或_GET并将其与服务器端语言(如PHP ASP等)一起发布到另一页中,因此,当用户提交表单时,是否要在另一页上显示该表单是。
You will have to post that value to your server with a form or AJAX. Then during the process write that value to database. So you will know which file/page/copy/whatever will be shown or not.
--
(ps if it is just for a single use, try to assign the value to session variable -just in case if you don't have a database.-)
First of all you may use type="radio" to avoid that yes and no get both selected:
<input onchange="setCookie('choice','yes');" type="radio" name="remember" id="remember1"
style="border: 0px;padding: 10px; margin-left:125px;font-size:12px;" />Yes<a href="#"></a><br/>
<input onchange="setCookie('choice','no');" type="radio" name="remember" id="remember2"
style="border: 0px;padding: 10px; margin-left:125px;font-size:12px;" />No<a href="#"></a>
Then you may use cookies to pass the choice from one page to another. In the page of the input's:
<script type="text/javascript">
// set default
document.getElementById("remember1").checked="true";
setCookie('choice','yes');
function setCookie(cookieName, cookieVal) {
//alert("setCookie "+cookieName+"="+cookieVal);
document.cookie=cookieName+"="+cookieVal;
}
</script>
And in the page where to recall the choice:
<script type="text/javascript">
function getCookie(cookieName) {
var cookies = document.cookie.split(";");
for(var i = 0; i<cookies.length; i++) {
var cookie = cookies[i].replace(/^\s+/, "");
var nameVal = cookie.split("=");
var name = nameVal[0];
var val = cookie.substr(name.length+1);
if(name==cookieName) return val;
}
return null;
}
alert(getCookie("choice"));
</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.