以文本方式查看主题

-  计算机科学论坛  (http://bbs.xml.org.cn/index.asp)
--  『 SVG/GML/VRML/X3D/XAML 』  (http://bbs.xml.org.cn/list.asp?boardid=21)
----  选择可见元素的设置  (http://bbs.xml.org.cn/dispbbs.asp?boardid=21&rootid=&id=26330)


--  作者:卷积内核
--  发布时间:1/11/2006 10:49:00 AM

--  选择可见元素的设置
html源码:

<HTML>

  <HEAD>
    <META NAME="generator" CONTENT="Adobe GoLive 5">
    <TITLE>Tutorial - Printing</TITLE>
    <SCRIPT LANGUAGE="JavaScript" SRC="/svg/viewer/install/auto/svgcheck.js"></SCRIPT>
    <SCRIPT LANGUAGE="VBScript" SRC="/svg/viewer/install/auto/svgcheck.vbs"></SCRIPT>
    <CSACTIONS>
      <CSACTION NAME="B53DE4A211" CLASS="Netscape CSS Fix" TYPE="onload">
    </CSACTIONS>
    <CSACTIONITEM NAME="B53DE4A211"></CSACTIONITEM>
    <CSSCRIPTDICT>
      <SCRIPT><!--
CSStopExecution = false;
CSInit = new Array;
function CSScriptInit() {
if(typeof(skipPage) != "undefined") { if(skipPage) return; }
idxArray = new Array;
for(var i=0;i<CSInit.length;i++)
 idxArray[i] = i;
CSAction2(CSInit, idxArray);
}
CSStopExecution = false;

function CSAction(array) {
 return CSAction2(CSAct, array);
}
function CSAction2(fct, array) {
 var result;
 for (var i=0;i<array.length;i++) {
  if(CSStopExecution) return false;
  var actArray = fct[array[i]];
  if(actArray == null) return false;

  var tempArray = new Array;
  for(var j=1;j<actArray.length;j++) {
   if((actArray[j] != null) && (typeof(actArray[j]) == "object") && (actArray[j].length == 2)) {
    if(actArray[j][0] == "VAR") {
     tempArray[j] = CSStateArray[actArray[j][1]];
    }
    else {
     if(actArray[j][0] == "ACT") {
      tempArray[j] = CSAction(new Array(new String(actArray[j][1])));
     }
    else
     tempArray[j] = actArray[j];

    }
   }
   else
    tempArray[j] = actArray[j];
  }   
  result = actArray[0](tempArray);
 }
 return result;
}
CSAct = new Object;
function CSFixFct() {
 var d = document; var w = window;
 if (d.cs.csFix.w != w.innerWidth || d.cs.csFix.h != w.innerHeight) {
  d.location = d.location; }
}
function CSNSFix(action) {
 var d = document; var w = window;
 if ((navigator.appName == 'Netscape') && (parseInt(navigator.appVersion) == 4)) {
  if (typeof d.cs == 'undefined') {
   d.cs = new Object;
   d.cs.csFix = new Object;
  } else if (CSIsFrame (w) == true) CSFixFct();
  d.cs.csFix.w = w.innerWidth;
  d.cs.csFix.h = w.innerHeight;
  window.onresize = CSFixFct;
   }
}
function CSIsFrame (window) {
 var rootWindow = window.parent;
 if (rootWindow == 'undefined') return false;
 for (i = 0; i < rootWindow.frames.length; i++)
  if (window == rootWindow.frames[i]) return true;
 return false;
}

// --></SCRIPT>
    </CSSCRIPTDICT>
    <CSACTIONDICT>
      <SCRIPT><!--
CSInit[CSInit.length] = new Array(CSNSFix);

// --></SCRIPT>
    </CSACTIONDICT>
  </HEAD>

  <BODY bgcolor="#ffffff"  ALINK="#cc0000" VLINK="#996666" ONLOAD="CSScriptInit();CSScriptInit()">
    <SCRIPT LANGUAGE="JavaScript" SRC="/js/header_css.js"></SCRIPT>
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
      <TR>
        <TD ALIGN="left" CLASS="size2"><B>Printing</B></TD>
        <TD ALIGN="right"></TD>
      </TR>
    </TABLE>
    <P CLASS="size1">In addition to the accurate color control SVG offers through ICC color support, your SVG images are capable of printing at the maximum resolution of any printer. Instead of printing jagged screen resolution images, your SVG images will print with smooth edges and clean gradients. SVG documents are printable with all the same graphics rendering features as displayed on-screen. Any embedded fonts and unusual glyphs, as well as filter effects, will print. Another feature is that the current displayed state of the image is printed. Also, if you have zoomed in or out or panned the image, that state of the image is printed.
    <P CLASS="size1">With the example below, select different viewing modes, try zooming in and out of the image, and then print the result from your browser.
    <CENTER>
      <P CLASS="size1"><EMBED WIDTH="400" HEIGHT="400" SRC="/svg/svgfiles/map.svgz" NAME="printable_map" PLUGINSPAGE="http://www.adobe.com/svg/viewer/install/"></CENTER>
    <P CLASS="size1">
    <SCRIPT LANGUAGE="JavaScript1.2"><!--
/*
      * This function turns on/off various layers of the SVG picture.
      * It is called when the user clicks on any of the checkboxes in
      * the form below.
      *
      * Input Parameters:
      *   checkbox     - Form object (checkbox) that was clicked on.
      *   element_name - SVG element name that should be made visible/
      *                  invisible.
      */
      function hilite_elem (checkbox, element_name)
      {
       var svgobj;
       var svgstyle;
       var svgdoc = document.printable_map.getSVGDocument();

       // For each element, get the element's style object, then set
       // its visibility according to the state of the checkbox.

       svgobj = svgdoc.getElementById(element_name);
       svgstyle = svgobj.getStyle();
       if (!checkbox.checked)
       {
        // Hide layer.
        svgstyle.setProperty('visibility', 'hidden');
       }
       else
       {
        // SHow layer.
        svgstyle.setProperty('visibility', 'visible');
       }

      }
// -->
    </SCRIPT>
    <FORM NAME="hilite_form">
    <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
      <TR>
        <TD COLSPAN="2" CLASS="size1">Visible layers:<BR>
          </TD>
      </TR>
      <TR>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'topography')">Topography</TD>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'labels')">Labels</TD>
      </TR>
      <TR>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'streets')">Streets</TD>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'points_of_interest')">Points of Interest</TD>
      </TR>
      <TR>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'freeways')">Freeways</TD>
        <TD CLASS="size1"><INPUT TYPE="checkbox" VALUE="" ONCLICK="hilite_elem(this,'border_legend')">Legend</TD>
      </TR>
    </TABLE>
    <SCRIPT><!--
// Make sure all checkboxes are checked whenever the page
       // is reloaded in the browser.
       for (var i = 0;  i < document.hilite_form.elements.length;  i++)
        if (document.hilite_form.elements[i].type == 'checkbox')
         document.hilite_form.elements[i].checked = true;
// -->
    </SCRIPT>
    </FORM>
    <DIV ALIGN="left">
      <P CLASS="size1"><A HREF="/svg/source/printable_js.html">view JavaScript source</A>
      <P CLASS="size1"><A HREF="/svg/dynamic/transformations.html" TARGET="_top">Next lesson: Dynamic SVG - Transformations</A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="740">
  <TR HEIGHT="40">
    <TD WIDTH="700" HEIGHT="40"></TD>
  </TR>
  <TR>
    <TD WIDTH="700" VALIGN="top" CLASS="size1"><SPAN STYLE="color:#666666">Copyright &copy;2000 Adobe Systems Incorporated. All rights reserved.</SPAN><BR>
      <A HREF="/misc/copyright.html" target="_top">Terms of Use</A><BR>
      <A HREF="/misc/privacy.html" target="_top">Online Privacy Policy</A><BR>
    </TD>
  </TR>
  <TR HEIGHT="40">
    <TD WIDTH="700" HEIGHT="40"></TD>
  </TR>
</TABLE>

    </DIV>
  </BODY>

</HTML>


--  作者:卷积内核
--  发布时间:1/11/2006 10:52:00 AM

--  
svg源码:

--  作者:卷积内核
--  发布时间:1/11/2006 10:53:00 AM

--  
JS源码:
<script language="JavaScript1.2">
<!--
 /*
 * Other parts required but not shown here:
 * In the HTML file, the checkboxes in the form below the SVG image each
 * have the following attribute:
 *
 *  onclick="hilite_elem(this,'topography')"
 *
 * Where 'topography' is replaced by the name of the SVG element that should
 * be turned on/off whenever that checkbox button is click on.
 */

 /*
 * This function turns on/off various layers of the SVG picture.
 * It is called when the user clicks on any of the checkboxes in
 * the form below.
 *
 * Input Parameters:
 *   checkbox     - Form object (checkbox) that was clicked on.
 *   element_name - SVG element name that should be made visible/
 *                  invisible.
 */
 function hilite_elem (checkbox, element_name)
 {
  var svgobj;
  var svgstyle;
  var svgdoc = document.printable_map.getSVGDocument();

  // For each element, get the element's style object, then set
  // its visibility according to the state of the checkbox.

  svgobj = svgdoc.getElementById(element_name);
  svgstyle = svgobj.getStyle();
  if (!checkbox.checked)
  {
   // Hide layer.
   svgstyle.setProperty('visibility', 'hidden');
  }
  else
  {
   // SHow layer.
   svgstyle.setProperty('visibility', 'visible');
  }

 }
// -->
</script>


W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
171.875ms