S
Spizzat2
I've got a web page with some hidden elements that can be shown
through various methods. What I'd like is, when the user tries to copy
the visible stuff on the page, it doesn't copy the hidden stuff in
between. Is there a simple way to do this? I know I could move the
whole element using some DOM scripting, but I'd really like to do it
just using something similar to style.visibility=hidden.
Any suggestions?
Here's some basic code to tinker with:
<html>
<head>
<script type="text/Javascript">
var step = 0;
function test(elem){
elem = document.getElementById(elem);
if(step == 0){
elem.style.visibility = "visible";
document.getElementById("replace").innerHTML = "visibility:visible,
display:'' ";
step = 1;
}else if(step == 1){
elem.style.display = "";
document.getElementById("replace").innerHTML = "visibility:hidden;
display:'' ";
step = 2;
}else if(step == 2){
elem.style.visibility = "hidden";
document.getElementById("replace").innerHTML = "visibility:hidden;
display:none";
step = 3;
}else{
elem.style.display = "none";
document.getElementById("replace").innerHTML = "visibility:visible;
display:none";
step = 0;
}
}
</script>
</head>
<body>
Highlight the whole page (Ctrl + A), and paste it into notepad to see
under which conditions the second row shows up.
<table border="1">
<tr><td onclick="test('dktk')">Click here to make it <span
id="replace">visibility:visible, display:none</span></td></tr>
<tr><td id="dktk" style="display:none; visibility:hidden;">HHHHHH</
td></tr>
<tr><td>There are 2 rows above here</td></tr>
</body>
</html>
through various methods. What I'd like is, when the user tries to copy
the visible stuff on the page, it doesn't copy the hidden stuff in
between. Is there a simple way to do this? I know I could move the
whole element using some DOM scripting, but I'd really like to do it
just using something similar to style.visibility=hidden.
Any suggestions?
Here's some basic code to tinker with:
<html>
<head>
<script type="text/Javascript">
var step = 0;
function test(elem){
elem = document.getElementById(elem);
if(step == 0){
elem.style.visibility = "visible";
document.getElementById("replace").innerHTML = "visibility:visible,
display:'' ";
step = 1;
}else if(step == 1){
elem.style.display = "";
document.getElementById("replace").innerHTML = "visibility:hidden;
display:'' ";
step = 2;
}else if(step == 2){
elem.style.visibility = "hidden";
document.getElementById("replace").innerHTML = "visibility:hidden;
display:none";
step = 3;
}else{
elem.style.display = "none";
document.getElementById("replace").innerHTML = "visibility:visible;
display:none";
step = 0;
}
}
</script>
</head>
<body>
Highlight the whole page (Ctrl + A), and paste it into notepad to see
under which conditions the second row shows up.
<table border="1">
<tr><td onclick="test('dktk')">Click here to make it <span
id="replace">visibility:visible, display:none</span></td></tr>
<tr><td id="dktk" style="display:none; visibility:hidden;">HHHHHH</
td></tr>
<tr><td>There are 2 rows above here</td></tr>
</body>
</html>